Logo vun MCP Server Plugin

MCP Server Plugin

Communautéit
raja-jamwal

Allows AI assistants to eval and verify rails/ruby code changes at lighting-speed access without the need restart server.

Editeurraja-jamwal
Repositoryrails-mcp
SproochRuby
Forks
6
Stären
12
Disponibel Tools
0
Transporttypstreamable-http
Kategorien
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    MCP Server Plugin stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    12 Stären an 6 Forks aus dem verlinkte Repository.

rails-mcp

Setting this up? Point your coding agent (Cursor, Claude Code, etc.) at llms.txt and ask it to self-configure rails-mcp in your project.

A Ruby gem that provides AI assistants with ruby code execution capabilities within the context of existing running application server. Think of it giving AI assistant lighting-speed access to ruby console without the need to write script, reload or restart.

Works with Rails, Sinatra, Hanami, Roda, and any other Rack-based framework. The code is executed in your application's context for debugging and investigation.

YouTube Link

Used at

Used at Apollo.io against a Rails codebase with 20k+ Ruby files.

Use cases

  1. Learn a new codebase or code areas quickly. With your AI client and a running server, you can ask it to research while executing snippets from your actual application code. It effectively acts as an in-loop code-verification block.
  2. Perform quick, preliminary investigations of customer escalations using a read-only copy of the production environment. It can execute your application code, locate models, and run relevant class methods or code paths from the codebase to do preliminary root-cause analysis (RCA). Even better if your application uses an event-sourcing framework (i.e., change logs). The AI client, together with the code-execution capabilities via rails-mcp, can deliver fast preliminary RCAs.
  3. Use it for quick data analytics and export reports as CSV.

Installation

Add this line to your application's Gemfile:

ruby
gem "rails-mcp"

Or install locally for development:

bash
bundle install

Usage

Mounting the MCP Server

Rails (config/routes.rb):

ruby
require "rails_mcp/mcp/server"

Rails.application.routes.draw do
  mount RailsMcp::MCP::Server.new => "/mcp"
end

Rack (config.ru):

ruby
require "rails_mcp"
require "rails_mcp/mcp/server"

map "/mcp" do
  run RailsMcp::MCP::Server.new
end

Sinatra:

ruby
require "rails_mcp/mcp/server"

mount RailsMcp::MCP::Server.new, at: "/mcp"

Starting the Server

bash
# Standalone with Rackup
bundle exec rackup -p 9292

# With Rails
bundle exec rails server

Environment-scoped mounting

This gem ships without authentication — the MCP endpoint will accept any request that reaches it. You are responsible for ensuring it is only mounted where appropriate. A typical Rails setup gates it on environment:

ruby
Rails.application.routes.draw do
  mount RailsMcp::MCP::Server.new => "/mcp" if Rails.env.development?
end

For staging or production access, combine that with network-level restrictions (firewall, VPC, SSH port-forward, VPN) so the endpoint is never reachable from the open internet.

MCP Protocol

Endpoint

The MCP server exposes a single JSON-RPC endpoint:

  • POST /mcp/rpc - JSON-RPC request and response

Available Tools

evaluate_ruby_code

  • Description: Evaluates Ruby code and returns the result with captured stdout/stderr
  • Parameters:
    • code (string, required): Ruby code to execute

Connecting AI Assistants

Cursor/ Claude Desktop

Add to your MCP client configuration (.cursor/mcp.json for Cursor or claude_desktop_config.json for Claude Desktop):

json
{
  "mcpServers": {
    "rails-mcp": {
      "url": "http://localhost:3001/mcp/rpc"
    }
  }
}

For Claude Code, add it from the command line:

bash
claude mcp add rails-mcp --transport http http://localhost:3001/mcp/rpc

MCP integration in Cursor

Other MCP Clients

Any MCP-compatible client can connect to the server by making JSON-RPC requests to the /mcp/rpc endpoint.

Example with curl:

bash
curl -X POST "http://localhost:3001/mcp/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list"
  }'

Optional: Client Verification

If you want a second layer of defense beyond environment-scoped mounting and network gating, enable client verification when constructing the server. When enabled, every request must carry an X-Rails-Mcp-Token header whose value matches ENV["RAILS_MCP_TOKEN"] (minimum 8 characters); otherwise the server responds 401 Unauthorized.

This deliberately uses a custom header (not Authorization: Bearer) and returns no WWW-Authenticate so it stays off the standard MCP/OAuth code path — important when the host Rails app already exposes a separate, product-facing MCP server with DCR / well-known discovery.

ruby
mount RailsMcp::MCP::Server.new(use_client_verification: true) => "/mcp"

Set the token in the host environment:

bash
export RAILS_MCP_TOKEN="<at-least-8-char-secret>"

Claude Code:

bash
claude mcp add rails-mcp --transport http \
  --header "X-Rails-Mcp-Token: $RAILS_MCP_TOKEN" \
  http://localhost:3001/mcp/rpc

Cursor (.cursor/mcp.json):

