Ruby LLM

Data and AI

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

Your AI app calls the Ruby LLM MCP server, which does the data and AI work and sends the result back to the chat.

About Ruby LLM

Ruby LLM is a community MCP server from patvice, filed in our directory under data and ai. Full-featured MCP support for Ruby and RubyLLM, making it easy to build structured, composable LLM workflows in pure Ruby.

At a glance

Publisher
patvice (community)
Runs
See the README for setup
Written in
Ruby
License
MIT
GitHub stars
269

How to set up Ruby LLM

  1. Follow the install steps in the Ruby LLM README; it is written in Ruby, so have that toolchain ready.
  2. Check the Ruby LLM README for keys or settings; the registry lists none that Ruby LLM requires.
  3. Add Ruby LLM to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Ruby LLM tools to confirm the connection.
  5. Run one read-only task with Ruby LLM first, and keep your app asking before each tool call until the results look right.

Ruby LLM compared with similar servers

  • Gemini by aliargun has fewer GitHub stars than Ruby LLM (264 against 269); both are community servers, and both run locally.
  • Echarts by hustcc has more GitHub stars than Ruby LLM (270 against 269); both are community servers, and both run locally.
  • Netbox by netboxlabs has fewer GitHub stars than Ruby LLM (261 against 269); both are community servers, and both run locally.

Before you connect Ruby LLM

  • Give Ruby LLM its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Ruby LLM tool call until you trust what it does with them.
  • Treat text that Ruby LLM fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Ruby LLM on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Ruby LLM

How marketing and sales teams put Ruby LLM to work, by company size. Pick the size closest to yours and start Ruby LLM on one use case.

Small business

  • A small team can use Ruby LLM to clean and enrich a lead list or a spreadsheet in one pass, instead of hours of copy and paste.
  • Owners can ask Ruby LLM to sort feedback, reviews or survey answers into themes and see what customers mention most.
  • Ruby LLM runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing ops can connect Ruby LLM to enrich and score inbound leads, so sales sees fit and intent before the first call.
  • Content and research teams can use Ruby LLM to analyze transcripts and surveys at scale and pull the quotes worth using.
  • Start Ruby LLM on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises can run Ruby LLM inside their own cloud and data boundary, so models and data stay where governance requires.
  • Large teams can use Ruby LLM in batch pipelines with evaluation and logging, so AI output is measured before it reaches customers.
  • Ruby LLM is a community server, so have security review the code and pin a version before Ruby LLM touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Ruby LLM README

From patvice/ruby_llm-mcp on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

MCP for Ruby and RubyLLM, as easy as possible.

RubyLLM::MCP is a Ruby client for the Model Context Protocol (MCP), built to work cleanly with RubyLLM. Aiming to be completely spec compliant.

Use MCP tools, resources, and prompts from your RubyLLM chats over stdio, streamable HTTP, or SSE.

Protocol support: Fully supports MCP spec 2025-06-18 (stable), with draft spec 2026-01-26 available.

RubyLLM::MCP Out of the Box

Our goal is to be able to plug MCP into Ruby/RubyLLM apps as easily as possible.

RubyLLM::MCP gives you that:

  • Ruby-first API for using MCP tools, resources, and prompts directly in RubyLLM chat workflows
  • Stable protocol track by default (2025-06-18), with opt-in draft track (2026-01-26)
  • Built-in notification and response handlers for real-time and interactive workflows
  • MCP OAuth 2.1 authentication support (PKCE, dynamic registration, discovery, and automatic token refresh)
  • OAuth setup paths for Rails apps (per-user connections) and browser-based CLI flows
  • Straightforward integration for any Ruby app, background job, or Rails project using RubyLLM

Show me the code

# Basic setup
require "ruby_llm/mcp"

RubyLLM.configure do |config|
  config.openai_api_key = ENV.fetch("OPENAI_API_KEY")
end

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

chat = RubyLLM.chat(model: "gpt-4.1-mini")
chat.with_tools(*client.tools)

puts chat.ask("Find Ruby files modified today and summarize what changed.")
# Resources
resource = client.resource("release_notes")
chat = RubyLLM.chat(model: "gpt-4.1-mini")
chat.with_resource(resource)

puts chat.ask("Summarize release notes for the team in 5 bullet points.")
# Prompts
prompt = client.prompt("code_review")
chat = RubyLLM.chat(model: "gpt-4.1-mini")

