Ruby LLM

v1.0.0Developer Toolsstable

Full-featured MCP support for Ruby and RubyLLM—making it easy to build structured, composable LLM workflows in pure Ruby.

aillmsmcpmcp-clientsrails
Share:
246
Stars
0
Downloads
0
Weekly
0/5

What is Ruby LLM?

Ruby LLM is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to full-featured mcp support for ruby and rubyllm—making it easy to build structured, composable llm workflows in pure ruby.

Full-featured MCP support for Ruby and RubyLLM—making it easy to build structured, composable LLM workflows in pure Ruby.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Full-featured MCP support for Ruby and RubyLLM—making it eas

Use Cases

Build LLM workflows in Ruby
Create composable Ruby agents
Support Rails and Ruby development
patvice

Maintainer

LicenseMIT
Languageruby
Versionv1.0.0
UpdatedMay 17, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx ruby-llm

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Ruby LLM

ruby_llm-mcp is a Ruby gem that adds full Model Context Protocol support to the RubyLLM library, enabling Ruby and Rails applications to connect to any MCP server and use its tools, resources, and prompts as first-class building blocks in LLM-powered workflows. It supports stdio, Streamable HTTP, and SSE transports, implements OAuth 2.1 with PKCE for secure user-level connections, and provides Rails generators for quick integration with ActiveRecord-backed multi-user applications. Ruby developers who want to build composable, tool-augmented LLM agents without leaving the Ruby ecosystem will find this the most idiomatic path to MCP integration.

Prerequisites

  • Ruby 3.1 or newer
  • Bundler for gem management
  • RubyLLM gem (ruby_llm) already added to your project
  • An API key for your chosen LLM provider (e.g., OPENAI_API_KEY or ANTHROPIC_API_KEY) configured in RubyLLM
  • For Rails integration: Rails 7+ and an existing Rails application
1

Add the gem to your Gemfile

Add ruby_llm-mcp to your Gemfile. If you also want to use the official MCP Ruby SDK adapter, add that too.

# Gemfile
gem "ruby_llm-mcp"
gem "mcp", "~> 0.7"  # optional SDK adapter support

# Then install:
bundle install
2

For Rails: run the install generator

The gem ships a Rails generator that creates the initializer, migrations, and boilerplate needed for MCP integration. Use the oauth generator if you need per-user OAuth connections.

# Basic install:
rails generate ruby_llm:mcp:install

# With per-user OAuth support (replace User with your model name):
rails generate ruby_llm:mcp:oauth:install User

rails db:migrate
3

Create an MCP client connection

Instantiate an MCP client by specifying the transport type and server configuration. The example below connects to the filesystem MCP server via stdio transport.

require "ruby_llm/mcp"

client = RubyLLM::MCP.client(
  name: "filesystem",
  transport_type: :stdio,
  config: {
    command: "bunx",
    args: ["@modelcontextprotocol/server-filesystem", Dir.pwd]
  }
)
4

Attach MCP tools to a RubyLLM chat session

Convert MCP tools into RubyLLM-compatible tools and attach them to a chat. The model will automatically call the MCP server when it needs to use a tool.

chat = RubyLLM.chat(model: "claude-3-5-sonnet-20241022")
chat.with_tools(*client.tools)

response = chat.ask("List all .rb files in the current directory")
puts response
5

Use resources and prompts from MCP servers

Beyond tools, you can also access MCP server resources (file contents, database records) and server-defined prompts directly in your chat workflow.

# Add a resource to the chat context:
resource = client.resources.find { |r| r.name == "schema.sql" }
chat.with_resource(resource)

# Execute a server prompt:
prompt = client.prompts.find { |p| p.name == "summarize" }
chat.with_prompt(prompt, topic: "Ruby best practices")

Ruby LLM Examples

Client configuration

Minimal Ruby script connecting to a filesystem MCP server and asking a question using tools.

require "ruby_llm/mcp"

RubyLLM.configure do |config|
  config.anthropic_api_key = ENV.fetch("ANTHROPIC_API_KEY")
end

client = RubyLLM::MCP.client(
  name: "filesystem",
  transport_type: :stdio,
  config: {
    command: "npx",
    args: ["-y", "@modelcontextprotocol/server-filesystem", Dir.pwd]
  }
)

chat = RubyLLM.chat(model: "claude-3-5-sonnet-20241022")
chat.with_tools(*client.tools)
puts chat.ask("What Ruby files are in this project?")

Prompts to try

Example use cases you can implement once ruby_llm-mcp is wired into your application.

- "List all Ruby files in the project and identify any files over 200 lines."
- "Read the contents of config/database.yml and explain the database configuration."
- "Connect to the GitHub MCP server and list open pull requests for this repository."
- "Use the Postgres MCP server to query the users table and return the 5 most recent sign-ups."

Troubleshooting Ruby LLM

NameError: uninitialized constant RubyLLM::MCP

Add 'require "ruby_llm/mcp"' at the top of your file or in config/initializers/ruby_llm.rb. The gem does not auto-require; you must explicitly require it.

MCP client raises transport error when using :stdio transport

Verify the command (e.g., 'npx', 'bunx', 'python3') is on PATH in the process where Ruby runs. In Rails, PATH may differ from your shell. Use the full path to the binary (e.g., '/usr/local/bin/npx') or set PATH explicitly in your process environment.

OAuth token refresh fails in multi-user Rails setup

The OAuth generators create token storage backed by your User model. Ensure the migration ran ('rails db:migrate') and that your OAuth app credentials are set in the initializer. Check that the OAuth redirect URI registered with the MCP server matches your application's callback URL exactly.

Frequently Asked Questions about Ruby LLM

What is Ruby LLM?

Ruby LLM is a Model Context Protocol (MCP) server that full-featured mcp support for ruby and rubyllm—making it easy to build structured, composable llm workflows in pure ruby. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Ruby LLM?

Follow the installation instructions on the Ruby LLM GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Ruby LLM?

Ruby LLM works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Ruby LLM free to use?

Yes, Ruby LLM is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "ruby-llm": { "command": "npx", "args": ["-y", "ruby-llm"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Ruby LLM?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides