NM

nagstler/mcp_on_ruby

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

96 stars 9 forks 品質 85 トレンド 14MIT

nagstler/mcp_on_rubyは、https://github.com/nagstler/mcp_on_ruby.からインポートされたMCPサーバー候補です。

概要

nagstler/mcp_on_rubyは、https://github.com/nagstler/mcp_on_ruby.からインポートされたMCPサーバー候補です。

概要(AI 翻訳)

Railsアプリケーション向けのモデルコンテキストプロトコル(MCP)サーバー

RailsアプリをAI対応のインターフェースとして公開し、Rails流のツールやリソースを定義しましょう。


特徴

🚀 本番対応 - 認証、レート制限、エラー処理、セキュリティ 🔧 レールズ統合 - ジェネレーター、自動ローディング、ミドルウェア、レールタイ 🛠️ ツールシステム - JSONスキーマ検証付きの呼び出し可能な関数 📊 リソースシステム - URIテンプレートによるデータ露出 🔒 セキュリティ - DNSリバインド保護、CORS、トークン認証 ⚡ リアルタイム - サーバーイベント(SSE)基盤(完全な実装は近日中に予定) 🎯 開発者に優しい - クリーンなDSL、ジェネレーター、テストサポート

設置

Gemfileに追加:

そして次の通りを走らせます:

クイックスタート

1.インストールと設定

2.MCPサーバーの設定

3.ツール作成

4.リソースを作成

5.サーバーを始めましょう

建築

例

Rails MCPサーバーを異なるAIクライアントと接続する:

👉 Claude Desktop - ブリッジスクリプトを含む完全なセットアップガイド

👉 MCPレジストリおよび制御プレーン - Rails MCPエンドポイントを

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。


class OrdersController < ApplicationController
  before_action :authenticate_user!

  mcp_tool :index, description: "Search the current user's orders",
                   params: { status: { type: :string, enum: %w[pending paid shipped] } }
  mcp_tool :show,  description: "Fetch one order by id"

  def index
    render json: current_user.orders.where(params.permit(:status))
  end

  def show
    render json: current_user.orders.find(params[:id])
  end
end

That’s the whole integration. Claude, Cursor, or any MCP client can now search and read orders as the signed-in user. Your before_action authenticates the agent, your scopes and policies decide what it can see, and your existing JSON comes back to it. You don’t write new tool classes or a second permission system.

Why MCP on Ruby

Most MCP libraries ask you to build a parallel API for agents: new tool classes, new argument parsing, new authorization checks. Over time that second API drifts from the real one, and every rule has to be secured twice.

MCP on Ruby takes the opposite approach. Your app already has an API: your controllers. MCP on Ruby makes it callable by agents.

  • One source of truth. Agents go through the same routes, filters, policies, validations, and serializers as your users.
  • Real identity. Every tool call runs as a real user, using the auth you already have: API tokens, Devise, or Warden.
  • Safe by default. Actions that change data must be marked write: true, and every tool tells the client whether it is read-only or destructive.
  • Local and remote. Serve Streamable HTTP in production, and stdio for Claude Code, Claude Desktop, and Cursor on your machine.
GitHub で README 全文を見る

インストール

npx @modelcontextprotocol/inspector bin/rails mcp:stdio
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "my-app": { "command": "/Users/you/.rbenv/versions/3.4.7/bin/ruby", "args": ["-C", "/path/to/my-app", "bin/rails", "mcp:stdio"], "env": { "MCP_USER": "[email protected]" } } } }