ruby-sdk/docs/index.md
Koichi ITO 0c5432b027 [Doc] Update homepage with just-the-docs theme
Follow-up to https://github.com/modelcontextprotocol/ruby-sdk/pull/181.

The landing page at https://ruby.sdk.modelcontextprotocol.io previously only listed version links
to RubyDoc.info. Add multi-page documentation using the just-the-docs Jekyll theme with
sidebar navigation, search, and code highlighting.
Pages: Introduction, Installation, Building Servers, and Building Clients.

This PR introduces a basic set of pages. Additional content can be added incrementally in future updates.
2026-04-15 22:48:15 +09:00

2.4 KiB

layout title nav_order
default Introduction 1

The official Ruby SDK for the Model Context Protocol (MCP), implementing both server and client functionality for JSON-RPC 2.0 based communication between LLM applications and context providers.

Key features:

  • JSON-RPC 2.0 message handling with protocol initialization and capability negotiation
  • Tool, prompt, and resource registration and invocation
  • Stdio and Streamable HTTP (including SSE) transports
  • Client support for communicating with MCP servers
  • Notifications, sampling, progress tracking, and completions

Quick Start

Here is a minimal MCP server using the stdio transport:

require "mcp"

class ExampleTool < MCP::Tool
  description "A simple example tool that echoes back its arguments"
  input_schema(
    properties: {
      message: { type: "string" },
    },
    required: ["message"]
  )

  class << self
    def call(message:, server_context:)
      MCP::Tool::Response.new([{
        type: "text",
        text: "Hello from example tool! Message: #{message}",
      }])
    end
  end
end

server = MCP::Server.new(
  name: "example_server",
  tools: [ExampleTool],
)

transport = MCP::Server::Transports::StdioTransport.new(server)
transport.open

Run the script and send JSON-RPC requests via stdin:

$ ruby server.rb
{"jsonrpc":"2.0","id":"1","method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"example","version":"0.1.0"}}}
{"jsonrpc":"2.0","id":"2","method":"tools/list"}
{"jsonrpc":"2.0","id":"3","method":"tools/call","params":{"name":"example_tool","arguments":{"message":"Hello"}}}

For comprehensive documentation, see the full README.

API Documentation

Full API reference is hosted on RubyDoc.info. Select a version to view:

Select version... Latest {% for version in site.data.versions -%} v{{ version }} {% endfor -%}

License

This project is transitioning from the MIT License to the Apache License 2.0. See LICENSE for details.