Rails AI Context
A Ruby gem and MCP server: 35 read-only tools let Claude Code, Cursor, Copilot, OpenCode and Codex CLI ask your Rails app for its schema, models, routes, controllers and views instead of guessing.
rails-ai-context lets AI coding agents ask a Rails app about itself instead of writing from memory. 35 read-only tools answer from the app: the schema with its indexes, models with associations, validations, scopes and callbacks, routes, controllers with every inherited filter and strong params, views, jobs, tests and conventions. It runs as an MCP server over stdio or HTTP, or from any terminal with no server at all. When the app cannot boot (a missing env var, an unreachable service, a broken initializer), the same tools answer from the source in a static tier: routes from config/routes.rb, the schema from db/schema.rb, db/structure.sql or the migrations, and models and controllers from their source, read with Ruby's Prism parser. Every answer says which tier it came from and marks what it could not read as [UNAVAILABLE]. The install writes the MCP config and context files for Claude Code, Cursor, GitHub Copilot, OpenCode and Codex CLI, including six rules that tell the assistant to verify before it writes. Other MCP clients (Claude Desktop, Windsurf, Zed, JetBrains IDEs) take the entry `rails-ai-context mcp-entry` prints. Every tool is read-only. The SQL tool runs inside a read-only transaction with a timeout, a row limit and column redaction, and files that hold secrets (.env, master.key, credentials) are never served. Free and MIT licensed. Ruby 3.1+ and Rails 7.0 to 8.1, on Linux, macOS and Windows.