luckminer
MCP Serverluckminerpublic

mcp rb

用于实现 MCP 协议服务器的轻量级 Ruby 框架,支持类似 Sinatra 的 DSL。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
Ruby
Language
MIT License
License

About This Server

用于实现 MCP 协议服务器的轻量级 Ruby 框架,支持类似 Sinatra 的 DSL。

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

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"

# Define a resource
resource "hello://world" do
  name "Hello World"
  description "A simple hello world message"
  call { "Hello, World!" }
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

Supported specifications

Reference: MCP 2024-11-05

  • Base Protocol
    • ping
    • stdio transport
  • Server features
    • Resources
      • resources/read
      • resources/list
    • Tools
      • tools/list
      • tools/call

Any capabilities are not supported yet.

Testing

ruby -Ilib:test -e "Dir.glob('./test/**/*_test.rb').each { |f| require f }"

Test with MCP Inspector

bunx @modelcontextprotocol/inspector $(pwd)/examples/hello_world.rb

Find broken using hello_world.rb

./test/test_requests.sh

Formatting

bundle exec standardrb --fix

Release

To release a new version:

  1. Update version in lib/mcp/version.rb
  2. Update CHANGELOG.md
  3. Create a git tag
git add .
git commit -m "Release vx.y.z"
git tag vx.y.z
git push --tags
  1. Build and push to RubyGems
gem build mcp-rb.gemspec
gem push mcp-rb-*.gem

Changelog

See CHANGELOG.md

Quick Start

1

Clone the repository

git clone https://github.com/luckminer/mcp-rb
2

Install dependencies

cd mcp-rb
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerluckminer
Repomcp-rb
LanguageRuby
LicenseMIT License
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation