Rails Dev MCP
A Model Context Protocol (MCP) server that allows AI agents to manage Rails development servers. Start, stop, and monitor your Rails app directly from Claude!
Features
- start_dev_server: Start Rails development server on a specified port
- stop_dev_server: Stop the running Rails server
- dev_server_logs: View recent logs and notable events (errors, warnings, requests)
- dev_server_status: Check if the server is running and get connection details
Installation
As a gem
gem install rails-dev-mcp
From source
git clone https://github.com/obie/rails-dev-mcp.git
cd rails-dev-mcp
bundle install
rake install
Usage
With Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"rails-dev": {
"command": "rails-dev-mcp",
"cwd": "/path/to/your/rails/project"
}
}
}
With ClaudeOnRails
The Rails Dev MCP integrates seamlessly with ClaudeOnRails. Add to your claude-swarm.yml
:
mcps:
- name: rails-dev
type: stdio
command: rails-dev-mcp
args: []
Available Tools
start_dev_server
Starts the Rails development server.
Parameters:
-
port
(optional): Port number (default: 3000)
Example:
Start the Rails server on port 3001
stop_dev_server
Stops the running Rails development server.
Example:
Stop the Rails server
dev_server_logs
Retrieves recent logs from the Rails server.
Parameters:
-
lines
(optional): Number of log lines to retrieve (default: 50) -
notable_only
(optional): Show only errors, warnings, and requests
Example:
Show me the last 100 lines from the Rails server logs
Show me only errors from the Rails logs
dev_server_status
Checks the current status of the Rails development server.
Example:
Is the Rails server running?
How It Works
- Process Management: Uses Ruby's Open3 to manage the Rails server process
- Log Capture: Redirects server output to a log file for later retrieval
- PID Tracking: Maintains PID files to track running processes
- Smart Log Filtering: Identifies notable events like errors, warnings, and HTTP requests
Development
# Run tests
bundle exec rspec
# Run linter
bundle exec rubocop
# Build gem
gem build rails-dev-mcp.gemspec
License
MIT License - see LICENSE file for details.