Action MCP Example ๐Ÿš€

by seuros

42 stars
415 downloads
Not rated
GitHub

About

A minimal Rails API template for creating MCP (Model Context Protocol) servers with robust tool execution capabilities and examples.

Details

Author
seuros
GitHub stars
42
Downloads
415
Categories
Developer Tools

- 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:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. 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.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, run bin/setup, copy .env.example to .env and fill in required values (e.g., API keys). Set up PostgreSQL (e.g., via make up for Docker on port 5466), then start the Rails server with bin/rails s. The ActionMCP server runs on port 62770, proxied by Nginx at /mcp. You can test interactively using the MCP Inspector: npx @modelcontextprotocol/inspector --url http://localhost:8080/mcp.

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"
        ]
    }
}

Action MCP Example ๐Ÿš€

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 |
|-------|----------|------|
| test@example.com | password123 | Test User |
| admin@example.com | password123 | Admin User |

Loading Fixtures

bin/rails db:fixtures:load FIXTURES=users

Generating a JWT Token

```ruby

No reviews yet โ€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.