Skip to content
MCP server

Rails AI Context

Read-only tools that tell a coding agent your Rails app's schema, models, routes and tests

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
CLI, self-hosted
Runs
Locally
Version
5.39.1
Listing updated
2 days ago

About Rails AI Context

Rails AI Context is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.

The pitch is that an assistant writes Rails from memory of an average app, while this Ruby gem lets it ask the actual one. It adds 35 read-only tools covering the schema, models, associations, validations, scopes, inherited controller filters, routes, views and test setup, and can also be run from a terminal.

Each answer is read from the app and labelled with how sure it is, tagged for example [STATIC] when the app was read without booting. Static mode keeps the tools working when a credential is missing or an initializer is broken. Most answers end with a hint for the next call, and tools such as rails_get_schema, rails_get_controllers and rails_analyze_feature are named on the site.

Installation is a bundle add in the development group plus a generator that writes the MCP config, a root context file with six anti-hallucination rules and rules for models, controllers and migrations. The SQL tool runs in a read-only transaction and files that hold secrets are never served. It is MIT licensed and works with Claude Code, Cursor, Copilot, OpenCode and Codex CLI.

Install

Run in a terminal

claude mcp add rails-ai-context -- npx -y https://github.com/crisnahine/rails-ai-context/releases/download/v5.39.1/rails-ai-context-mcp.mcpb

Add to claude_desktop_config.json

{
  "mcpServers": {
    "rails-ai-context": {
      "command": "npx",
      "args": [
        "-y",
        "https://github.com/crisnahine/rails-ai-context/releases/download/v5.39.1/rails-ai-context-mcp.mcpb"
      ]
    }
  }
}
Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "rails-ai-context": {
      "command": "npx",
      "args": [
        "-y",
        "https://github.com/crisnahine/rails-ai-context/releases/download/v5.39.1/rails-ai-context-mcp.mcpb"
      ]
    }
  }
}
Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to .vscode/mcp.json

{
  "servers": {
    "rails-ai-context": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "https://github.com/crisnahine/rails-ai-context/releases/download/v5.39.1/rails-ai-context-mcp.mcpb"
      ]
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "rails-ai-context": {
      "command": "npx",
      "args": [
        "-y",
        "https://github.com/crisnahine/rails-ai-context/releases/download/v5.39.1/rails-ai-context-mcp.mcpb"
      ]
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "rails-ai-context": {
      "command": "npx",
      "args": [
        "-y",
        "https://github.com/crisnahine/rails-ai-context/releases/download/v5.39.1/rails-ai-context-mcp.mcpb"
      ]
    }
  }
}

Tools this server provides (3)

Taken from the project documentation; the running server may differ.

rails_get_schema
Returns columns and indexes for a table.
rails_get_controllers
Returns a controller's actions and filters.
rails_analyze_feature
Gives a full-stack view of a feature.

What it does

Schema reading
Columns, types, indexes and the model on each table.
Model details
Associations, validations, enums, scopes and callbacks.
Controller filters
Shows filters with where each was inherited from.
Method tracing
Definition, callees, callers grouped by file, and tests.
Works without booting
Falls back to static analysis and marks unavailable data.
Read-only by design
SQL runs in a read-only transaction and secret files are never served.

Good for

  • Stop an assistant inventing columns or associations
  • Get a one-call overview of an unfamiliar Rails app
  • Trace where a service method is called
  • Write tests in the style of the app's factories

Pricing

Open source

MIT licence

Prices change. Check crisnahine.github.io before you buy.

Rails AI Context FAQ

Is it read-only?

Yes. The tools do not modify the app, and SQL runs in a read-only transaction.

What if my app cannot boot?

The tools answer from routes, the schema dump and source, and say they are in static mode.

Which assistants are supported?

Claude Code, Cursor, GitHub Copilot, OpenCode and Codex CLI.

What licence is it?

MIT.

Is Rails AI Context free?

Yes. Rails AI Context is open source, so you can use and self-host it for free.

How do I add Rails AI Context to Claude Code?

Run this command in your terminal: claude mcp add rails-ai-context -- npx -y https://github.com/crisnahine/rails-ai-context/releases/download/v5.39.1/rails-ai-context-mcp.mcpb

What are the best alternatives to Rails AI Context?

The closest alternatives to Rails AI Context are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

Alternatives to Rails AI Context

  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 464K GitHub stars
    • Developer tools
  2. Codebase Memory

    MCP server

    Local MCP server that builds a code knowledge graph for AI coding agents

    Runs locally
    • Open source
    • 48.7K GitHub stars
    • Knowledge and memory
  3. GitHub

    MCP server

    Official MCP server connecting AI assistants to GitHub repos, issues and workflows

    Not checked yet
    • Remote
    • Open source
    • 34.5K GitHub stars
    • Developer tools
  4. MCP toolkit giving coding agents symbol-level code retrieval and editing

    Runs locally
    • Open source
    • 31.5K GitHub stars
    • Developer tools
  5. XERJ

    MCP server

    Local search engine for AI agents with cited answers over your code and docs

    Runs locally
    • Open source
    • 19.2K GitHub stars
    • Knowledge and memory
  6. Ouroboros

    MCP server

    Spec-first layer that pins requirements and verifies results of AI coding agent work

    Runs locally
    • Open source
    • 6.4K GitHub stars
    • Developer tools