Ruby Sdk logo

Ruby Sdk

Ruby SDK for building MCP servers and clients over stdio or Streamable HTTP.

Install Ruby Sdk

Pick your client, then add it in one click or paste the config.

Streamable HTTP (Remote)
Server URL
https://rubydoc.info/gems/mcp

Remote servers are added in the app, not the config file: Customize → Connectors → Add custom connector, then paste this URL.

Overview

ruby-sdk provides Ruby APIs for building MCP servers that expose tools, prompts, and resources, as well as clients that connect to MCP servers. It supports stdio and Streamable HTTP transports, including SSE and Rails integration. The SDK covers lifecycle negotiation, OAuth 2.1 authorization and resource-server protection, notifications, progress, cancellation, logging, completions, and pagination. Reach for it when a Ruby application needs to participate in MCP as a server, client, or both.

Use cases

  • Build a Ruby MCP server that exposes application tools
  • Connect a Ruby process to a local MCP server over stdio
  • Add an MCP endpoint to a Rails application
  • Protect an MCP resource server with OAuth 2.1
  • Implement a Ruby MCP client for a remote HTTP server

Key features

  • Build MCP servers and clients in Ruby
  • Expose tools, prompts, and resources
  • Support stdio, Streamable HTTP, and SSE
  • Integrate MCP servers with Rails
  • Handle OAuth 2.1 authorization and resource protection
  • Support protocol lifecycle, progress, cancellation, and pagination

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 1d ago

Recent health check succeeded.

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars940Stargazers on the source repository.
Last commit1d agoMost recent push to the default branch.

How Ruby Sdk works

What ruby-sdk does

ruby-sdk is the official Ruby implementation of the Model Context Protocol for both sides of an MCP connection. Ruby applications can use it to expose tools, prompts, and resources to MCP hosts, or to connect to MCP servers and invoke their capabilities.

The SDK covers the protocol features needed for more than basic request and response handling. It includes lifecycle negotiation, server-to-client requests, multi-step exchanges, notifications, progress reporting, logging, cancellation, completions, and pagination. OAuth 2.1 support is available for protecting MCP servers as resource servers and for authorizing clients.

How it works

A server is assembled from Ruby classes and an MCP::Server instance. Tools define their descriptions, input schemas, and call behavior, then become available through a selected transport. A minimal stdio server reads JSON-RPC messages from standard input and writes responses to standard output.

Clients use a transport-specific implementation, such as MCP::Client::Stdio for spawning a local subprocess or MCP::Client::HTTP for connecting to a Streamable HTTP endpoint. After creating an MCP::Client, the application calls connect to negotiate the protocol lifecycle, lists available tools, and invokes a selected tool with arguments.

Streamable HTTP support also includes SSE. Servers can run independently or be mounted in a Rails application, making the SDK suitable for standalone Ruby processes and Rails-based MCP endpoints.

Setup and configuration

Add the gem to a Ruby application's Gemfile:

ruby
gem "mcp"

Run bundle install, or install the package directly with gem install mcp. Some optional SDK features may require additional dependencies.

A server needs a name, its available tools, and a transport. A client needs a transport configured with the command and arguments for a local server, or with the endpoint details for an HTTP server. The stdio client also accepts environment variables for the spawned process and a read timeout.

Runnable examples include a basic server and client as well as a complete Rails application. The SDK guides and API reference provide the detailed Ruby interfaces for server, client, and transport setup.

Tools and capabilities

  • Define MCP tools with descriptions and input schemas.
  • Expose prompts and resources from Ruby MCP servers.
  • Connect to local subprocesses over stdio.
  • Connect to remote endpoints over Streamable HTTP and SSE.
  • Integrate an MCP server with Rails.
  • Negotiate client and server lifecycles automatically.
  • Support OAuth 2.1 authorization and resource-server protection.
  • Handle progress, cancellation, notifications, logging, completions, pagination, and server-to-client requests.

Limitations and notes

The package is an SDK rather than a single turnkey MCP service: applications must define their own server capabilities or client behavior. Additional dependencies may be needed for selected features. New contributions are under Apache License 2.0, while existing code is under MIT, as described by the project license.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Ruby Sdk

ruby-sdk is an MCP server that helps Ruby applications build MCP servers and clients, connecting applications to MCP hosts and other MCP servers. Its main tools are Ruby APIs for exposing and calling tools, prompts, and resources, with stdio and Streamable HTTP transports plus protocol lifecycle, authorization, and messaging support.

Add `gem "mcp"` to your Gemfile and run `bundle install`, or install it directly with `gem install mcp`. Some features may require additional dependencies, and your application must define the server or client behavior it needs.

Define tool classes with descriptions, input schemas, and call behavior, then pass them to `MCP::Server`. Start the server with a stdio or Streamable HTTP transport. The SDK also supports prompts, resources, Rails mounting, and OAuth 2.1 resource-server protection.

Create an `MCP::Client` with either the stdio or HTTP transport, call `connect` to negotiate the protocol lifecycle, then list and invoke tools. The stdio transport can spawn a local server subprocess, while the HTTP transport connects to a Streamable HTTP server.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewRuby Sdk AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/ruby-sdk?style=directory)](https://allmcps.com/mcp/ruby-sdk)
HTML Embed
<a href="https://allmcps.com/mcp/ruby-sdk"><img src="https://allmcps.com/api/badge/ruby-sdk?style=directory" alt="Ruby Sdk on AllMCPs" /></a>