
MCP-RB
Un cadre rubis léger pour construire des serveurs MCP avec un DSL de type Sinatra
2
Github Watches
9
Github Forks
129
Github Stars
MCP-RB
A lightweight Ruby framework for implementing MCP (Model Context Protocol) servers with a Sinatra-like DSL.
Installation
Add this line to your application's Gemfile:
gem 'mcp-rb'
Usage
Here's a simple example of how to create an MCP server:
require 'mcp'
name "hello-world"
version "1.0.0"
# Define a resource
resource "hello://world" do
name "Hello World"
description "A simple hello world message"
call { "Hello, World!" }
end
# Define a resource template
resource_template "hello://{user_name}" do
name "Hello User"
description "A simple hello user message"
call { |args| "Hello, #{args[:user_name]}!" }
end
# Define a tool
tool "greet" do
description "Greet someone by name"
argument :name, String, required: true, description: "Name to greet"
call do |args|
"Hello, #{args[:name]}!"
end
end
# Define a tool with nested arguments
tool "greet_full_name" do
description "Greet someone by their full name"
argument :person, required: true, description: "Person to greet" do
argument :first_name, String, required: false, description: "First name"
argument :last_name, String, required: false, description: "Last name"
end
call do |args|
"Hello, First: #{args[:person][:first_name]} Last: #{args[:person][:last_name]}!"
end
end
# Define a tool with an Array argument
tool "group_greeting" do
description "Greet multiple people at once"
argument :people, Array, required: true, items: String, description: "People to greet"
call do |args|
args[:people].map { |person| "Hello, #{person}!" }.join(", ")
end
end
Supported specifications
Reference: MCP 2024-11-05
-
Base Protocol
- ping
- stdio transport
-
Server features
- Resources
- resources/read
- resources/list
- resources/templates/list
- Tools
- tools/list
- tools/call
- Resources
Any capabilities are not supported yet.
Testing
rake test
rake test:unit # run only the unit tests, skipping tests that test a running server
Test with MCP Inspector
bunx @modelcontextprotocol/inspector $(pwd)/examples/hello_world.rb
Formatting
bundle exec standardrb --fix
You can also use rake tasks:
rake lint # Run standardrb to check code style
rake lint:fix # Auto-fix standardrb issues
Release
To release a new version:
- Update version in
lib/mcp/version.rb
- Update
CHANGELOG.md
- Create a git tag
git add .
git commit -m "Release vx.y.z"
git tag vx.y.z
git push --tags
- Build and push to RubyGems
gem build mcp-rb.gemspec
gem push mcp-rb-*.gem
Changelog
See CHANGELOG.md
相关推荐
I find academic articles and books for research and literature reviews.
Confidential guide on numerology and astrology, based of GG33 Public information
Advanced software engineer GPT that excels through nailing the basics.
Take an adjectivised noun, and create images making it progressively more adjective!
Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease
Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.
Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX
MCP Server pour récupérer le contenu de la page Web à l'aide du navigateur sans tête du dramwright.
L'application tout-en-un desktop et Docker AI avec chiffon intégré, agents AI, constructeur d'agent sans code, compatibilité MCP, etc.
Un puissant plugin Neovim pour gérer les serveurs MCP (Protocole de contexte modèle)
Pont entre les serveurs Olllama et MCP, permettant aux LLM locaux d'utiliser des outils de protocole de contexte de modèle
La communauté du curseur et de la planche à voile, recherchez des règles et des MCP
🧑🚀 全世界最好的 LLM 资料总结 (数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Résumé des meilleures ressources LLM du monde.
Plateforme d'automatisation de workflow à code équitable avec des capacités d'IA natives. Combinez le bâtiment visuel avec du code personnalisé, de l'auto-hôte ou du cloud, 400+ intégrations.
Reviews

user_D6HUDWhf
As a dedicated user of mcp applications, I am thoroughly impressed with mcp-rb by funwarioisii. This versatile tool simplifies complex tasks and boosts productivity. It's evident that a lot of thought and expertise went into its creation. Highly recommended for anyone looking to streamline their workflow! For more information, visit https://github.com/funwarioisii/mcp-rb.