Action MCP Example 🚀
About
A minimal Rails API template for creating MCP (Model Context Protocol) servers with robust tool execution capabilities and examples.
Explore
- JWT‑based authentication with predefined test users
- Adventure story prompt generator
- Gemfile dependency resource template (JSON over gemfile://{environment})
- Weather forecast tool via Open‑Meteo API
- RuboCop style analysis tool for Ruby snippets
- Dependency info tool (production, test, runtime)
- Ruby code static analysis tool (classes, modules, methods)
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Action MCP Example 🚀Command (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
- Ruby (see .ruby-version for recommended version)
- PostgreSQL (or Docker)
---
git clone https://github.com/seuros/mcp_rails_template.git
cd mcp_rails_template
bin/setup
Copy the provided .env.example file:
cp .env.example .env
Edit .env and fill in necessary values according to your setup (especially any required API keys for tools like fetch_weather_by_location_tool).
You can quickly spin up a temporary PostgreSQL instance using Docker:
make up
This will start PostgreSQL on port 5466.
Alternatively, configure your own PostgreSQL database by editing config/database.yml.
This application uses JWT-based authentication via the ApplicationGateway class.
A .mcp.json file is provided with a pre-configured long-lived token:
{
"mcpServers": {
"mcp_rails_template": {
"url": "http://localhost:8080/mcp",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}
Or test manually with curl:
curl -H "Authorization: Bearer <token>" http://localhost:8080/mcp
The gateway is configured in config/mcp.yml:
development:
authentication: ["jwt"]
gateway_class: "ApplicationGateway"
class MyTool < ApplicationMCPTool
def perform
render text: "Hello #{current_user.name}!"
end
end
---
Tools define specific actions that a language model can request to be executed.
- dependency_info_tool.rb: Retrieves dependency information using Bundler from the Gemfile and Gemfile.lock. It also checks for a .gemspec file for runtime dependencies. It outputs separate JSON resources for production, test, and runtime dependencies.
- fetch_weather_by_location_tool.rb: Fetches weather forecast data from the Open-Meteo API (https://api.open-meteo.com) based on provided latitude and longitude coordinates. It returns the raw JSON response from the API.
- rubocop_tool.rb: Analyzes a provided Ruby code snippet using the RuboCop gem's API. It reports any detected style or code quality offenses, including the rule name, message, line, and column number.
- ruby_code_analyzer_tool.rb: Performs basic static analysis of Ruby code within the project directory. It indexes classes, modules, and methods by parsing .rb files. It can be queried to list all found classes, modules, or methods, or to get details (including source snippets) for a specific class/module (constant) or method (method_details).
---
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"action mcp example \ud83d\ude80": {
"mcp_rails_template": {
"command": "npx",
"args": [
"@modelcontextprotocol/inspector",
"--url",
"http://localhost:8080/mcp"
]
}
}
}
}
McpServers
{
"mcp_rails_template": {
"command": "npx",
"args": [
"@modelcontextprotocol/inspector",
"--url",
"http://localhost:8080/mcp"
]
}
}
A simple Ruby on Rails application demonstrating how to integrate and use the ActionMCP gem. The gem source code can be found on GitHub at https://github.com/seuros/mcp.
This application showcases how to define and use MCP components within a Rails project.
---
Requirements
- Ruby (see .ruby-version for recommended version)
- PostgreSQL (or Docker)
---
Getting Started
1. Clone and Setup
git clone https://github.com/seuros/mcp_rails_template.git
cd mcp_rails_template
bin/setup
2. Environment Configuration
Copy the provided .env.example file:
cp .env.example .env
Edit .env and fill in necessary values according to your setup (especially any required API keys for tools like fetch_weather_by_location_tool).
3. Database Setup
You can quickly spin up a temporary PostgreSQL instance using Docker:
make up
This will start PostgreSQL on port 5466.
Alternatively, configure your own PostgreSQL database by editing config/database.yml.
4. Run the Application
Launch the Rails server:
bin/rails s
The app will be available at http://localhost:3002.
---
ActionMCP Server
ActionMCP runs as a standalone server on port 62770 (via mcp.ru). Nginx proxies /mcp requests to this server.
Client → nginx:8080/mcp → ActionMCP:62770
---
Authentication
This application uses JWT-based authentication via the ApplicationGateway class.
Test Users (from fixtures)
| Email | Password | Role |
|-------|----------|------|
| [email protected] | password123 | Test User |
| [email protected] | password123 | Admin User |
Loading Fixtures
bin/rails db:fixtures:load FIXTURES=users
Generating a JWT Token
```ruby
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



