mcp-rb

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

GitHub Stars

202

User Rating

Not Rated

Favorites

0

Views

119

Forks

14

Issues

14

Installation
Difficulty
Beginner
Estimated Time
5-10 minutes
Requirements
Ruby: 2.7以上
Bundler: 最新版

Installation

Installation

Prerequisites

Ruby: 2.7 or higher
Bundler: Latest version

Installation Steps

1. Add to Gemfile

ruby
gem 'mcp-rb'

2. Install Dependencies

bash
bundle install

Troubleshooting

Issue: Gem not found Solution: Ensure Bundler is installed correctly.

Configuration

Configuration

Basic Configuration

Here is a basic configuration example for defining resources and tools in the MCP server:
ruby
name "hello-world"
version "1.0.0"

resource "hello://world" do
  name "Hello World"
  description "A simple hello world message"
  call { "Hello, World!" }
end

Examples

Examples

Basic Usage

Here is a basic usage example for the MCP server:
ruby
require 'mcp'

name "hello-world"
version "1.0.0"

resource "hello://world" do
  name "Hello World"
  description "A simple hello world message"
  call { "Hello, World!" }
end

Use Cases

Building an MCP server that returns a simple Hello World message
Creating a tool that greets a user by their username
Implementing a tool that greets multiple people at once
Generating dynamic resources using resource templates