VectorMCP

by sergiobayona

157 downloads
Not rated
GitHub

About

A easy-to-use and minimal server implementation for the Model Context Protocol (MCP) in Ruby.

Details

Author
sergiobayona
Downloads
157
Categories
Other

- Implements core server-side MCP specification.
- Define and register custom tools for LLM invocation.
- Expose data sources as resources for LLM reading.
- Provide structured prompt templates.
- Stdio transport (stable); SSE transport (work-in-progress).
- Extensible handlers with default MCP method implementations.
- Ruby-like API using blocks for registration.
- Automatic conversion of return values to MCP content format.

Install the gem with gem install vector_mcp or add it to your Gemfile. Create a server instance with VectorMCP.new, register tools and resources using register_tool and register_resource, then call server.run to start listening on STDIN/STDOUT. Requests must be newline-delimited JSON-RPC objects.

VectorMCP

<!-- Badges (Add URLs later) -->
Gem Version
Build Status
Maintainability
Test Coverage
License: MIT

VectorMCP provides server-side tools for implementing the Model Context Protocol (MCP) in Ruby applications. MCP is a specification for how Large Language Models (LLMs) can discover and interact with external tools, resources, and prompts provided by separate applications (MCP Servers).

This library allows you to easily create MCP servers that expose your application's capabilities (like functions, data sources, or predefined prompt templates) to compatible LLM clients (e.g., Claude Desktop App, custom clients).

Features

MCP Specification Adherence: Implements core server-side aspects of the MCP specification.
Tools: Define and register custom tools (functions) that the LLM can invoke.
Resources: Expose data sources (files, database results, API outputs) for the LLM to read.
Prompts: Provide structured prompt templates the LLM can request and use.
Transport:
Stdio (stable): Simple transport using standard input/output, ideal for process-based servers.
SSE (work-in-progress): Server-Sent Events support is under active development and currently unavailable.
Extensible Handlers: Provides default handlers for core MCP methods, which can be overridden.
Clear Error Handling: Custom error classes mapping to JSON-RPC/MCP error codes.
Ruby-like API: Uses blocks for registering handlers, following idiomatic Ruby patterns.

Installation

Add this line to your application's Gemfile:

gem 'vector_mcp'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install vector_mcp

> ⚠️ Heads-up: SSE transport is not yet supported in the released gem. When it lands it will require additional gems (async, async-http, falcon, rack).

Quick Start

This example creates a simple server that runs over standard input/output and provides one tool.

```ruby
require 'vector_mcp'

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.