Skip to main content
Glama
Rails Guides MCP Server

Rails Guides MCP Server

by alkevintan

Rails Guides MCP Server

A Model Context Protocol (MCP) server that provides access to Ruby on Rails documentation and guides. This server allows AI assistants like Claude to access, search, and reference Rails Guides content programmatically, making it easier to get Rails development help and documentation.

šŸš€ Features

  • Complete Rails Guides access - All official Rails documentation categories

  • Version support - Support for multiple Rails versions (8.0, 7.1, 4.2, etc.)

  • Categorized organization - Guides organized by topic (Models, Views, Controllers, etc.)

  • Dynamic version switching - Environment variable support for different Rails versions

  • TypeScript implementation with Zod schema validation

  • Development tools including hot reload and inspector

  • Ready for Claude integration with simple setup commands

Related MCP server: AutoGen Documentation MCP Server

šŸ“‹ Prerequisites

  • Node.js 18 or higher

  • npm, yarn, or pnpm

  • Claude desktop app (for integration)

šŸ¤ Intended Use Cases

This MCP server is perfect for:

  • Rails developers seeking quick access to official documentation

  • AI-assisted Rails development with Claude or other MCP-compatible tools

  • Learning Rails with contextual documentation access

  • Code review and debugging with instant access to Rails conventions

  • Teams wanting consistent Rails documentation access across projects

šŸš€ Quick Start with Claude

# Navigate to your Rails project directory
cd your-rails-project

# Add the Rails Guides MCP server to your project
claude mcp add rails-guides npx rails-mcp-server

# For specific Rails version
claude mcp add rails-guides npx rails-mcp-server -e RAILS_VERSION=7.1

Option 2: Add Globally

# Add globally for all Claude sessions
claude mcp add rails-guides npx rails-mcp-server --scope user

# With specific Rails version
claude mcp add rails-guides npx rails-mcp-server --scope user -e RAILS_VERSION=7.1

Option 3: Add Locally

# Add for local Claude sessions only
claude mcp add rails-guides npx rails-mcp-server --scope local

šŸ”§ Rails Version Support

The server defaults to Rails 8.0 documentation but supports multiple versions:

Supported Versions

  • Rails 8.0 (default) - https://guides.rubyonrails.org

  • Rails 7.1 - https://guides.rubyonrails.org/v7.1

  • Rails 4.2 - https://guides.rubyonrails.org/v4.2

  • Other versions - Follow the pattern v{major}.{minor}

Setting Rails Version

Use the RAILS_VERSION environment variable:

# Default (Rails 8.0)
claude mcp add rails-guides npx rails-mcp-server

# Rails 7.1
claude mcp add rails-guides npx rails-mcp-server -e RAILS_VERSION=7.1

# Rails 4.2
claude mcp add rails-guides npx rails-mcp-server -e RAILS_VERSION=4.2

# Rails 6.0
claude mcp add rails-guides npx rails-mcp-server -e RAILS_VERSION=6.0

Alternative Environment Variable

You can also use RAILS_GUIDES_VERSION:

claude mcp add rails-guides npx rails-mcp-server -e RAILS_GUIDES_VERSION=7.1

šŸ› ļø Manual Installation (Development)

If you want to modify or contribute to this server:

  1. Clone the repository:

git clone https://github.com/your-username/rails-mcp-server.git
cd rails-mcp-server
  1. Install dependencies:

npm install
  1. Build the project:

npm run build
  1. Test locally:

node dist/server.js

šŸƒā€ā™‚ļø Development

Start Development Server

npm run dev

Build for Production

npm run build

Inspect MCP Server

npm run inspect

This opens the MCP Inspector to test your server tools interactively.

šŸ“š Available Tools

The Rails Guides MCP server provides the following tools:

Core Tools

  • getRailsGuides - Returns a comprehensive list of all Rails Guides with categories and metadata

  • getGuideRegistry - Complete registry with all guides, categories, and version info

  • getGuideContent - Fetches the full HTML content of a specific Rails Guide

