Get the FREE Ultimate OpenClaw Setup Guide →

fast

A Ruby Implementation of the Model Context Protocol

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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
  1. Create or update your Gemfile to include fast_mcp:

    gem 'fast_mcp'

  2. Install dependencies:

    bundle install

  3. 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)

  4. 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)

  5. Run the MCP server using Bundler:

    bundle exec ruby -e "# start server code here"

  6. 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

Sponsor this space

Reach thousands of developers