38 MCP tools that give AI agents live access to your Rails schema, models, routes & conventions.
Get AI context for your Rails app in under 5 minutes.
# 1. Add the gem
bundle add rails-ai-context --group development
# 2. Run the install generator
rails generate rails_ai_context:install
The generator asks two questions:
That’s it. Your AI tool now has live access to your schema, models, routes, controllers, views, and conventions.
[!TIP] The generator is idempotent — re-running it preserves existing config and only adds new sections.
# 1. Install the gem globally
gem install rails-ai-context
# 2. Navigate to your Rails app
cd your-rails-app
# 3. Run interactive setup
rails-ai-context init
# 4. Start the MCP server
rails-ai-context serve
Works with every Ruby version manager (rbenv, rvm, asdf, mise, chruby, system). Learn more about standalone mode →
The install generator created:
| File | Purpose |
|---|---|
.mcp.json / .cursor/mcp.json / .vscode/mcp.json / opencode.json / .codex/config.toml |
MCP auto-discovery — your AI tool detects these on project open |
CLAUDE.md / .cursor/rules/ / .github/instructions/ |
Static context rules your AI reads |
config/initializers/rails_ai_context.rb |
All configuration options |
.rails-ai-context.yml |
Config for standalone mode |
# Check AI readiness (23 diagnostic checks)
rails ai:doctor # In-Gemfile
rails-ai-context doctor # Standalone
# Try a tool
rails 'ai:tool[schema]' table=users
rails 'ai:tool[model_details]' model=User
rails 'ai:tool[routes]' controller=users
[!IMPORTANT] These are CLI commands. When MCP is connected, your AI calls the same tools automatically — you never type these manually.
Three commands that show immediate value:
# 1. Trace a method across your entire codebase — one call
rails 'ai:tool[search_code]' pattern="your_method_name" match_type=trace
# 2. Full-stack feature analysis — models + controllers + routes + tests
rails 'ai:tool[analyze_feature]' feature=auth
# 3. Get your app's actual conventions — not generic Rails patterns
rails 'ai:tool[conventions]'
rails_get_model_details instead of guessing| In-Gemfile | Standalone | What it does |
|---|---|---|
rails ai:serve |
rails-ai-context serve |
Start MCP server |
rails 'ai:tool[NAME]' |
rails-ai-context tool NAME |
Run any tool |
rails ai:tool |
rails-ai-context tool --list |
List all tools |
rails ai:doctor |
rails-ai-context doctor |
Diagnostics |
rails ai:watch |
rails-ai-context watch |
Auto-regenerate on change |
rails ai:context |
rails-ai-context context |
Regenerate context files |