MCP Server Pluginのロゴ

MCP Server Plugin

コミュニティ
raja-jamwal

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

公開者raja-jamwal
リポジトリrails-mcp
言語Ruby
フォーク
6
スター
12
利用可能なツール
0
通信方式streamable-http
カテゴリ
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    MCP Server Pluginは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには12件のスターと6件のフォークがあります。

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を複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度MCP Server Pluginに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、TypingMindでリモートホストされたMCPサーバーのURLを使って接続します。

MCPサーバーのURLを追加

MCP Server Pluginがすでにリモートでホストされている場合や、チームの複数のユーザーで1つのコネクタを共有したい場合は、この方法を使います。

1

MCPコネクタを開く

TypingMindで「プラグイン」に移動し、「MCPコネクタ」を開いて「URLを追加」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 「プラグイン」に移動してください。
  3. 「MCPコネクタ」を開いてください。
  4. 「URLを追加」をクリックします。
TypingMindの「カスタムMCPサーバーURLを追加」フォーム
2

サーバーURLを貼り付け

「サーバーURL」欄にプロバイダーから提供されたMCPサーバーのURLを入力してください。サーバーで必要とされる場合は、接続名、説明、アイコン、カスタムHTTPヘッダー、OAuthクライアント設定を追加してください。

  1. 「サーバーURL」欄にプロバイダーから提供されたMCPサーバーのURLを貼り付けてください。
  2. MCP Server Pluginの接続名を入力してください。
  3. 接続を識別しやすくするには、説明とアイコンを追加してください。
  4. サーバーで認証が必要な場合は、カスタムHTTPヘッダーまたはOAuthクライアントの詳細情報を追加してください。
3

接続を作成

「接続を作成」をクリックし、プラグイン一覧に戻って、新しいMCP接続が有効になっていることを確認してください。

  1. 「接続を作成」をクリックします。
  2. MCPコネクタの一覧に戻ってください。
  3. MCP Server Pluginの接続が「有効」と表示されていることを確認してください。
  4. 接続がすぐに表示されない場合は、プラグイン一覧を更新してください。
4

再接続せずにモデルを切り替え

お好みのモデルでチャットを開始し、「プラグイン」でMCP Server Pluginのツールを有効にしてください。必要に応じて別のモデルに切り替えられます。MCP接続は、TypingMindのワークスペースで引き続き利用できます。

  1. TypingMindで新しいチャットを開始してください。
  2. 使用するAIモデルを選択してください。
  3. 「プラグイン」でMCP Server Pluginのツールを有効にしてください。
  4. 必要に応じて、ツールを使うようモデルに依頼してください。
  5. 別のAIモデルに切り替えて、同じMCP接続を再利用してください。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
MCP Server Pluginを使ってこのタスクを手伝ってもらえますか?
MCP Server Plugin
はい、読みました。
MCP Server Pluginで調べた結果をお伝えします。

よくある質問

MCP Server Plugin MCPサーバーは何に使いますか?

MCP Server Pluginは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでMCP Server Plugin MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでMCP Server Pluginを利用できます。

TypingMindでMCP Server Plugin MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。MCP Server Pluginを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

MCP Server Plugin MCPをTypingMindに接続するにはどうすればよいですか?

ホストされているMCP Server PluginのMCPサーバーURLを追加すると、TypingMindに接続できます。TypingMindのワークスペースから利用できるリモートMCP接続が必要な場合に便利です。

TypingMindでMCP Server Plugin MCPのどのようなツールを利用できますか?

MCP Server PluginはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

MCP Server Plugin MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。MCP Server Pluginで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