Token导航 LogoToken导航TokenDH.com
MCP Rb logo
开发工具未说明官方级别未说明来源级核验

MCP Rb

MCP Server

A lightweight Ruby framework for building MCP servers with a Sinatra-like DSL

工具数

0

提示词数

0

GitHub Stars

205

资源数

0
Ruby服务器开发开发工具

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

funwarioisii

提供方

funwarioisii

最后核验

2026/5/18 04:04

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

MCP-RB

一个轻量级的Ruby框架,用于使用类似Sinatra的DSL实现MCP(模型上下文协议)服务器。

安装

将此行添加到应用程序的Gemfile中:

gem 'mcp-rb'

用法

下面是一个如何创建MCP服务器的简单示例:

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

支持的规格

参考: MCP 2024-11-05

- 拼 - stdio传输

- 资源 - 资源/读取 - 资源/列表 - 资源/模板/列表 - 工具 - 工具/列表 - 工具/调用

目前还不支持任何功能。

测试

rake test
rake test:unit # run only the unit tests, skipping tests that test a running server

使用MCP检查员进行测试

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

格式化

bundle exec standardrb --fix

您还可以使用rake任务:

rake lint      # Run standardrb to check code style
rake lint:fix  # Auto-fix standardrb issues

发布

要发布新版本,请执行以下操作:

  1. 更新版本 lib/mcp/version.rb
  2. 更新 CHANGELOG.md
  3. 创建一个git标签
git add .
git commit -m "Release vx.y.z"
git tag vx.y.z
git push --tags
  1. 构建并推广RubyGems
gem build mcp-rb.gemspec
gem push mcp-rb-*.gem

更新日志

更改日志.md

目录标签

目录标签

Ruby服务器开发开发工具developer-toolsmcp-servermodelcontextprotocol本地部署Ruby框架MCP协议DSL工具

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP