VectorMCP logo

VectorMCP

by sergiobayona

VectorMCP provides server-side tools for implementing the Model Context Protocol (MCP) in Ruby applications. It allows you to easily create MCP servers that expose your application's capabilities to compatible LLM clients.

View on GitHub

Last updated: N/A

What is VectorMCP?

VectorMCP is a Ruby library that helps you build MCP servers. These servers expose your application's functions, data sources, and prompt templates to Large Language Models (LLMs) that support the Model Context Protocol.

How to use VectorMCP?

Install the gem, create a server instance, register tools, resources, and prompts, and then run the server. The server listens for JSON-RPC requests on STDIN/STDOUT (or SSE when available) and responds accordingly.

Key features of VectorMCP

  • MCP Specification Adherence

  • Tools: Define and register custom functions

  • Resources: Expose data sources

  • Prompts: Provide structured prompt templates

  • Transport: Stdio (stable), SSE (work-in-progress)

Use cases of VectorMCP

  • Exposing application functions to LLMs

  • Providing data sources for LLMs to read

  • Offering predefined prompt templates to LLMs

  • Integrating Ruby applications with LLM workflows

FAQ from VectorMCP

What is MCP?

MCP stands for Model Context Protocol. It's a specification for how LLMs can discover and interact with external tools, resources, and prompts.

What transport methods are supported?

Currently, Stdio (standard input/output) is stable. SSE (Server-Sent Events) support is under development.

How do I register a tool?

Use the register_tool method, providing a name, description, and input schema. The block you provide will be executed when the tool is called.

What kind of data can I expose as a resource?

You can expose strings, hashes, or binary data. The library automatically converts the return value to MCP content format.

How do I handle errors?

Raise one of the provided error classes like VectorMCP::NotFoundError or VectorMCP::InvalidParamsError to ensure proper JSON-RPC error responses.