response = chat.ask_prompt(
  prompt,
  arguments: {
    language: "ruby",
    focus: "security"
  }
)

puts response
# Handlers (response + notifications)
client.on_progress do |progress|
  puts "Progress: #{progress.progress}% - #{progress.message}"
end

client.on_logging do |logging|
  puts "[#{logging.level}] #{logging.message}"
end

chat = RubyLLM.chat(model: "gpt-4.1-mini")
chat.with_tools(*client.tools)

chat.ask("Run a repository scan and summarize risks.") do |chunk|
  print chunk.content
end
# OAuth setup (Rails and CLI)
# Rails: per-user OAuth client (after running rails generate ruby_llm:mcp:oauth:install User)
client = current_user.mcp_client
chat = RubyLLM.chat(model: "gpt-4.1-mini")
chat.with_tools(*client.tools)
puts chat.ask("What changed in my connected repos this week?")

# CLI: browser-based OAuth flow
cli_client = RubyLLM::MCP.client(
  name: "oauth-server",
  transport_type: :streamable,
  start: false,
  config: {
    url: ENV.fetch("MCP_SERVER_URL"),
    oauth: { scope: "mcp:read mcp:write" }
  }
)

cli_client.oauth(type: :browser).authenticate
cli_client.start
puts RubyLLM.chat(model: "gpt-4.1-mini").with_tools(*cli_client.tools).ask("List my open tasks.")
cli_client.stop

Features

  • Tools: Convert MCP tools into RubyLLM-compatible tools
  • Resources: Work with resources and resource templates in chat context
  • Prompts: Execute server prompts with typed arguments
  • Transports: :stdio, :streamable, and :sse
  • Client capabilities: Sampling, roots, progress tracking, and elicitation
  • Handlers: Built-in notification and response handlers for real-time and interactive workflows
  • MCP Authentication: OAuth 2.1 support with PKCE, dynamic registration, discovery, and automatic token refresh
  • OAuth setup paths: Rails per-user OAuth setup and browser-based OAuth for CLI tools
  • Extensions: Global/per-client extension negotiation, including MCP Apps
  • Multi-client support: Manage multiple MCP servers in one workflow
  • Protocol control: Stable default with explicit draft opt-in
  • Adapters: Native :ruby_llm adapter (full feature set) and optional :mcp_sdk

Installation

Add to your Gemfile:

gem "ruby_llm-mcp"

Then run:

bundle install

If you want the official SDK adapter, also add:

gem "mcp", "~> 0.7"

Rails

rails generate ruby_llm:mcp:install

For OAuth-based user connections:

rails generate ruby_llm:mcp:oauth:install User

OAuth quick example:

client = RubyLLM::MCP.client(
  name: "oauth-server",
  transport_type: :streamable,
  start: false,
  config: {
    url: ENV.fetch("MCP_SERVER_URL"),
    oauth: { scope: "mcp:read mcp:write" }
  }
)

client.oauth(type: :browser).authenticate
client.start

chat = RubyLLM.chat(model: "gpt-4.1-mini")
chat.with_tools(*client.tools)
puts chat.ask("What should I prioritize today?")

client.stop

Then use explicit connection blocks in jobs/controllers/services:

RubyLLM::MCP.establish_connection do |clients|
  chat = RubyLLM.chat(model: "gpt-4.1-mini")
  chat.with_tools(*clients.tools)
  chat.ask("Analyze this pull request and list risks.")
end

Documentation

Contributing

Issues and pull requests are welcome at patvice/ruby_llm-mcp.

License

Released under the MIT License.

Questions about Ruby LLM

What is the Ruby LLM MCP server?

Full-featured MCP support for Ruby and RubyLLM, making it easy to build structured, composable LLM workflows in pure Ruby. Ruby LLM is maintained by patvice on GitHub at patvice/ruby_llm-mcp, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Ruby LLM MCP server?

Ruby LLM doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (patvice/ruby_llm-mcp). Like most servers, Ruby LLM ends with a command or URL you paste into your AI app's MCP config.

Does Ruby LLM need an API key?

The registry lists no required keys for Ruby LLM. Check the Ruby LLM README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Ruby LLM an official MCP server?

No. Ruby LLM is a community server maintained by patvice. Community servers can be excellent; read the code and the open issues before you give Ruby LLM access to company data.

What license is Ruby LLM under?

Ruby LLM is released under the MIT license, according to its GitHub repository. The license covers the code of Ruby LLM; the service it connects to has its own terms.