mcp_rails_template
A minimal Rails API template for creating MCP (Model Context Protocol) servers with robust tool execution capabilities and examples.
claude mcp add --transport stdio seuros-mcp_rails_template docker run -i seuros/mcp_rails_template:latest
How to use
This MCP setup demonstrates integrating the ActionMCP gem into a Ruby on Rails project. The Rails app serves as a host for various MCP components (prompts, resource templates, and tools) that can be invoked by a language model through the MCP gateway. The ActionMCP server itself runs as a standalone MCP server on port 62770 and is typically proxied by Nginx at /mcp, allowing client requests to be forwarded to ActionMCP. To use it, first ensure the Rails application is configured and the MCP dependencies are installed, then run the embedded MCP server (as described in the README) or connect via the provided mcp.json configuration to an external MCP gateway. Tools available include dependency_info_tool (Bundler-based dependency extraction), fetch_weather_by_location_tool (Open-Meteo API access by coordinates), rubocop_tool (Ruby code quality analysis via RuboCop), and ruby_code_analyzer_tool (static analysis of Ruby code within the project). You can also fetch Gemfile dependencies through the Gemfile_template resource and render current_user-specific data via custom MCP tools when authenticated through JWT tokens.
How to install
Prerequisites:
- Ruby (check .ruby-version in the project for the recommended version)
- PostgreSQL (or use Docker to spin up a DB instance as shown in the README)
- Bundler
- Git
Installation steps:
-
Clone the repository: git clone https://github.com/seuros/mcp_rails_template.git cd mcp_rails_template
-
Install Ruby dependencies: bundle install
-
Setup environment:
- Copy the example env file and edit it with your credentials and API keys: cp .env.example .env
- Ensure necessary environment variables are defined (e.g., database config, API keys for tools like fetch_weather_by_location_tool)
-
Prepare the database:
- If using Docker for PostgreSQL (as suggested in the README): make up This starts PostgreSQL on port 5466
- Otherwise configure your own PostgreSQL instance by editing config/database.yml
-
Set up the Rails app and load fixtures if needed: bin/setup bin/rails db:fixtures:load FIXTURES=users
-
Run the Rails server: bin/rails s
-
Ensure the MCP server is running or accessible through your gateway (as described in the MCP section of the README). By default, the standalone MCP server listens on port 62770, and your gateway (like Nginx) should proxy /mcp to that port.
Additional notes
Notes and tips:
- The MCP gateway configuration is managed in config/mcp.yml and uses JWT-based authentication for the API calls in this Rails example.
- Ensure Docker is running if you follow the Docker-based PostgreSQL option.
- The .env file should contain keys for any external services used by tools (e.g., weather API keys for fetch_weather_by_location_tool).
- The MCP client can be configured via a provided .mcp.json file or manually with curl commands to test tokens and endpoints.
- If you run into port conflicts, verify that port 62770 (MCP server) and 3002 (Rails app) are not in use by other processes.
- The npm-based MCP Inspector can be used to inspect the MCP endpoint once the server is up (npx @modelcontextprotocol/inspector --url http://localhost:8080/mcp).
- Since this template focuses on demonstrating ActionMCP components, you can extend app/mcp/ to add more prompts, tools, or resources as needed.
Related MCP Servers
vibetest-use
Vibetest MCP - automated QA testing using Browser-Use agents
claude-talk-to-figma
A Model Context Protocol (MCP) that allows Claude Desktop and other AI tools (Claude Code, Cursor, Antigravity, etc.) to read, analyze, and modify Figma designs
time
⏰ Time MCP Server: Giving LLMs Time Awareness Capabilities
agentic-commerce-protocol-demo
Reference implementation of OpenAI's Agentic Commerce Protocol (ACP)
pfsense
pfSense MCP Server enables security administrators to manage their pfSense firewalls using natural language through AI assistants like Claude Desktop. Simply ask "Show me blocked IPs" or "Run a PCI compliance check" instead of navigating complex interfaces. Supports REST/XML-RPC/SSH connections, and includes built-in complian
titanmind-whatsapp
A WhatsApp marketing and messaging tool MCP (Model Control Protocol) service using Titanmind. Handles free-form messages (24hr window) and template workflows automatically