TM

tonksthebear/mcp-rails

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

31 stars 6 forks 품질 55 트렌드 11MIT

mcp-rails는 mcp-rb 라이브러리의 상단에 구축하는 Rails gem에 Ruby입니다. MCP (Model Context Protocol) 서버를 철도 애플리케이션에 완벽하게 통합합니다.

개요

mcp-rails는 mcp-rb 라이브러리의 상단에 구축하는 Rails gem에 Ruby입니다. MCP (Model Context Protocol) 서버를 철도 애플리케이션에 완벽하게 통합합니다. MCP-specific metadata로 태그할 수 있게 해주는 Rails 노선을 강화하고 Goose와 같은 LLM 에이전트인 Ruby MCP 서버(tmp/mcp/server.rb)에서 유효한 Ruby MCP 서버를 생성합니다. 또한, MCP 서버 구성과 Rails 강력한 매개 변수 강제로 두 배의 컨트롤러에서 강력한 매개 변수를 정의하고 관리하는 강력한 방법을 제공합니다. 이것은 Gaggle의 창조 중 영감을 받았습니다. - : 태그 레일 경로 mcp: true 또는 특정 작업 (예: mcp: [:index, :create]) MCP 서버에 노출. - : Tmp/mcp/server.rb에서 Ruby MCP 서버를 생성하여 애플리케이션과 상호 작용합니다. - : MCP 서버 생성 및 철도 강력한 매개 변수 모두에 사용되는 풍부한 메타 데이터 (예, 유형, 예, 필수 플래그)와 컨트롤러에서 허용 된 매개 변수 정의.

개요(AI 번역)

Enhance Rails routing 및 MCP (모델 Context Protocol) 통합 LLM 에이전트에 대한 매개 변수 처리.

mcp-rails 은 Ruby on Rails gem 으로 mcp-rb library의 상단에 구축하여 MCP(모델 Context Protocol) 서버를 철도 애플리케이션에 완벽하게 통합합니다. MCP-specific metadata로 태그할 수 있게 해주는 Rails 노선을 강화하고 Goose와 같은 LLM 에이전트가 연결될 수 있도록 유효한 Ruby MCP 서버를 생성합니다. 또한, MCP 서버 구성과 Rails 강력한 매개 변수 강제로 두 배의 컨트롤러에서 강력한 매개 변수를 정의하고 관리하는 강력한 방법을 제공합니다.

이것은 Gaggle의 창조 중 영감을 받았습니다.


특징

  • Tagged Routes: 태그 레일 경로는 mcp: true 또는 특정 작업 (예를 들어, mcp: [:index, :create])을 MCP 서버에 노출시킵니다. -Automatic MCP Server Generation: LLM Agent의 Ruby MCP 서버 생성 -Parameter 정의: 풍부한 메타데이터(e.g.)와 컨트롤러에서 허용된 매개 변수 정의.

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

MCP-Rails

Enhance Rails routing and parameter handling for LLM agents with MCP (Model Context Protocol) integration.

mcp-rails is a Ruby on Rails gem that builds on top of the mcp-rb library to seamlessly integrate MCP (Model Context Protocol) servers into your Rails application. It enhances Rails routes by allowing you to tag them with MCP-specific metadata and generates a valid Ruby MCP server (in tmp/mcp/server.rb) that LLM agents, such as Goose, can connect to. Additionally, it provides a powerful way to define and manage strong parameters in your controllers, which doubles as both MCP server configuration and Rails strong parameter enforcement.

This was inspired during the creation of Gaggle.


Features

  • Tagged Routes: Tag Rails routes with mcp: true or specific actions (e.g., mcp: [:index, :create]) to expose them to an MCP server.
  • Automatic MCP Server Generation: Generates a Ruby MCP server in tmp/mcp/server.rb for LLM agents to interact with your application.
  • Parameter Definition: Define permitted parameters in controllers with rich metadata (e.g., types, examples, required flags) that are used for both MCP server generation and Rails strong parameters.
  • HTTP Bridge for LLM Agents: Generates a ruby based MCP server to interact with your application through HTTP requests, ensuring LLM agents follow the same paths as human users.
  • Environment Variable Integration: Automatically includes specified environment variables in MCP tool calls.

Installation

Add this line to your application’s Gemfile:

gem 'mcp-rails'

Then run:

bundle install

Ensure you also have the mcp-rb gem installed, as mcp-rails depends on it:

gem 'mcp-rb'

Configuration

MCP-Rails can be configured in an initializer file. Create config/initializers/mcp_rails.rb:

MCP::Rails.configure do |config|
  # Server Configuration
  config.server_name = "my-app-server"      # Default: 'mcp-server'
  config.server_version = "2.0.0"           # Default: '1.0.0'
  
  # Output Configuration
  config.output_directory = Rails.root.join("tmp/mcp")  # Default: Rails.root.join('tmp', 'mcp')
  config.bypass_key_path = Rails.root.join("tmp/mcp/bypass_key.txt")  # Default: Rails.root.join('tmp', 'mcp', 'bypass_key.txt')
  
  # Environment Variables
  config.env_vars = ["API_KEY", "ORGANIZATION_ID"]  # Default: ['API_KEY', 'ORGANIZATION_ID']
  
  # Base URL Configuration
  config.base_url = "http://localhost:3000"  # Default: Uses action_mailer.default_url_options
end

If you are an engine developer, you can register your engine’s configuration with MCP-Rails:

MCP::Rails.configure do |config|
  config.register_engine(YourEngine, env_vars: ["YOUR_ENGINE_KEY"])
end

Environment Variables

GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →