How the Rails MCP Server works
mainThe Rails MCP Server implements the Model Context Protocol using two modes:
- STDIO mode: Reads JSON-RPC 2.0 requests from standard input and returns responses to standard output. This is the default mode for integration with LLM clients like Claude Desktop.
- HTTP mode: Provides HTTP endpoints for JSON-RPC 2.0 requests and Server-Sent Events.
Context-Efficient Architecture
The server uses a progressive tool discovery architecture to minimize context usage. Instead of exposing all tools upfront, it provides 3 bootstrap tools that allow LLMs to discover and invoke introspection analyzers on-demand:
switch_project: Select the active Rails project.search_tools: Discover available tools by category or keyword.execute_tool: Invoke internal analyzers with parameters.
This design keeps the initial context small while exposing the full set of analyzers only when needed.