json
{
  "mcpServers": {
    "rails-mcp": {
      "url": "http://localhost:3001/mcp/rpc",
      "headers": {
        "X-Rails-Mcp-Token": "<at-least-8-char-secret>"
      }
    }
  }
}

Testing

Run the test suite:

bash
bundle exec rspec

Security Warning

⚠️ This gem executes arbitrary Ruby code.

Important security considerations:

  • No built-in authentication. Gate the mount on environment (e.g., if Rails.env.development?) so the endpoint isn't exposed in production by accident
  • Only use in development environments or secure, isolated production environments
  • Rely on network-level restrictions (firewall, VPC, SSH port-forward, VPN) to limit access
  • Consider running in a sandboxed or containerized environment
  • Monitor and log all code execution requests

Concurrency Note

This gem uses global $stdout/$stderr redirection during evaluation, which can clash in multi-threaded servers. For production use with concurrency, consider:

  • Running in a single worker/thread mode
  • Isolating evaluation per request (e.g., via fork)
  • Using a dedicated job worker for code execution

License

MIT License - see LICENSE file for details.

MCP Server Plugin MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal MCP Server Plugin verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun verbënnt sech an TypingMind iwwer d'URL vun engem gehoste MCP-Server.

Eng MCP-Server-URL derbäisetzen

Benotzt dës Optioun, wann MCP Server Plugin scho remote gehost gëtt oder Är Ekipp ee gemeinsame Connector wëllt, op dee méi Benotzer kënnen zougräifen.

1

MCP-Connectoren opmaachen

Gitt an TypingMind op „Plugins“, maacht „MCP-Connectoren“ op a wielt dann „URL derbäisetzen“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Gitt op „Plugins“.
  3. Maacht „MCP-Connectoren“ op.
  4. Klickt op „URL derbäisetzen“.
TypingMind-Formulaire fir eng benotzerdefinéiert MCP-Server-URL derbäizesetzen
2

D'Server-URL apeschen

Gitt d'MCP-Server-URL vum Ubidder am Feld „Server-URL“ an. Setzt e Verbindungsnumm, eng Beschreiwung, e Symbol, benotzerdefinéiert HTTP-Headeren oder OAuth-Clientastellungen derbäi, wann de Server se erfuerdert.

  1. Pescht d'MCP-Server-URL vum Ubidder an d'Feld „Server-URL“.
  2. Gitt en Numm fir d'Verbindung mat MCP Server Plugin an.
  3. Setzt eng Beschreiwung an e Symbol derbäi, fir d'Verbindung méi einfach erëmzeerkennen.
  4. Setzt benotzerdefinéiert HTTP-Headeren oder OAuth-Clientdetailer derbäi, wann de Server eng Authentifizéierung erfuerdert.
3

D'Verbindung erstellen

Klickt op „Verbindung erstellen“, gitt dann zeréck op d'Plugin-Lëscht a kontrolléiert, ob déi nei MCP-Verbindung aktiv ass.

  1. Klickt op „Verbindung erstellen“.
  2. Gitt zeréck op d'Lëscht vun de MCP-Connectoren.
  3. Kontrolléiert, ob d'Verbindung mat MCP Server Plugin als aktiv ugewise gëtt.
  4. Aktualiséiert d'Plugin-Lëscht, wann d'Verbindung net direkt ugewise gëtt.
4

Modeller wiesselen ouni nei ze verbannen

Start e Chat mat Ärem bevorzugte Modell, aktivéiert d'Tools vu MCP Server Plugin ënner „Plugins“ a wiesselt bei Bedarf op en anere Modell. D'MCP-Verbindung bleift am TypingMind-Aarbechtsberäich disponibel.

  1. Start en neie Chat an TypingMind.
  2. Wielt de KI-Modell, deen Dir benotze wëllt.
  3. Aktivéiert d'Tools vu MCP Server Plugin ënner „Plugins“.
  4. Biet de Modell, den Tool ze benotzen, wann néideg.
  5. Wiesselt op en anere KI-Modell a benotzt déiselwecht MCP-Verbindung weider.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat MCP Server Plugin?
MCP Server Plugin
Jo. Ech hunn et gelies.
Dat hunn ech mat MCP Server Plugin fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server MCP Server Plugin benotzt?

MCP Server Plugin ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech MCP Server Plugin MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir MCP Server Plugin mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat MCP Server Plugin MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann MCP Server Plugin verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech MCP Server Plugin MCP mat TypingMind?

Dir kënnt MCP Server Plugin mat TypingMind verbannen, andeems Dir d'URL vu sengem gehoste MCP-Server derbäisetzt. Dat ass nëtzlech, wann Dir eng Remote-MCP-Verbindung wëllt, déi aus Ärem TypingMind-Aarbechtsberäich disponibel ass.

Wéi eng Tools stellt MCP Server Plugin MCP an TypingMind zur Verfügung?

MCP Server Plugin stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir MCP Server Plugin MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann MCP Server Plugin eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