fast
A Ruby Implementation of the Model Context Protocol
claude mcp add --transport stdio yjacquin-fast-mcp bundle exec fast_mcp \ --env RACK_ENV="production" \ --env FAST_MCP_ENV="production"
How to use
Fast MCP for Ruby provides a Ruby-focused implementation of the Model Context Protocol, allowing you to connect your Ruby applications to AI models via a clean Tools API, Resources API, and flexible transport options. The server lets AI models securely invoke your Ruby methods (tools) with strong argument validation (via Dry-Schema), share data resources, and subscribe to real-time updates. It integrates with Rails, Sinatra, or any Rack-based app, and supports dynamic filtering to tailor tool/resource availability based on the request context. Start by defining tools (inheriting from FastMcp::Tool) and resources (inheriting from FastMcp::Resource), register them with the server, and then expose endpoints or streams that your MCP clients can consume. The project emphasizes Rails-friendly patterns but is framework-agnostic, so you can mount the MCP server in a Sinatra or Rack app as well.
How to install
Prerequisites:
- Ruby (2.7+) and Bundler installed
- A Rails, Sinatra, or Rack-based application (or a standalone Ruby script environment)
- Access to a PostgreSQL/MySQL/other DB if your tools/resources require persistence
-
Create or update your Gemfile to include fast_mcp:
gem 'fast_mcp'
-
Install dependencies:
bundle install
-
Create a basic server setup (example using a Rack/Sinatra style entry point):
config/fast_mcp.rb
require 'fast_mcp'
FastMcp.mount_in_rails( ... ) if defined?(Rails) # Rails integration (optional)
-
Define tools and resources as shown in the README, then register them with the server:
server = FastMcp::Server.new(name: 'my-app-mcp', version: '1.0.0') class CreateUserTool < FastMcp::Tool description "Create a user" arguments do required(:first_name).filled(:string) optional(:age).filled(:integer) required(:address).hash do required(:street).filled(:string) optional(:city).filled(:string) optional(:zipcode).maybe(:string) end end def call(first_name:, age: nil, address: {}) User.create!(first_name: first_name, age: age, address: address) end end server.register_tool(CreateUserTool)
-
Run the MCP server using Bundler:
bundle exec ruby -e "# start server code here"
-
Connect your MCP client to the server transports you need (STDIO, HTTP, or SSE) as described in the README. Ensure your environment variables and paths are correctly configured for production deployments.
Additional notes
Notes and tips:
- FastMcp leverages Dry-Schema for robust argument validation; define your tool arguments clearly to ensure correct API usage.
- Use server.filter_tools to tailor tool visibility based on the request context (e.g., user roles or permissions).
- When deploying in Rails, you can mount the MCP server and automatically discover tools/resources by inheriting from ApplicationTool and ApplicationResource.
- If you run into port or host binding issues, ensure allowed origins and host configuration match your deployment environment.
- For production, consider setting authenticate to true and configuring an auth_token to secure access to your MCP endpoints.
Related MCP Servers
edumcp
EDUMCP is a protocol that integrates the Model Context Protocol (MCP) with applications in the education field, dedicated to achieving seamless interconnection and interoperability among different AI models, educational applications, smart hardware, and teaching AGENTs.
lihil
2X faster ASGI web framework for python, offering high-level development, low-level performance.
nosia
Self-hosted AI RAG + MCP Platform
laravel-toon
TOON encoding for Laravel. Encode data for AI/LLMs with ~50% fewer tokens than JSON.
neurolink
Universal AI Development Platform with MCP server integration, multi-provider support, and professional CLI. Build, test, and deploy AI applications with multiple ai providers.
mcp-web-ui
MCP Web UI is a web-based user interface that serves as a Host within the Model Context Protocol (MCP) architecture. It provides a powerful and user-friendly interface for interacting with Large Language Models (LLMs) while managing context aggregation and coordination between clients and servers.