rails-mcp-server

by @maquina-app

Rails MCP Server

Give AI coding assistants structured Rails route, schema, Active Record model, controller-view, and guide introspection across multiple Ruby apps via `gem install rails-mcp-server`. It uses progressive tool discovery over `stdio` or HTTP/SSE and detects each project's Ruby version manager automatically.

Developer Tools574rubyMIT

Server facts

rails-mcp-server

GitHub stars

574

Last commit

Nov 2, 2026

Runtime

ruby

License

MIT

Tech

Runtime
ruby
Transports
stdiosse
Remote access
No
Authentication
None locally (HTTP mode validates origin/local IP ranges)

Activity

GitHub stars
574
Last commit
Data as of

Overview

Ruby on Rails developers searching for a dedicated `rails mcp` gem can equip AI clients with codebase-aware introspection using `maquina-app/rails-mcp-server` (MIT license). Installed globally with `gem install rails-mcp-server`, the package ships an interactive `rails-mcp-config` TUI (enhanced when `gum` is installed) to register multiple applications in XDG-compliant `projects.yml`, download official Rails 8.0.2, Turbo, Stimulus, and Kamal guides, import custom markdown docs, and configure Claude Desktop automatically. The server communicates over `stdio` by default or runs in HTTP/SSE mode (`--mode http`, port 6029, `/mcp/messages` and `/mcp/sse`, optional `--bind-all` on trusted local networks) with `mcp-remote` proxy instructions and native GitHub Copilot coding agent setup (`.github/copilot/mcp.json`, `--single-project`, or `RAILS_MCP_PROJECT_PATH`).

To keep prompt context compact, the server registers only 3 top-level bootstrap tools—`switch_project`, `search_tools`, and `execute_tool`—through which agents discover and call internal analyzers on demand: `project_info`, `list_files`, `get_file`, `get_routes`, `analyze_models` (combining runtime introspection with Prism static AST analysis), `get_schema`, `analyze_controller_views`, `analyze_environment_config`, and `load_guide`. Critically for multi-app Ruby shops, subprocess commands that boot `bin/rails` automatically detect each target project's Ruby from `.ruby-version`, `.tool-versions`, or `.mise.toml` across `rbenv`, `mise`, `asdf`, and `rvm` without manual `PATH` hacks.

Install & configure

Requirements

  • Ruby runtime with RubyGems (`gem install rails-mcp-server`)
  • At least 1 local Ruby on Rails project registered in `projects.yml` (or pointed to via `RAILS_MCP_PROJECT_PATH` / `--single-project`)
  • Optional `gum` CLI (`brew install gum`, `apt`, or `yay`) for the enhanced `rails-mcp-config` TUI
Documented launch / install command
gem install rails-mcp-server

Install with `gem install rails-mcp-server`, then run `rails-mcp-config` to add projects, download Rails/Turbo/Stimulus/Kamal guides, and configure Claude Desktop with the exact Ruby shim path. Start in default `stdio` mode or HTTP/SSE mode via `rails-mcp-server --mode http` (port 6029).

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Desktop configuration
{
  "mcpServers": {
    "railsMcpServer": {
      "command": "ruby",
      "args": [
        "/full/path/to/rails-mcp-server/exe/rails-mcp-server"
      ]
    }
  }
}

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

Cursor configuration
{
  "mcpServers": {
    "railsMcpServer": {
      "command": "ruby",
      "args": [
        "/full/path/to/rails-mcp-server/exe/rails-mcp-server"
      ]
    }
  }
}

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "railsMcpServer": {
      "type": "stdio",
      "command": "ruby",
      "args": [
        "/full/path/to/rails-mcp-server/exe/rails-mcp-server"
      ]
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

Windsurf configuration
{
  "mcpServers": {
    "railsMcpServer": {
      "command": "ruby",
      "args": [
        "/full/path/to/rails-mcp-server/exe/rails-mcp-server"
      ]
    }
  }
}

Read the Windsurf setup guide

Config file · Project scope: .mcp.json at the repository root

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Code configuration
{
  "mcpServers": {
    "railsMcpServer": {
      "type": "stdio",
      "command": "ruby",
      "args": [
        "/full/path/to/rails-mcp-server/exe/rails-mcp-server"
      ]
    }
  }
}

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Tools

Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.

ToolWhat it does
switch_projectSelect the active Rails application configured in `projects.yml` before invoking analyzers.
search_toolsDiscover internal Rails analyzers by keyword or category (`models`, `database`, `routing`, `controllers`, `files`, `project`, `guides`).
execute_toolInvoke an internal Rails analyzer by name with optional parameters.
project_infoInternal analyzer (via `execute_tool`) returning Rails version, directory layout, and project organization.
list_filesInternal analyzer (via `execute_tool`) listing files matching a directory and pattern.
get_fileInternal analyzer (via `execute_tool`) reading the contents of a specified project file.
get_routesInternal analyzer (via `execute_tool`) inspecting Rails routes filtered by controller, HTTP verb, or path substring.
analyze_modelsInternal analyzer (via `execute_tool`) examining Active Record models, associations, validations, and optional Prism static AST analysis.
get_schemaInternal analyzer (via `execute_tool`) retrieving database schema and table details.
analyze_controller_viewsInternal analyzer (via `execute_tool`) mapping controller-to-view relationships with optional Prism analysis.
analyze_environment_configInternal analyzer (via `execute_tool`) auditing Rails environment configurations for inconsistencies and security issues.
load_guideInternal analyzer (via `execute_tool`) loading downloaded Rails, Turbo, Stimulus, Kamal, or custom markdown documentation.

Use cases

  • Inspect filtered Rails routes, Active Record associations, and database schemas in Claude Desktop without manually pasting `schema.rb` or route output.
  • Switch seamlessly across multiple Rails repositories running different Ruby versions managed by `mise`, `asdf`, `rbenv`, or `rvm`.
  • Equip GitHub Copilot coding agents with `--single-project` Rails route, schema, and model introspection inside CI workflows.
  • Query official Rails 8.0.2, Turbo, Stimulus, Kamal, and team-specific custom guides directly via `load_guide` or `rails://guides/` resources.

Strengths

  • Progressive 3-tool bootstrap (`switch_project`, `search_tools`, `execute_tool`) dramatically trims initial tool-schema tokens in client sessions.
  • Automatic per-project Ruby version manager resolution (`mise`, `asdf`, `rbenv`, `rvm`) avoids Bundler boot failures across multi-app setups.
  • Interactive `rails-mcp-config` TUI backs up and patches Claude Desktop config with the exact Ruby interpreter path automatically.
  • Combines live `bin/rails` introspection with Prism static analysis and local Rails/Hotwire/Kamal documentation guides.

Limitations

  • Requires pointing your MCP client `command` to the absolute Ruby binary/shim where the gem is installed when using Ruby version managers.
  • GitHub Copilot coding agent supports only MCP tools (not MCP resources or prompts), and `load_guide` requires pre-downloading guides.
  • HTTP mode uses legacy HTTP+SSE endpoints (`/mcp/messages`, `/mcp/sse`), requiring `mcp-remote` if bridged to STDIO-only clients.

rails-mcp-server setup notes

  • rails-mcp-server's example uses stdio, while its catalog transports are stdio / sse; use the example's connection type.

Frequently asked questions

Install the gem globally with `gem install rails-mcp-server`, then run the interactive `rails-mcp-config` command to register your Rails project paths in `projects.yml` and update Claude Desktop. The config tool automatically detects your Ruby interpreter path via `RbConfig.ruby` and creates a backup before editing `claude_desktop_config.json`.

Related MCP servers