Module: VectorMCP
- Defined in:
- lib/vector_mcp.rb,
lib/vector_mcp/util.rb,
lib/vector_mcp/errors.rb,
lib/vector_mcp/logger.rb,
lib/vector_mcp/server.rb,
lib/vector_mcp/session.rb,
lib/vector_mcp/version.rb,
lib/vector_mcp/security.rb,
lib/vector_mcp/image_util.rb,
lib/vector_mcp/middleware.rb,
lib/vector_mcp/definitions.rb,
lib/vector_mcp/handlers/core.rb,
lib/vector_mcp/transport/sse.rb,
lib/vector_mcp/middleware/base.rb,
lib/vector_mcp/middleware/hook.rb,
lib/vector_mcp/request_context.rb,
lib/vector_mcp/sampling/result.rb,
lib/vector_mcp/server/registry.rb,
lib/vector_mcp/transport/stdio.rb,
lib/vector_mcp/sampling/request.rb,
lib/vector_mcp/middleware/context.rb,
lib/vector_mcp/middleware/manager.rb,
lib/vector_mcp/security/middleware.rb,
lib/vector_mcp/server/capabilities.rb,
lib/vector_mcp/security/auth_manager.rb,
lib/vector_mcp/transport/http_stream.rb,
lib/vector_mcp/security/authorization.rb,
lib/vector_mcp/server/message_handling.rb,
lib/vector_mcp/security/session_context.rb,
lib/vector_mcp/transport/sse/puma_config.rb,
lib/vector_mcp/security/strategies/custom.rb,
lib/vector_mcp/security/strategies/api_key.rb,
lib/vector_mcp/transport/sse/stream_manager.rb,
lib/vector_mcp/security/strategies/jwt_token.rb,
lib/vector_mcp/transport/sse/message_handler.rb,
lib/vector_mcp/transport/sse_session_manager.rb,
lib/vector_mcp/transport/base_session_manager.rb,
lib/vector_mcp/transport/sse/client_connection.rb,
lib/vector_mcp/transport/stdio_session_manager.rb,
lib/vector_mcp/transport/http_stream/event_store.rb,
lib/vector_mcp/transport/http_stream/stream_handler.rb,
lib/vector_mcp/transport/http_stream/session_manager.rb
Overview
The VectorMCP module provides a full-featured, opinionated Ruby implementation of the **Model Context Protocol (MCP)**. It gives developers everything needed to spin up an MCP-compatible server—including:
-
**Transport adapters** (synchronous ‘stdio` or HTTP + SSE)
-
**High-level abstractions** for tools, resources, and prompts
-
**JSON-RPC 2.0** message handling with sensible defaults and detailed error reporting helpers
-
A small, dependency-free core (aside from optional async transports) that can be embedded in CLI apps, web servers, or background jobs.
At its simplest you can do:
“‘ruby require “vector_mcp”
server = VectorMCP.new(name: “my-mcp-server”) server.register_tool(
name: "echo",
description: "Echo back the supplied text",
input_schema: {type: "object", properties: {text: {type: "string"}}}
) { |args| args }
server.run # => starts the stdio transport and begins processing JSON-RPC messages “‘
For production you could instead pass an ‘SSE` transport instance to `run` in order to serve multiple concurrent clients over HTTP.
Defined Under Namespace
Modules: Definitions, Handlers, ImageUtil, Middleware, Sampling, Security, Transport, Util Classes: Error, ForbiddenError, InitializationError, InternalError, InvalidParamsError, InvalidRequestError, Logger, MethodNotFoundError, NotFoundError, ParseError, ProtocolError, RequestContext, SamplingError, SamplingRejectedError, SamplingTimeoutError, Server, ServerError, Session, UnauthorizedError
Constant Summary collapse
- VERSION =
The current version of the VectorMCP gem.
"0.3.3"
Class Method Summary collapse
-
.logger ⇒ VectorMCP::Logger
Get the default logger.
-
.logger_for(component) ⇒ VectorMCP::Logger
Get a component-specific logger.
-
.new(*args, **kwargs) ⇒ Object
Creates a new Server instance.
Class Method Details
.logger ⇒ VectorMCP::Logger
Get the default logger
59 60 61 |
# File 'lib/vector_mcp.rb', line 59 def logger @logger ||= Logger.for("vectormcp") end |
.logger_for(component) ⇒ VectorMCP::Logger
Get a component-specific logger
53 54 55 |
# File 'lib/vector_mcp.rb', line 53 def logger_for(component) Logger.for(component) end |
.new(*args, **kwargs) ⇒ Object
Creates a new Server instance. This is a **thin wrapper** around ‘VectorMCP::Server.new`; it exists purely for syntactic sugar so you can write `VectorMCP.new` instead of `VectorMCP::Server.new`.
Any positional or keyword arguments are forwarded verbatim to the underlying constructor, so refer to VectorMCP::Server#initialize for the full list of accepted parameters.
70 71 72 |
# File 'lib/vector_mcp.rb', line 70 def new(*args, **kwargs) Server.new(*args, **kwargs) end |