Skip to main content
Glama
theashleygross

rails-routes-mcp

README.md
# rails-routes-mcp

Two MCP tools over a Rails route table. Ruby. Stdio.

RubyMine 2025.2+ is already an MCP server. This is the other direction: a small server the IDE’s assistant can attach as a client.

Design rule from [JetBrains, Feb 2026](https://blog.jetbrains.com/ruby/2026/02/rubymine-mcp-and-the-rails-toolset/): paginate, filter, return `file` and `line`. Don’t dump `bin/rails routes`.

Fifteen-route shop catalog so CI doesn’t need a Rails app.

## Tools

| Tool | Returns |
| --- | --- |
| `search_routes` | page of routes (`page_size` ≤ 20), filters for verb / path / controller, each row has `file:line` |
| `show_route` | one route by verb+path, plus `next.file` / `next.line` |

## RubyMine

Settings → Tools → MCP Server → stdio:

```json
{
  "mcpServers": {
    "rails-routes": {
      "command": "ruby",
      "args": ["/absolute/path/to/rails-routes-mcp/bin/rails-routes-mcp"]
    }
  }
}
```

## Eval

```bash
ruby evals/run.rb
```

A full `rails routes` dump is 4.83× a typical shaped page. 8/8 queries can fill `show_route` from `verb` / `path` / `file` / `line`.

```bash
ruby -Itest test/catalog_test.rb test/server_test.rb
```

No Bundler. MRI 3.1. The [official Ruby MCP SDK](https://github.com/modelcontextprotocol/ruby-sdk) is the right move if you want HTTP inside Rails; this slice is stdio on purpose.

## Demo

Live: https://01a05643-d6bf-7a9d-9634-4f367e3a2682.skydive.app/rails_routes_mcp

```bash
pip install -r requirements.txt
streamlit run app.py
```

MIT. Ashley Gross, 2026.