Get the FREE Ultimate OpenClaw Setup Guide →

model-context-protocol-rb

An implementation of the Model Context Protocol in Ruby.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio dickdavis-model-context-protocol-rb ruby path/to/server.rb

How to use

The model-context-protocol-rb server implements the Model Context Protocol (MCP) in Ruby and provides a local stdio transport by default, with an optional Streamable HTTP transport for production deployments. It exposes MCP concepts such as prompts, resources, resource templates, and tools, allowing clients to interact with your application through a standardized set of endpoints. The server can route client messages to custom handlers you define in Ruby, enabling you to serve prompts, resources, templates, and tools, and to perform completions, logging, pagination, and cancellation as defined by the MCP spec. Use the stdio transport for quick local testing and development, or enable the HTTP transport for multi-process deployments that share state via Redis. The README shows examples of registering prompts, resources, and tools, and provides a complete wiring pattern for Rails apps when using the HTTP transport.

How to install

Prerequisites:

  • Ruby (and Bundler) installed on your machine
  • Access to a Ruby project or a dedicated server script for MCP

Install the gem (recommended):

# Add to your Gemfile
gem 'model-context-protocol-rb'

Then install dependencies:

bundle install

Or install the gem directly:

gem install model-context-protocol-rb

Create or adapt a Ruby server file (e.g., path/to/server.rb) that configures and starts the MCP server using one of the supported transports (stdio or HTTP). The README provides complete usage examples for both transports. To run a local stdio server after installation:

ruby path/to/server.rb

For a production HTTP transport with Redis coordination, follow the README’s example: initialize your handlers, configure Redis in your app, and start the server with the streamable HTTP transport pattern. If you’re using Rails, wire it into an initializer and, if applicable, enable the Puma plugin as shown in the README.

Tip: check the wiki pages referenced in the README for detailed installation and quick-start guidance specific to your framework (Rails, etc.).

Additional notes

Environment and configuration tips:

  • For the streamable HTTP transport, Redis is used to coordinate state across multiple processes. Configure REDIS_URL and related Redis options as shown in the README.
  • The server supports numerous MCP features (prompts, resources, resource templates, tools, completion, logging, pagination, cancellation, ping, progress, etc.). Ensure your registrations (prompts/resources/tools) implement the MCP interfaces expected by your handlers.
  • If you plan to run in a multi-process environment (e.g., Puma workers), prefer the HTTP transport with Redis coordination for consistency.
  • STDIO transport is ideal for development or CLI-based MCP servers that communicate via standard in/out.
  • When upgrading, review the MCP spec and the README’s Wiring examples to adjust your config blocks or handler registrations accordingly.
  • The README includes concrete code samples for register-and-serve patterns; adapt these to your domain models and use cases.

Related MCP Servers

Sponsor this space

Reach thousands of developers