# Rails AI Context

> Rails AI Context is an open-source MCP server for developer tools. Read-only tools that tell a coding agent your Rails app's schema, models, routes and tests. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted
- **Website:** https://crisnahine.github.io/rails-ai-context/
- **Repository:** https://github.com/crisnahine/rails-ai-context
- **MCP Registry name:** io.github.crisnahine/rails-ai-context
- **Categories:** developer tools
- **Listing updated:** 2026-11-15

## About

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.

## Features

- **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

## Install

### Claude Code (Terminal)

```sh
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
```

### Claude Desktop (claude_desktop_config.json)

```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"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```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"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```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"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```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"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```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"
      ]
    }
  }
}
```

## Tools

- `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.

## 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

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/rails-ai-context
