AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

Action Mcp

mcp-seuros-action-mcp · by seuros

Rails Engine with MCP compliant Spec.

No reviews yet
0 installs
6 views
0.0% view→install

Install

$ agentstack add mcp-seuros-action-mcp

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access Used
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-seuros-action-mcp)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Action Mcp? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

ActionMCP

ActionMCP is a Ruby gem focused on providing Model Context Protocol (MCP) capability to Ruby on Rails applications, specifically as a server.

ActionMCP is designed for production Rails environments and does not support STDIO transport. STDIO is not included because it is not production-ready and is only suitable for desktop or script-based use cases. Instead, ActionMCP is built for robust, network-based deployments.

The client functionality in ActionMCP is intended to connect to remote MCP servers, not to local processes via STDIO.

It offers base classes and helpers for creating MCP applications, making it easier to integrate your Ruby/Rails application with the MCP standard.

With ActionMCP, you can focus on your app's logic while it handles the boilerplate for MCP compliance.

Introduction

Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to large language models (LLMs).

Think of it as a universal interface for connecting AI assistants to external data sources and tools.

MCP allows AI systems to plug into various resources in a consistent, secure way, enabling two-way integration between your data and AI-powered applications.

This means an AI (like an LLM) can request information or actions from your application through a well-defined protocol, and your app can provide context or perform tasks for the AI in return.

ActionMCP is targeted at developers building MCP-enabled Rails applications. It simplifies the process of integrating Ruby and Rails apps with the MCP standard by providing a set of base classes and an easy-to-use server interface.

Protocol Support

ActionMCP supports MCP 2025-06-18 (current) with backward compatibility for MCP 2025-03-26. The protocol implementation is fully compliant with the MCP specification, including:

  • JSON-RPC 2.0 transport layer
  • Capability negotiation during initialization
  • Error handling with proper error codes (-32601 for method not found, -32002 for consent required)
  • Session management with resumable sessions
  • Change notifications for dynamic capability updates

