Module: VectorMCP
- Defined in:
- lib/vector_mcp.rb,
lib/vector_mcp/tool.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/log_filter.rb,
lib/vector_mcp/middleware.rb,
lib/vector_mcp/rails/tool.rb,
lib/vector_mcp/definitions.rb,
lib/vector_mcp/token_store.rb,
lib/vector_mcp/handlers/core.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/sampling/request.rb,
lib/vector_mcp/middleware/context.rb,
lib/vector_mcp/middleware/manager.rb,
lib/vector_mcp/util/token_sweeper.rb,
lib/vector_mcp/security/middleware.rb,
lib/vector_mcp/server/capabilities.rb,
lib/vector_mcp/security/auth_result.rb,
lib/vector_mcp/middleware/anonymizer.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/security/strategies/custom.rb,
lib/vector_mcp/security/strategies/api_key.rb,
lib/vector_mcp/security/strategies/jwt_token.rb,
lib/vector_mcp/transport/base_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** (streamable HTTP)
-
**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 HTTP stream transport and begins processing JSON-RPC messages “‘
The default HTTP stream transport supports multiple concurrent clients over HTTP.
Defined Under Namespace
Modules: Definitions, Handlers, ImageUtil, LogFilter, Middleware, Rails, Sampling, Security, Transport, Util Classes: Error, ForbiddenError, InitializationError, InternalError, InvalidParamsError, InvalidRequestError, Logger, MethodNotFoundError, NotFoundError, ParseError, ProtocolError, RequestContext, SamplingError, SamplingRejectedError, SamplingTimeoutError, Server, ServerError, Session, TokenStore, Tool, UnauthorizedError
Constant Summary collapse
- VERSION =
The current version of the VectorMCP gem.
"0.5.0"
Class Method Summary collapse
-
.logger ⇒ VectorMCP::Logger
Get the default logger.
-
.logger_for(component) ⇒ VectorMCP::Logger
Get a component-specific logger.
-
.new ⇒ Object
Creates a new Server instance.
Class Method Details
.logger ⇒ VectorMCP::Logger
Get the default logger
60 61 62 |
# File 'lib/vector_mcp.rb', line 60 def logger @logger ||= Logger.for("vectormcp") end |
.logger_for(component) ⇒ VectorMCP::Logger
Get a component-specific logger
54 55 56 |
# File 'lib/vector_mcp.rb', line 54 def logger_for(component) Logger.for(component) end |
.new ⇒ 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.
71 72 73 |
# File 'lib/vector_mcp.rb', line 71 def new(*, **) Server.new(*, **) end |