rails-ai-context MCP
A Rails gem with an MCP server: the agent reads your schema, models, routes and tests instead of guessing them from a template.
- 186 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- The tools read the app's code and schema, and `query` runs reads against the development database.
Install
- Works in
Manual install
bundle add rails-ai-context --group developmentThe first README command for manual install; then run `bin/rails generate rails_ai_context:install --tools claude --defaults`.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The tools read the app's code and schema, and `query` runs reads against the development database.
This is third-party code. Review the repository files before installing.
What it does
rails-ai-context is a gem for Rails 7.0–8.1 with 35 tools that read the app itself. The agent asks about a table and gets columns, indexes and the model, sees options and validations before calling an association, and learns where filters are inherited before writing an action. For a test it reports the framework, factory locations and traits, and for a method it shows the definition and every caller. The tools work in three ways: an MCP server over stdio or HTTP, static context files (`CLAUDE.md`, `.cursor/rules/` and similar), and a plain CLI with no server. If the app cannot boot, the gem reads `config/routes.rb`, the schema dump and the source, and marks unavailable data as `UNAVAILABLE`. Every answer says how reliable it is and hints at the next call.
Who it is for. Rails developers with a non-trivial schema whose agent keeps calling associations and columns that do not exist.
Good fit when
- An agent writes a migration for a column the table already has.
- A controller loses a `before_action` inherited from its parent.
- A new model needs a test in the project's style, with your factories and traits.
- Before renaming a method you need every place that calls it.
- The app will not boot in the agent's environment, yet you still need the schema and routes read.
Not a fit when
- The project is not Rails: the gem only knows its structure.
- You run Rails 9 or Ruby older than 3.1: versions outside the compatibility matrix are unsupported.
- The agent must write to the database or change the app through a tool: all 35 tools only read.
Example request
Which columns does the users table have and which filters does AdminController inherit? Ask rails-ai-context before editing any code.MCP
- Transport
- stdio, http
- Authentication
- not required
Limitations
Needs Ruby 3.1 or newer and Rails 7.0 to 8.1; Rails 9 is unsupported. Without booting the app 32 of 40 introspectors answer and the rest return `UNAVAILABLE`; the `query`, `runtime_info` and `doctor` tools need a booted app, and `query` also needs a database. `query` on SQLite under Windows runs without a time limit because there is no `fork`. The first launch needs the MCP server approved inside the agent (in Claude Code that is a new session and approving `rails-ai-context`). `brakeman`, `listen` and `ripgrep` are optional.
How to disable. Remove the gem from the `Gemfile`, delete the files the installer wrote (`.mcp.json`, Cursor rules, the marked block in `CLAUDE.md`) and run `bundle install`. For the Claude Code plugin use `claude plugin uninstall rails-ai-context`.
FAQ
Does my agent need MCP support?
No. The same tools are available as static context files and as a CLI: `rails-ai-context tool schema --table users`. The MCP server is the smoothest option when the agent supports it.
How do I install the gem for Claude Code?
Run `bundle add rails-ai-context --group development`, then `bin/rails generate rails_ai_context:install --tools claude --defaults`. Then open a new session in the app folder and approve `rails-ai-context`; check it with `/mcp`.
What does the Claude Code plugin do?
It adds the MCP server and gives each session six rules, but writes no context files. The plugin runs the installed gem, so run `gem install rails-ai-context` first.
Does the gem work if the app will not boot?
Yes, in static mode (the `--no-boot` flag): it reads routes, the schema dump and source. Answers are marked `[STATIC]`, and data that needs a running app is marked `[UNAVAILABLE]`.
How do I run a tool without the server?
Through the CLI: `rails-ai-context tool schema --table users --detail full`. In an app with the gem in the `Gemfile`, use `bin/rails 'ai:tool[search_code]' pattern="publishable?" match_type=trace`.
Discussion
No questions or reviews yet.
Related
MCP serversA dev-only Rails engine that plugs an agent into the running app: eight MCP tools plus skills matched to the gems in your Gemfile.
The RubyLLM skill and plugin help an agent write chats, tools, MCP and structured output in Ruby and Rails applications
An MCP server and plugin for agents that generate web APIs from OpenAPI, AsyncAPI, GraphQL, gRPC and SQL specs on a Rust core.
MCP server for AEM Content Manager: the agent validates and runs Groovy scripts on Adobe Experience Manager and reads run history
A skill plugin that builds Rust web apps by Rails conventions, from the skeleton and resources to checks and deployment.
A PostgreSQL backend your agent builds over MCP, where the platform verifies every change and can roll it back.
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| rails-ai-context (this card) | no | not required | 186 | |
| Rails MCP Server | yes | not required | 573 | exposes project structure and Rails docs; here 35 tools read your app's schema, filters, factories and method callers |
| Tidewave Rails | yes | not required | 475 | works with a running Rails dev server; this one has a static mode that does not boot the app |
README in short
The README opens with a self-install prompt: the agent installs the gem, picks its own tool and names the one remaining step. After that come real answers recorded on a sample app, a tool reference and a table of install options.