# How to Set Up rails-mcp-server for Rails Projects with MCP

DevFeed: [How to Set Up rails-mcp-server for Rails Projects with MCP](<https://devfeed.tech/articles/how-to-rev-up-your-rails-development-with-mcp-20116.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/how-to-rev-up-your-rails-development-with-mcp>)

Author: Jack Rosa

Published: 2025-11-27T14:00:00Z

Content type: tutorial

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Model Context Protocol](<https://devfeed.tech/topics/model-context-protocol.md>), [MCP Server](<https://devfeed.tech/topics/mcp-server.md>), [Development](<https://devfeed.tech/topics/development.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Claude Code](<https://devfeed.tech/topics/claude-code.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [JSON](<https://devfeed.tech/topics/json.md>), [Remote Procedure Call (RPC)](<https://devfeed.tech/topics/rpc.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [claude-code](<https://devfeed.tech/tags/claude-code.md>), [development](<https://devfeed.tech/tags/development.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [http](<https://devfeed.tech/tags/http.md>), [json](<https://devfeed.tech/tags/json.md>), [mcp](<https://devfeed.tech/tags/mcp.md>), [mcp-server](<https://devfeed.tech/tags/mcp-server.md>), [rails](<https://devfeed.tech/tags/rails.md>), [rpc](<https://devfeed.tech/tags/rpc.md>), [ruby](<https://devfeed.tech/tags/ruby.md>)

## AI overview

This tutorial explains how to install and configure the rails-mcp-server Ruby gem so AI agents such as Claude Code can interact with Rails projects through the Model Context Protocol. It covers global installation, project configuration, HTTP mode, JSON-RPC and SSE endpoints, and Claude Code integration.

## Source excerpt

Shipping new features on legacy Rails applications requires deep codebase context. The rails-mcp-server gem closes the gap between AI agents and your Rails projects, enabling more relevant code analysis and context aware refactoring suggestions. Whether you're dealing with tech debt in a brownfield application or building new greenfield features, this tool can help you move faster with confidence. The Model Context Protocol (MCP) is a way to allow LLM models to interact with development environments and external tools. The rails-mcp-server gem is a Ruby implementation that enables LLMs to interact directly with Rails projects through MCP; Once you have it set up with an agent like claude or copilot, the model will have way more context about your app's architecture and removes a lot of the nonsense and guesswork associated with AI driven development. Check out the repo here I'll walk you through setting up the rails-mcp-server gem for your Rails projects. Installation Installing the rails-mcp-server gem is simple like any ruby gem. Open your terminal and run. Don't install it to your project's directory or add it to a Rails gemfile, this gem is meant to be installed globally and configured to run with multiple projects. gem install rails-mcp-server Config Setting Up Your Projects Once you run the server for the first time, you can configure the gem to access your rails projects. The configuration location depends on your operating system: macOS: $XDG_CONFIG_HOME/rails-mcp or ~/.config/rails-mcp if XDG_CONFIG_HOME is not set Windows: %APPDATA%\rails-mcp The first time the server runs, these directories will be created. Running the Rails MCP Server The server can be ran in two modes, but for the purposes of this article we will stick to http mode, if you want to find out about STDIO mode check out the docs here. Running the server will create the config directory. HTTP Mode HTTP mode runs as an HTTP server with JSON-RPC and Server-Sent Events (SSE) endpoints, perfect