Category-specific Tools

Dynamic tools are created for each Rails Guide category:

  • getStartHereGuides - Getting Started, Installation guides

  • getModelsGuides - Active Record, Migrations, Validations, Associations, etc.

  • getViewsGuides - Action View, Layouts, Helpers, Form Helpers

  • getControllersGuides - Action Controller, Routing, Advanced Topics

  • getOtherComponentsGuides - Active Support, Action Mailer, Active Job, etc.

  • getDiggingDeeperGuides - I18n, Testing, Debugging, Configuration, etc.

  • getGoingToProductionGuides - Caching, Security, Performance

  • getAdvancedActiveRecordGuides - PostgreSQL, Multiple DBs, Encryption

  • getExtendingRailsGuides - Plugins, Rack, Generators, Engines

  • getContributingGuides - Contributing, API docs, Development setup

Example Usage

Once added to Claude, you can ask questions like:

  • "Show me the Rails guides for Models"

  • "Get the Getting Started guide content"

  • "What Rails guides are available for testing?"

  • "Fetch the Active Record associations guide"

šŸ—ļø Project Structure

rails-mcp-server/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ server.ts              # Main Rails Guides MCP server
│   ā”œā”€ā”€ lib/
│   │   ā”œā”€ā”€ config.ts          # Configuration with version support
│   │   └── categories.ts      # Rails Guides categories
│   └── utils/
│       ā”œā”€ā”€ api.ts             # Rails Guides fetching utilities
│       ā”œā”€ā”€ formatters.ts      # Data formatting helpers
│       ā”œā”€ā”€ schemas.ts         # Zod validation schemas
│       └── index.ts           # Utility exports
ā”œā”€ā”€ dist/                      # Built files
ā”œā”€ā”€ package.json
└── README.md

šŸ”§ Customization

Adding New Rails Guide Categories

To add new guide categories, update src/lib/categories.ts:

export const guideCategories = {
  // Existing categories...
  "Custom Category": [
    "custom_guide_1",
    "custom_guide_2", 
  ],
};

The server will automatically create category-specific tools.

Supporting Different Rails Versions

The server automatically handles different Rails versions through URL patterns:

  • Rails 8.0+: https://guides.rubyonrails.org/{guide}.html

  • Older versions: https://guides.rubyonrails.org/v{version}/{guide}.html

Customizing Guide Processing

Modify src/utils/api.ts to customize how guides are processed:

export async function fetchGuideDetails(guideName: string) {
  // Add custom processing logic
  // Parse HTML sections, extract code examples, etc.
}

šŸš€ Deployment

Publishing as NPM Package

To make this server available via npx, publish it to npm:

  1. Update package.json with your details:

{
  "name": "rails-mcp-server",
  "version": "1.0.0",
  "description": "MCP server for Rails Guides documentation",
  "bin": {
    "rails-mcp-server": "./dist/server.js"
  }
}
  1. Build and publish:

npm run build
npm publish
  1. Then users can add it with:

claude mcp add rails-guides npx rails-mcp-server

Manual Installation

For development or custom deployments:

# Clone and build
git clone https://github.com/your-username/rails-mcp-server.git
cd rails-mcp-server
npm install && npm run build

# Add to Claude with local path
claude mcp add rails-guides node /path/to/rails-mcp-server/dist/server.js

šŸ¤ Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature/amazing-feature

  3. Make your changes and add tests if applicable

  4. Commit your changes: git commit -m 'feat: add amazing feature'

  5. Push to the branch: git push origin feature/amazing-feature

  6. Open a Pull Request

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

šŸ™ Acknowledgments

šŸ“ž Support


✨ Happy Rails development with AI assistance!

Available Tools

13 tools
getAdvancedActiveRecordGuidesB

Provides Rails 8.0 Guides for the Advanced Active Record category: active_record_postgresql, active_record_multiple_databases, active_record_encryption, active_record_composite_primary_keys

Inputs: no named parameters.

getContributingGuidesA

Provides Rails 8.0 Guides for the Contributing category: contributing_to_ruby_on_rails, api_documentation_guidelines, ruby_on_rails_guides_guidelines, development_dependencies_install

Inputs: no named parameters.

getControllersGuidesB

Provides Rails 8.0 Guides for the Controllers category: action_controller_overview, routing, action_controller_advanced

Inputs: no named parameters.

getDiggingDeeperGuidesA

Provides Rails 8.0 Guides for the Digging Deeper category: i18n, testing, debugging_rails_applications, configuring, command_line, asset_pipeline, working_with_javascript_in_rails, autoloading_and_reloading_constants

Inputs: no named parameters.

getExtendingRailsGuidesA

Provides Rails 8.0 Guides for the Extending Rails category: plugins, rails_on_rack, creating_and_customizing_rails_generators, engines, rails_application_templates

Inputs: no named parameters.

getGoingtoProductionGuidesA

Provides Rails 8.0 Guides for the Going to Production category: rails_application_templates, caching_with_rails, security, error_reporting

Inputs: no named parameters.

getGuideContentC

Fetches the complete content of a specific Rails 8.0 Guide.

getGuideRegistryA

Provides the complete Rails 8.0 Guides registry with categories and metadata.

Inputs: no named parameters.

getModelsGuidesB

Provides Rails 8.0 Guides for the Models category: active_record_basics, active_record_migrations, active_record_validations, active_record_callbacks, association_basics, active_record_querying, active_model_basics

Inputs: no named parameters.

getOtherComponentsGuidesB

Provides Rails 8.0 Guides for the Other Components category: active_support_core_extensions, action_mailer_basics, action_mailbox_basics, action_text_overview, active_job_basics, active_storage_overview, action_cable_overview

Inputs: no named parameters.

getRailsGuidesA

Provides a comprehensive list of all Rails 8.0 Guides with their categories and basic information.

Inputs: no named parameters.

getStartHereGuidesB

Provides Rails 8.0 Guides for the Start Here category: getting_started, install_ruby_on_rails

Inputs: no named parameters.

getViewsGuidesB

Provides Rails 8.0 Guides for the Views category: action_view_overview, layouts_and_rendering, action_view_helpers, form_helpers

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 13 tools

    Disambiguation3/5

    The ten category getters (Models, Views, Controllers, etc.) are clearly distinct, and getGuideContent is obviously different. However, getRailsGuides and getGuideRegistry both claim to return 'all Rails 8.0 Guides with their categories and metadata,' making them nearly indistinguishable from the description alone. Category getters also partly overlap with the full listing, so an agent must guess which of the two registry-style tools to call.

    Naming Consistency4/5

    Names are uniformly camelCase with a get_ prefix pattern (getXGuides, getGuideContent, getGuideRegistry), which is easy to predict. Minor deviations exist: the category getters are named after categories rather than a verb_noun form, and 'getGoingtoProductionGuides' has awkward casing compared with the rest.

    Tool Count4/5

    Thirteen tools is a sensible scope for browsing a documentation corpus. The ten one-per-category getters could arguably be collapsed into a single getGuides(category) tool, and the two overlapping registry tools are redundant, but nothing is wildly out of proportion.

    Completeness4/5

    The full Rails Guides taxonomy plus a content-fetch tool gives end-to-end coverage from discovery to reading a guide. The notable gap is search: there is no keyword/lookup tool, so an agent must already know which category or guide ID to request, and no per-section or per-chapter retrieval exists.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides AI assistants with access to RubyUI component library documentation, including listing components, fetching docs, searching, and getting installation/theming guides.
      GPL 3.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI assistants to search API documentation, retrieve endpoint details, get SDK snippets, and check changelogs from an OpenAPI spec.
      7
      112 npm
      4
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables natural-language search of 378 curated AI agent frameworks, developer tools, and automation repositories from inside Claude Code, Cursor, Codex, or any MCP-compatible client, returning matching repos with descriptions instead of manual GitHub browsing. Also exposes category listing, stats, and single-repo lookup.
      -