For a detailed (and entertaining) breakdown of protocol versions, features, and our design decisions, see [The Hitchhiker's Guide to MCP](TheHitchhikersGuidetoMCP.md).

Don't Panic: The guide contains everything you need to know about surviving MCP protocol versions.

> Note: STDIO transport is not supported in ActionMCP. This gem is focused on production-ready, network-based deployments. STDIO is only suitable for desktop or script-based experimentation and is intentionally excluded.

Instead of implementing MCP support from scratch, you can subclass and configure the provided Prompt, Tool, and ResourceTemplate classes to expose your app's functionality to LLMs.

ActionMCP handles the underlying MCP message format and routing, so you can adhere to the open standard with minimal effort.

In short, ActionMCP helps you build an MCP server (the component that exposes capabilities to AI) more quickly and with fewer mistakes.

> Client connections: The client part of ActionMCP is meant to connect to remote MCP servers only. Connecting to local processes (such as via STDIO) is not supported.

Requirements

  • Ruby: 3.4.8+ or 4.0.0+
  • Rails: 8.1.1+
  • Database: PostgreSQL, MySQL, or SQLite3

ActionMCP is tested against Ruby 3.4.8 and 4.0.0 with Rails 8.1.1+.

Installation

To start using ActionMCP, add it to your project:

# Add gem to your Gemfile
$ bundle add actionmcp

# Install dependencies
bundle install

# Copy migrations from the engine
bin/rails action_mcp:install:migrations

# Generate base classes and configuration
bin/rails generate action_mcp:install

# Create necessary database tables
bin/rails db:migrate

The action_mcp:install generator will:

  • Create base application classes (ApplicationGateway, ApplicationMCPTool, etc.)
  • Generate the MCP configuration file (config/mcp.yml)
  • Set up the basic directory structure for MCP components (app/mcp/)

Database migrations are copied separately using bin/rails action_mcp:install:migrations.

Core Components

ActionMCP provides three core abstractions to streamline MCP server development:

ActionMCP::Prompt

ActionMCP::Prompt enables you to create reusable prompt templates that can be discovered and used by LLMs. Each prompt is defined as a Ruby class that inherits from ApplicationMCPPrompt.

Key features:

  • Define expected arguments with descriptions and validation rules
  • Build multi-step conversations with mixed content types
  • Support for text, images, audio, and resource attachments
  • Add messages with different roles (user/assistant)

Example:

class AnalyzeCodePrompt  1000
      report_error("Warning: Sum exceeds recommended limit")
    end

    # Or even images
    render(image: generate_visualization(a, b), mime_type: "image/png")
  end

  private

  def generate_visualization(a, b)
    # Implementation to create a visualization as base64
  end
end
Consent Management

For tools that perform sensitive operations (file system access, database modifications, external API calls), you can require explicit user consent:

class FileSystemTool  **Note:** Not all MCP clients support both resource endpoints. Claude Code (as of v2.1.50) only calls `resources/list`, and Codex stubs resource methods entirely. Implement `self.list` on your templates to ensure resources are visible to all clients. Crush and VS Code support both endpoints.

**Example:**

```ruby
class ProductResourceTemplate  **💡 Pro Tip**: Start with the component-specific guides (TOOLS.MD, PROMPTS.MD, RESOURCE_TEMPLATES.md) for hands-on development, then reference the Hitchhiker's Guide for protocol details and CLIENTUSAGE.MD for integration patterns.

## Configuration

ActionMCP is configured via `config.action_mcp` in your Rails application.

By default, the name is set to your application's name and the version defaults to "0.0.1" unless your app has a version file.

You can override these settings in your configuration (e.g., in `config/application.rb`):

```ruby
module Tron
  class Application  **WARNING: Do NOT mount ActionMCP::Engine in your `routes.rb`.** ActionMCP is a standalone Rack application that runs on its own port via `mcp/config.ru`. Mounting it as a Rails engine route will not work correctly.

When you use `run ActionMCP.server` in your `mcp/config.ru`, the MCP endpoint is available at the root path (`/`) by default and can be configured via `config.action_mcp.base_path`. Always use `ActionMCP.server` (not `ActionMCP::Engine` directly) — it initializes required subsystems.

### Installing ActionMCP

ActionMCP includes generators to help you set up your project quickly. The install generator creates all necessary base classes and configuration files:

```bash
# Install ActionMCP with base classes and configuration
bin/rails generate action_mcp:install

This will create:

  • app/mcp/prompts/application_mcp_prompt.rb - Base prompt class
  • app/mcp/tools/application_mcp_tool.rb - Base tool class
  • app/mcp/resource_templates/application_mcp_res_template.rb - Base resource template class
  • app/mcp/application_gateway.rb - Gateway for authentication
  • config/mcp.yml - Configuration file with example settings for all environments
  • mcp/config.ru - Standalone Rack server configuration
  • bin/mcp - Server binstub (prefers Falcon, falls back to Puma)

> Note: Authentication and authorization are not included. You are responsible for securing the endpoint.

Authentication with Gateway

ActionMCP provides a Gateway system for handling authentication. The Gateway allows you to authenticate users and make them available throughout your MCP components. For the full gateway reference including identifier classes, session persistence, profile switching, and production hardening tips, see [GATEWAY.md](GATEWAY.md).

ActionMCP uses a Gateway pattern with pluggable identifiers for authentication. You can implement custom authentication strategies using session-based auth, API keys, bearer tokens, or integrate with existing authentication systems like Warden, Devise, or external OAuth providers.

> Note: Auth errors return HTTP 200 with a JSON-RPC error payload (not HTTP 401). This is correct per the MCP specification — all MCP communication uses JSON-RPC over HTTP, and protocol-level errors are expressed within the JSON-RPC envelope. The initialize request bypasses authentication per MCP spec.

Creating an ApplicationGateway

When you run the install generator, it creates an ApplicationGateway class:

# app/mcp/application_gateway.rb
class ApplicationGateway  user.id, "tenant_id" => user.tenant_id }
  end
end

Tools access it via session_data["user_id"]. See [GATEWAY.md](GATEWAY.md) for details.

1. Create mcp/config.ru

The install generator (rails generate action_mcp:install) creates this automatically. If you need to create it manually:

# Load the full Rails environment to access models, DB, Redis, etc.
require_relative "../config/environment"

$stdout.sync = true

# Eager load so all tools, prompts, and resources are registered.
Rails.application.eager_load!

# IMPORTANT: Use ActionMCP.server — it initializes required subsystems.
# Do NOT use ActionMCP::Engine directly.
run ActionMCP.server

2. Start the server

bin/mcp                                          # Uses Falcon (recommended)
bundle exec rails s -c mcp/config.ru -p 62770   # Uses Puma (fallback)

Dealing with Middleware Conflicts

If your Rails application uses middleware that interferes with MCP server operation (like Devise, Warden, Ahoy, Rack::Cors, etc.), use mcp_vanilla.ru instead:

# mcp_vanilla.ru - A minimal Rack app with only essential middleware
# This avoids conflicts with authentication, tracking, and other web-specific middleware
# See the file for detailed documentation on when and why to use it

bundle exec rails s -c mcp_vanilla.ru -p 62770
# Or with Falcon:
bundle exec falcon serve --bind http://0.0.0.0:62770 --config mcp_vanilla.ru

Common middleware that can cause issues:

  • Devise/Warden - Expects cookies and sessions, throws Devise::MissingWarden errors
  • Ahoy - Analytics tracking that intercepts requests
  • Rack::Attack - Rate limiting designed for web traffic
  • Rack::Cors - CORS headers meant for browsers
  • Any middleware assuming HTML responses or cookie-based authentication

An example of a minimal mcp_vanilla.ru file is located in the dummy app : test/dummy/mcp_vanilla.ru. This file is a minimal Rack application that only includes the essential middleware needed for MCP server operation, avoiding conflicts with web-specific middleware. But remember to add any instrumentation or logging middleware you need, as the minimal setup will not include them by default.


## Production Deployment of MCPS0

In production, **MCPS0** (the MCP server) is a standard Rack application. You can run it using any Rack-compatible server (such as Puma, Unicorn, or Passenger).

> **For best performance and concurrency, it is highly recommended to use a modern, synchronous server like [Falcon](https://github.com/socketry/falcon)**. Falcon is optimized for streaming and concurrent workloads, making it ideal for MCP servers. You can still use Puma, Unicorn, or Passenger, but Falcon will generally provide superior throughput and responsiveness for real-time and streaming use cases.

You have several main options for exposing the server:

### 1. Dedicated Port

Run MCPS0 on its own TCP port (commonly `62770`):

**With Falcon:**
```bash
bundle exec falcon serve --bind http://0.0.0.0:62770 --config mcp/config.ru

With Puma:

bundle exec rails s -c mcp/config.ru -p 62770

With Passenger:

passenger start --rackup mcp/config.ru --port 62770

Then, use your web server (Nginx, Apache, etc.) to reverse proxy requests to this port.

2. Unix Socket

Alternatively, you can run MCPS0 on a Unix socket for improved performance and security (especially when the web server and app server are on the same machine):

With Falcon:

bundle exec falcon serve --bind unix:/tmp/mcps0.sock mcp/config.ru

With Puma:

bundle exec puma -C config/puma.rb -b unix:///tmp/mcps0.sock -c mcp/config.ru

With Passenger:

passenger start --rackup mcp/config.ru --socket /tmp/mcps0.sock

And configure your web server to proxy to the socket:

location /mcp/ {
  proxy_pass http://unix:/tmp/mcps0.sock:;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

3. Nginx With Passenger

You can run both the main app and the MCP app using Passenger processes within Nginx.

location / {
  root /path/to/current/public;
  passenger_app_root /path/to/current;
  passenger_enabled on;

   # ... additional configuration for the main Rails app
}

location ~* ^/mcp {
  root /path/to/current/public;
  passenger_app_root /path/to/current;
  passenger_enabled on;
  passenger_startup_file mcp/config.ru;
  passenger_app_group_name mcp;
}

You must set the config.action_mcp.base_path to match the above Nginx configuration, i.e. config.action_mcp.base_path = '/mcp'.

Key Points:

  • MCPS0 is a standalone Rack app—run it separately from your main Rails server.
  • You can expose it via a TCP port (e.g., 62770) or a Unix socket.
  • Use a reverse proxy (Nginx, Apache, etc.) to route requests to MCPS0 as needed.
  • This separation ensures reliability and scalability for both your main app and MCP services.

Generators

ActionMCP includes Rails generators to help you quickly set up your MCP server components.

First, install ActionMCP to create base classes and configuration:

bin/rails action_mcp:install:migrations  # to copy the migrations
bin/rails generate action_mcp:install

This will create the base application classes, configuration file, authentication gateway, mcp/config.ru rackup file, and bin/mcp binstub in your app directory.

Generate a New Prompt

bin/rails generate action_mcp:prompt AnalyzeCode

Generate a New Tool

bin/rails generate action_mcp:tool CalculateSum

Testing with TestHelper

ActionMCP provides a TestHelper module to simplify testing of tools and prompts:

require "test_helper"
require "action_mcp/test_helper"

class ToolTest < ActiveSupport::TestCase
  include ActionMCP::TestHelper

  test "CalculateSumTool returns the correct sum" do
    assert_mcp_tool_findable("calculate_sum")
    result = execute_mcp_tool("calculate_sum", a: 5, b: 10)
    assert_mcp_tool_output("15.0", result)
  end

  test "AnalyzeCodePrompt returns the correct analysis" do
    assert_mcp_prompt_findable("analyze_code")
    result = execute_mcp_prompt("analyze_code", language: "Ruby", code: "def hello; puts 'Hello, world!'; end")
    assert_mcp_prompt_output("Analyzing Ruby code: def hello; puts 'Hello, world!'; end", result)
  end
end

The TestHelper provides several assertion and execution methods:

Tools:

  • assert_mcp_tool_findable(name) - Verifies a tool exists and is registered
  • execute_mcp_tool(name, **args) - Executes a tool with arguments and asserts success
  • execute_mcp_tool_with_error(name, **args) - Executes a tool without asserting success (for testing error cases)
  • assert_mcp_tool_output(expected, response) - Asserts tool output matches expected content

Prompts:

  • assert_mcp_prompt_findable(name) - Verifies a prompt exists and is registered
  • execute_mcp_prompt(name, **args) - Executes a prompt with arguments
  • assert_mcp_prompt_output(expected, response) - Asserts prompt output matches expected content

Resource Templates:

  • assert_mcp_resource_template_findable(name)

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.