Get the FREE Ultimate OpenClaw Setup Guide →

ruby -client

This is a Ruby implementation of MCP (Model Context Protocol) client

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport http simonx1-ruby-mcp-client https://api.example.com/mcp \
  --header "Authorization: Bearer TOKEN"

How to use

The ruby-mcp-client provides a Ruby interface to connect to MCP servers over multiple transports (stdio, SSE, HTTP, and Streamable HTTP) and to perform common MCP operations such as listing tools, invoking tools, and streaming results. It includes built-in conversions to OpenAI, Anthropic, and Google tool formats so you can feed the discovered tools directly into your preferred AI tooling stack. Typical usage involves creating a client that auto-detects the transport from a URL or explicitly selecting a transport, then querying tools and executing actions against those tools. You can also access prompts, resources, and structured outputs, and you can enable server-initiated interactions (elicitation) when supported by the server.

How to install

Prerequisites:

  • Ruby installed (2.7+ recommended)
  • Bundler available

Installation steps:

  1. Add the gem to your Gemfile: gem 'ruby-mcp-client'
  2. Install dependencies: bundle install

    or install the gem directly

    gem install ruby-mcp-client

Example minimal usage after installation: require 'mcp_client'

Create a client (auto-detects transport from URL)

client = MCPClient.connect('http://localhost:8000/sse')

Or connect to a streamable HTTP endpoint with auth headers

client = MCPClient.connect('https://api.example.com/mcp', headers: { 'Authorization' => 'Bearer TOKEN' })

Interact with the MCP server

tools = client.list_tools result = client.call_tool('tool_name', { param: 'value' }) client.cleanup

Additional notes

Notes:

  • The README example servers include a filesystem stdio server (npx) and a streamable HTTP API endpoint. You can customize the filesystem root, API base URL, and headers as needed.
  • Transport detection supports SSE, Streamable HTTP, and stdio; you can force a specific transport if required.
  • If you use stdio, ensure the referenced command is available in your environment (e.g., npx with the @modelcontextprotocol/server-filesystem package).
  • The MCP 2025-11-25 features cover Tool Prompts, Resources, Elicitation, Roots, Sampling, Completion, Logging, and more. Leverage these features via the Ruby client to build robust tool integrations and AI workflows.
  • Environment variables (e.g., AUTH tokens, API keys) should be provided through the headers option or your environment management strategy.
  • When using streaming (SSE/Streamable HTTP), handle chunks or events as they arrive and design your UI/update loop accordingly.

Related MCP Servers

Sponsor this space

Reach thousands of developers