$git clone https://github.com/yjacquin/fast-mcpAI models are powerful, but they need to interact with your applications to be truly useful. Traditional approaches mean wrestling with:
| 1 | # Fast MCP 🚀 |
| 2 | |
| 3 | <div align="center"> |
| 4 | <h3>Connect AI models to your Ruby applications with ease</h3> |
| 5 | <p>No complex protocols, no integration headaches, no compatibility issues – just beautiful, expressive Ruby code.</p> |
| 6 | </div> |
| 7 | |
| 8 | <p align="center"> |
| 9 | <a href="https://badge.fury.io/rb/fast-mcp"><img src="https://badge.fury.io/rb/fast-mcp.svg" alt="Gem Version" /></a> |
| 10 | <a href="https://github.com/yjacquin/fast-mcp/workflows/CI/badge.svg"><img src="https://github.com/yjacquin/fast-mcp/workflows/CI/badge.svg" alt="CI Status" /></a> |
| 11 | <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a> |
| 12 | <a href="code_of_conduct.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg" alt="Contributor Covenant" /></a> |
| 13 | <a href="https://discord.gg/9HHfAtY3HF"><img src = "https://dcbadge.limes.pink/api/server/https://discord.gg/9HHfAtY3HF?style=flat" alt="Discord invite link" /></a> |
| 14 | </p> |
| 15 | |
| 16 | ## 🌟 Interface your Servers with LLMs in minutes |
| 17 | |
| 18 | AI models are powerful, but they need to interact with your applications to be truly useful. Traditional approaches mean wrestling with: |
| 19 | |
| 20 | - 🔄 Complex communication protocols and custom JSON formats |
| 21 | - 🔌 Integration challenges with different model providers |
| 22 | - 🧩 Compatibility issues between your app and AI tools |
| 23 | - 🧠 Managing the state between AI interactions and your data |
| 24 | |
| 25 | Fast MCP solves all these problems by providing a clean, Ruby-focused implementation of the [Model Context Protocol](https://github.com/modelcontextprotocol), making AI integration a joy, not a chore. |
| 26 | |
| 27 | ## ✨ Features |
| 28 | |
| 29 | - 🛠️ **Tools API** - Let AI models call your Ruby functions securely, with in-depth argument validation through [Dry-Schema](https://github.com/dry-rb/dry-schema). |
| 30 | - 📚 **Resources API** - Share data between your app and AI models |
| 31 | - 🔄 **Multiple Transports** - Choose from STDIO, HTTP, or SSE based on your needs |
| 32 | - 🧩 **Framework Integration** - Works seamlessly with Rails, Sinatra or any Rack app. |
| 33 | - 🔒 **Authentication Support** - Secure your AI-powered endpoints with ease |
| 34 | - 🚀 **Real-time Updates** - Subscribe to changes for interactive applications |
| 35 | - 🎯 **Dynamic Filtering** - Control tool/resource access based on request context (permissions, API versions, etc.) |
| 36 | |
| 37 | ## 💎 What Makes FastMCP Great |
| 38 | |
| 39 | ```ruby |
| 40 | # Define tools for AI models to use |
| 41 | server = FastMcp::Server.new(name: 'popular-users', version: '1.0.0') |
| 42 | |
| 43 | # Define a tool by inheriting from FastMcp::Tool |
| 44 | class CreateUserTool < FastMcp::Tool |
| 45 | description "Create a user" |
| 46 | # These arguments will generate the needed JSON to be presented to the MCP Client |
| 47 | # And they will be validated at run time. |
| 48 | # The validation is based off Dry-Schema, with the addition of the description. |
| 49 | arguments do |
| 50 | required(:first_name).filled(:string).description("First name of the user") |
| 51 | optional(:age).filled(:integer).description("Age of the user") |
| 52 | required(:address).description("The shipping address").hash do |
| 53 | required(:street).filled(:string).description("Street address") |
| 54 | optional(:city).filled(:string).description("City name") |
| 55 | optional(:zipcode).maybe(:string).description("Postal code") |
| 56 | end |
| 57 | end |
| 58 | |
| 59 | def call(first_name:, age: nil, address: {}) |
| 60 | User.create!(first_name:, age:, address:) |
| 61 | end |
| 62 | end |
| 63 | |
| 64 | # Register the tool with the server |
| 65 | server.register_tool(CreateUserTool) |
| 66 | |
| 67 | # Share data resources with AI models by inheriting from FastMcp::Resource |
| 68 | class PopularUsers < FastMcp::Resource |
| 69 | uri "myapp:///users/popular" |
| 70 | resource_name "Popular Users" |
| 71 | mime_type "application/json" |
| 72 | |
| 73 | def content |
| 74 | JSON.generate(User.popular.limit(5).as_json) |
| 75 | end |
| 76 | end |
| 77 | |
| 78 | class User < FastMcp::Resource |
| 79 | uri "myapp:///users/{id}" # This is a resource template |
| 80 | resource_name "user" |
| 81 | mime_type "application/json" |
| 82 | |
| 83 | def content |
| 84 | id = params[:id] # params are computed from the uri pattern |
| 85 | |
| 86 | JSON.generate(User.find(id).as_json) |
| 87 | end |
| 88 | end |
| 89 | |
| 90 | # Register the resource with the |