Ruby LLM
Full-featured MCP support for Ruby and RubyLLM—making it easy to build structured, composable LLM workflows in pure Ruby.
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
Maintainer
Works with
Installation
Manual Installation
npx ruby-llmConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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
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 installFor 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:migrateCreate 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]
}
)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 responseUse 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.
Ruby LLM Alternatives — Similar Developer Tools Servers
Looking for alternatives to Ruby LLM? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
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.
Set Up Ruby LLM in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.