Get the FREE Ultimate OpenClaw Setup Guide →

action_mcp

Rails Engine with MCP compliant Spec.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio seuros-action_mcp docker run -i seuros/action_mcp:latest \
  --env RAILS_ENV="production" \
  --env REDIS_URL="your-redis-url" \
  --env DATABASE_URL="your-database-url"

How to use

ActionMCP is a Ruby gem that provides a production-ready MCP (Model Context Protocol) server for Ruby on Rails applications. It exposes your Rails app's context and capabilities to LLMs via a network-based JSON-RPC transport, including support for protocol version MCP 2025-06-18 with backward compatibility. The server is designed for robust deployments and does not rely on STDIO transport, making it suitable for multi-process, scalable environments. You can customize what you expose by subclassing and configuring the provided base classes (Prompt, Tool, and ResourceTemplate) to implement your app’s specific MCP capabilities.

To use ActionMCP, run the server in your deployment environment (for example, via Docker as described in the installation guide). The server will handle MCP message formatting, routing, and session management, while you focus on implementing application logic and data access within your Rails app. Client components can connect remotely to this server to request context, execute tools, or retrieve resources, enabling two-way interactions between your AI models and your data sources.

How to install

Prerequisites:

  • Ruby 3.4.8+ (or 4.0.0+)
  • Rails 8.1.1+
  • A supported database (PostgreSQL, MySQL, or SQLite3)
  • Docker (for containerized deployment) or a production-ready Ruby environment

Installation steps (gem-based Rails integration):

  1. Add the gem to your Gemfile:
bundle add actionmcp
  1. Install dependencies:
bundle install
  1. Copy migrations and install generator assets:
bin/rails action_mcp:install:migrations
bin/rails generate action_mcp:install
  1. Run migrations to create necessary tables:
bin/rails db:migrate
  1. Run the Rails server in a production-ready setup (e.g., via Docker or a hosting service). If using Docker, see the mcp_config example for a containerized run. If you’re running locally, start your Rails server as usual and ensure the MCP server components initialize correctly on boot.

Notes:

  • The action_mcp:install generator creates base classes (ApplicationGateway, ApplicationMCPTool, etc.), config/mcp.yml, and the app/mcp/ directory structure for MCP components.
  • Database migrations are copied with the separate bin/rails action_mcp:install:migrations command as shown above.

Additional notes

Tips and common considerations:

  • STDIO transport is not supported by ActionMCP; ensure your deployment uses a network-based transport (e.g., JSON-RPC over HTTP/WebSocket).
  • Configure MCP environment variables (DATABASE_URL, REDIS_URL, RAILS_ENV) according to your stack before starting the server.
  • The server exposes prompts (Prompt), tools (Tool), and resources through subclassed Rails classes. Customize and register your own actions by extending ActionMCP::Prompt, ActionMCP::Tool, and related classes.
  • If deploying via Docker, ensure the container has access to the database and any external services you rely on. Use standard Rails secrets and credentials handling for sensitive data.
  • For sensitive operations within Tools, you can require explicit user consent. If a consent is not granted, the client will receive a -32002 error code as part of the MCP error flow.
  • Review MCP protocol notes in The Hitchhiker's Guide to MCP to understand version negotiation, session management, and change notifications.

Related MCP Servers

Sponsor this space

Reach thousands of developers