mcp_rails_template
by: seuros
A minimal Rails API template for creating MCP (Model Context Protocol) servers with robust tool execution capabilities and examples.
📌Overview
Purpose: ActionMCP serves as a framework that facilitates the integration and use of model context protocols in Ruby on Rails applications.
Overview: This document provides instructions and examples for setting up a Ruby on Rails application that incorporates the ActionMCP engine, enabling developers to leverage model context protocols effectively.
Key Features:
-
Integration Example: A straightforward demonstration of integrating the ActionMCP engine within a Ruby on Rails application, allowing for practical application of the framework.
-
Interactive Linter Tool: Includes functionality for linting Ruby code using RuboCop through ActionMCP, enhancing code quality and development efficiency.
Action MCP Example 🚀
A simple Ruby on Rails application demonstrating how to integrate and use ActionMCP.
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.
3. Database Setup
You can spin up a temporary PostgreSQL instance using Docker:
make up
This will start PostgreSQL on port 5466
. Alternatively, configure your own PostgreSQL database in config/database.yml
.
4. Run the Application
Launch the Rails server:
bin/rails s
The app will be available at http://localhost:3002.
ActionMCP Engine
The ActionMCP engine is mounted at /action_mcp
. You can change its location by modifying the routes in your application.
Usage
The app includes a tool to lint Ruby code using RuboCop through ActionMCP. To test and inspect MCP functionality interactively, run:
npx @modelcontextprotocol/inspector
Contributing
Feel free to contribute! Open issues or submit pull requests to help improve this example.
Happy Coding! ✨🚀