Logo van MCP Server Plugin

MCP Server Plugin

Community
raja-jamwal

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

Uitgeverraja-jamwal
Repositoryrails-mcp
TaalRuby
Forks
6
Sterren
12
Beschikbare tools
0
Transporttypestreamable-http
Categorieën
LicentieMIT
Links
  • Koppel tools aan AI-workflows

    MCP Server Plugin biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • 0 beschikbare tools

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Indicatoren van opensource-interesse

    12 sterren en 6 forks in de gekoppelde 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.

Gebruik MCP Server Plugin MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra MCP Server Plugin is verbonden, kun je deze dus met verschillende AI-modellen in TypingMind gebruiken, zonder de verbinding voor elk model apart in te stellen. Deze MCP-integratie maakt in TypingMind verbinding via de URL van een gehoste MCP-server.

Voeg een MCP-server-URL toe

Gebruik dit als MCP Server Plugin al extern wordt gehost of als je team één gedeelde connector wil die meerdere gebruikers kunnen gebruiken.

1

Open MCP-connectoren

Ga in TypingMind naar Plug-ins, open MCP-connectoren en kies URL toevoegen.

  1. Open TypingMind in je browser.
  2. Ga naar Plug-ins.
  3. Open MCP-connectoren.
  4. Klik op URL toevoegen.
TypingMind-formulier om een eigen MCP-server-URL toe te voegen
2

Plak de server-URL

Voer de MCP-server-URL van de aanbieder in het veld Server-URL in. Voeg een verbindingsnaam, beschrijving, icoon, aangepaste HTTP-headers of OAuth-clientinstellingen toe als de server die vereist.

  1. Plak de MCP-server-URL van de aanbieder in het veld Server-URL.
  2. Voer een verbindingsnaam in voor MCP Server Plugin.
  3. Voeg een beschrijving en een icoon toe om de verbinding makkelijker te herkennen.
  4. Voeg aangepaste HTTP-headers of OAuth-clientgegevens toe als de server authenticatie vereist.
3

Maak de verbinding

Klik op Verbinding maken, ga terug naar de lijst met plug-ins en controleer of de nieuwe MCP-verbinding actief is.

  1. Klik op Verbinding maken.
  2. Ga terug naar de lijst met MCP-connectoren.
  3. Controleer of de verbinding met MCP Server Plugin als actief wordt weergegeven.
  4. Vernieuw de lijst met plug-ins als de verbinding niet meteen verschijnt.
4

Wissel van model zonder opnieuw verbinding te maken

Start een chat met je favoriete model, schakel de tools van MCP Server Plugin in via Plug-ins en wissel van model wanneer dat nodig is. De MCP-verbinding blijft beschikbaar in de TypingMind-werkruimte.

  1. Start een nieuwe chat in TypingMind.
  2. Selecteer het AI-model dat je wilt gebruiken.
  3. Schakel de tools van MCP Server Plugin in via Plug-ins.
  4. Vraag het model om de tool te gebruiken wanneer dat nodig is.
  5. Schakel over naar een ander AI-model en gebruik dezelfde MCP-verbinding opnieuw.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je MCP Server Plugin gebruiken om me hiermee te helpen?
MCP Server Plugin
Zeker. Ik heb het gelezen.
Dit vond ik met MCP Server Plugin.

Veelgestelde vragen

Waarvoor wordt de MCP-server MCP Server Plugin gebruikt?

MCP Server Plugin is een MCP-server waarmee compatibele AI-clients verbinding kunnen maken met externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik MCP Server Plugin MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je MCP Server Plugin gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom MCP Server Plugin MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als MCP Server Plugin verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik MCP Server Plugin MCP met TypingMind?

Je kunt MCP Server Plugin met TypingMind verbinden door de URL van de gehoste MCP-server toe te voegen. Dit is handig als je een externe MCP-verbinding wilt die beschikbaar is vanuit je TypingMind-werkruimte.

Welke tools biedt MCP Server Plugin MCP in TypingMind?

MCP Server Plugin biedt MCP-functies die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om MCP Server Plugin MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als MCP Server Plugin authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