Install
$ agentstack add mcp-sergiobayona-vector-mcp ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ● Network access Used
- ● Filesystem access Used
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
VectorMCP
[](https://badge.fury.io/rb/vectormcp) [](https://sergiobayona.github.io/vectormcp/) [](https://github.com/sergiobayona/vectormcp/actions/workflows/ruby.yml) [](https://qlty.sh/gh/sergiobayona/projects/vectormcp) [](https://opensource.org/licenses/MIT)
VectorMCP is a Ruby implementation of the Model Context Protocol (MCP) server-side specification. It gives you a framework for exposing tools, resources, prompts, roots, sampling, middleware, and security over the MCP streamable HTTP transport.
Highlights
- Streamable HTTP is the built-in transport, with session management, resumability, and MCP 2025-11-25 compliance
- Class-based tools via
VectorMCP::Tool, plus the original block-basedregister_toolAPI - Rack and Rails mounting through
server.rack_app - Opt-in authentication and authorization, structured logging, and middleware hooks
- Image-aware tools/resources/prompts, roots, and server-initiated sampling
- Token-based field anonymization middleware to keep sensitive values out of LLM context
Requirements
- Ruby 3.2+
Installation
gem install vector_mcp
gem "vector_mcp"
Quick Start
require "vector_mcp"
class Greet "/mcp"
For ActiveRecord-backed tools, opt into VectorMCP::Rails::Tool:
require "vector_mcp/rails/tool"
class FindUser < VectorMCP::Rails::Tool
description "Find a user by id"
param :id, type: :integer, required: true
def call(args, _session)
user = find!(User, args[:id])
{ id: user.id, email: user.email }
end
end
See [docs/rails-setup-guide.md](./docs/rails-setup-guide.md) for a full setup guide.
Tools, Resources, and Prompts
Expose callable tools:
server.register_tool(
name: "calculate",
description: "Performs basic math",
input_schema: {
type: "object",
properties: {
operation: { type: "string", enum: ["add", "subtract", "multiply"] },
a: { type: "number" },
b: { type: "number" }
},
required: ["operation", "a", "b"]
}
) do |args|
case args["operation"]
when "add" then args["a"] + args["b"]
when "subtract" then args["a"] - args["b"]
when "multiply" then args["a"] * args["b"]
end
end
Expose readable resources:
server.register_resource(
uri: "file://config.json",
name: "App Configuration",
description: "Current application settings"
) { File.read("config.json") }
Define prompt templates:
server.register_prompt(
name: "code_review",
description: "Reviews code for best practices",
arguments: [
{ name: "language", description: "Programming language", required: true },
{ name: "code", description: "Code to review", required: true }
]
) do |args|
{
messages: [{
role: "user",
content: {
type: "text",
text: "Review this #{args["language"]} code:\n\n#{args["code"]}"
}
}]
}
end
VectorMCP::Tool also supports type: :date and type: :datetime, which are validated as strings in JSON Schema and coerced to Date and Time before #call runs.
Security and Middleware
VectorMCP keeps security opt-in, but the primitives are built in:
server.enable_authentication!(
strategy: :api_key,
keys: ["your-secret-key"]
)
server.enable_authorization! do
authorize_tools do |user, _action, tool|
user[:role] == "admin" || !tool.name.start_with?("admin_")
end
end
Custom authentication works too:
server.enable_authentication!(strategy: :custom) do |request|
api_key = request[:headers]["X-API-Key"]
user = User.find_by(api_key: api_key)
user ? { user_id: user.id, role: user.role } : false
end
For MCP clients that speak OAuth 2.1 (e.g. Claude Desktop), pass a resource_metadata_url: to turn on RFC 9728 discovery. Unauthenticated requests to /mcp return 401 with a WWW-Authenticate header pointing at the configured metadata document, and the client drives the rest of the OAuth dance automatically. See [docs/oauthresourceserver.md](./docs/oauthresourceserver.md) for the feature reference and [docs/railsoauthintegration.md](./docs/railsoauthintegration.md) for a full Rails + Doorkeeper recipe.
Middleware can hook into tool, resource, prompt, sampling, auth, and transport events, including before_auth, after_auth, on_auth_error, before_request, after_response, and on_transport_error.
See [security/README.md](./security/README.md) for the full security guide.
Field Anonymization
Keep sensitive string values out of the LLM context by substituting them with stable opaque tokens. Values are tokenized on outbound tool results and restored on inbound tool arguments, so the LLM sees only tokens while your handlers receive the original data.
anonymizer = VectorMCP::Middleware::Anonymizer.new(
store: VectorMCP::TokenStore.new,
field_rules: [
{ pattern: /email/i, prefix: "EMAIL" },
{ pattern: /\bssn\b/i, prefix: "SSN" }
]
)
anonymizer.install_on(server)
Transport Notes
- VectorMCP ships with streamable HTTP as its built-in transport
POST /mcpaccepts a single JSON-RPC request, notification, or response; batch arrays are rejectedGET /mcpopens an SSE stream for server-initiated messagesDELETE /mcpterminates the session- The server advertises MCP protocol
2025-11-25and accepts2025-03-26and2024-11-05headers for compatibility - Default allowed origins are restricted to localhost and loopback addresses
Initialize a session with curl:
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'
More Features
- Roots via
register_rootandregister_root_from_path - Image resources and image-aware tools/prompts
- Structured logging with component loggers
- Server-initiated sampling with streaming/tool-call support
- Middleware-driven request shaping and observability
Documentation
- [CHANGELOG.md](./CHANGELOG.md)
- [examples/](./examples/)
- [docs/rails-setup-guide.md](./docs/rails-setup-guide.md)
- [docs/railsoauthintegration.md](./docs/railsoauthintegration.md)
- [docs/oauthresourceserver.md](./docs/oauthresourceserver.md)
- [docs/streamable-http-spec-compliance.md](./docs/streamable-http-spec-compliance.md)
- [security/README.md](./security/README.md)
- MCP Specification
Contributing
Bug reports and pull requests are welcome on GitHub.
License
Available as open source under the MIT License.
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: sergiobayona
- Source: sergiobayona/vector_mcp
- License: MIT
- Homepage: https://sergiobayona.github.io/vector_mcp/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.