rails-ai-context

Stop AI from guessing your Rails app. 35 MCP tools give coding agents ground truth on demand: schema, models, routes, controllers, views, jobs and conventions.

What is rails-ai-context?

Stop AI from guessing your Rails app. 35 MCP tools give coding agents ground truth on demand: schema, models, routes, controllers, views, jobs and conventions. Works with Claude Code, Cursor, GitHub Copilot, OpenCode and Codex CLI. MCP or CLI, in your Gemfile or standalone, and it still answers when the app can't boot.

Overview of rails-ai-context

What it is

rails-ai-context is a Ruby gem that provides 35 read-only MCP (Model Context Protocol) tools for AI coding agents. It gives agents ground truth about a Rails application's schema, models, routes, controllers, views, jobs, and conventions, so they stop guessing. It works with Claude Code, Cursor, GitHub Copilot, OpenCode, and Codex CLI. It can be used via MCP or CLI, in a Gemfile or standalone, and still answers when the app cannot boot. The license is MIT. The pricing type is open source. The repository is at https://github.com/crisnahine/rails-ai-context. The homepage is at https://crisnahine.github.io/rails-ai-context.

Key features

  • 35 read-only MCP tools that read the Rails app itself, providing schema, models, routes, controllers, views, jobs, and conventions.
  • Works with Claude Code, Cursor, GitHub Copilot, OpenCode, and Codex CLI.
  • Can be used via MCP or CLI, in a Gemfile or standalone.
  • Still answers when the Rails app cannot boot (static mode).
  • Each answer includes a confidence level and a hint for the next call.
  • Tools are read-only; the SQL tool runs inside a read-only transaction; files with secrets are never served.
  • Installs context files that AI tools read, including six anti-hallucination rules.

Use cases

  • An AI assistant writing Rails code needs to know the actual columns, associations, filters, and test setup of a specific Rails app.
  • Avoiding hallucinations where the assistant writes migrations for columns that already exist, calls wrong associations, or misses inherited filters.
  • Tracing a method's definition, source, callers, and tests.
  • Working with an app that cannot boot, using static analysis from config/routes.rb, schema dump, and source files.

Getting started

Open your AI tool at the root of your Rails app and paste the install prompt from the README. Alternatively, in the Gemfile: bash bundle add rails-ai-context --group development bin/rails generate rails_ai_context:install --tools claude --defaults Standalone, with no Gemfile change: bash gem install rails-ai-context rails-ai-context init --tools claude --defaults As a Claude Code plugin: bash gem install rails-ai-context claude plugin install rails-ai-context --marketplace crisnahine/rails-ai-context --scope project You need Ruby 3.1+ and Rails 7.0 to 8.1, on Linux, macOS, or Windows. Optional: brakeman for security_scan, listen for watch, ripgrep for faster search_code. After install, approve the MCP server in your AI tool.

License and pricing

The license is MIT. The pricing type is open source.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/crisnahinerails-ai-context.svg)](https://yunodb.com/tools/crisnahinerails-ai-context?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/crisnahinerails-ai-context?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/crisnahinerails-ai-context.svg" alt="Featured on YunoDB" height="20"></a>