Rails AI Context
Lets your AI agent read your real Rails schema, models, routes and controllers instead of guessing them.
172 stars on GitHubby Cris NahineLicense MITUpdated 21 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Download the .mcpb file and open it with Claude Desktop.
Download the .mcpb file βReady! Now test it
Restart the app and paste one of these requests in the chat:
What columns does the users table have, and which indexes?
Show the associations and validations on the Article model before I add a comment feature.
What it is
This server gives your AI agent 35 read-only tools that look at your actual Rails app. The agent can check the columns of a table, the associations and validations of a model, the filters a controller inherits, and the test setup before it writes code. It can still answer from the source files when the app cannot boot.
What it can do
rails_get_schema: tables, columns, types and indexesrails_get_model_details: associations, validations, enums, scopes and callbacks- Controller info: actions, inherited filters and strong parameters
- Test info: framework, factories or fixtures and a template in your style
- Method tracing: definition, callers and tests
search_code: search the app sourcesecurity_scan: scan the app using Brakeman
When to use
- βΊWhen your assistant keeps inventing columns or associations that do not exist in your app
- βΊWhen you want it to write a migration, test or controller that matches your conventions
- βΊWhen you need to trace who calls a method before changing it
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
rails-devTeaches your agent the opinionated conventions of Ruby on Rails apps, from rich models and CRUD routes to minimal gems and tests.rails-patternsLets your agent develop applications with Ruby on Rails. It applies recommended patterns for efficient and maintainable controllers, models, and views.rails-expertHelps your agent build Rails 7 apps with Hotwire, Action Cable real-time features, Sidekiq background jobs, faster Active Record queries, and RSpec tests.Frequently asked questions
Is it free?
The readme shows an open license and a public gem. It is installed from RubyGems.
Does it change my app?
The tools are read-only, and the SQL tool runs inside a read-only transaction. The install writes config and context files for your AI tool.
Which AI tools does it support?
Claude Code, Cursor, GitHub Copilot, OpenCode and Codex CLI, according to the readme.
Does it work if the app cannot boot?
Yes. It can read config/routes.rb, the schema dump and the source in a static mode, and it marks runtime-only data as unavailable.
Are secrets exposed?
The readme says files that hold secrets are never served.
How do I install it?
Run bundle add rails-ai-context in the development group, then the install generator for your AI tool. A standalone install with gem install is also possible.
If it does not work
- βΊCheck that Ruby is 3.1 or newer and Rails is 7.0 or newer with ruby -v and bundle exec rails -v.
- βΊYour AI tool holds new project MCP servers back until you approve them, so approve rails-ai-context in a new session.
- βΊIf the app cannot boot, run rails-ai-context init instead of the generator so it reads the source files.
5 new skills a week. 1 minute to read.