Best MCP Servers for Ruby on Rails in 2026
The best MCP servers for Rails — Postgres for Active Record, Docker for services, Playwright for system tests, Context7 for Rails docs.
Rails developers work across the full stack in a way that few other frameworks demand. In a single session, you might write a migration, adjust a background job configuration, add a system test, update a controller, and deploy -- all guided by conventions that change between major versions. The mental overhead is not complexity per se but breadth. Model Context Protocol (MCP) servers help by giving your AI assistant direct access to the systems you interact with throughout the day: your database, your containers, your docs, your repository, and your browser.
The payoff for Rails developers specifically is that MCP servers understand the context your conventions create. When the assistant can see your Postgres schema directly, it writes migrations that respect your existing column types and constraints. When it can read current Rails documentation, it uses the right Active Record methods for your version. This guide covers the five MCP servers that matter most for Rails development and how they fit into the Rails workflow.
PostgreSQL MCP -- Your Database Schema as Living Context
Author: Anthropic | Tools: 8 | Setup: Connection string required
Rails is opinionated about its database, and that opinion is Postgres in production. The PostgreSQL MCP server connects your AI assistant directly to your database, giving it the ability to inspect schemas, run queries, and understand your data model without you copying table definitions or explaining column types.
What It Does
The server exposes 8 tools for database interaction: running SQL queries, inspecting table schemas, listing tables and columns, and examining indexes and constraints. Your assistant can see your entire database structure -- every table, every column type, every foreign key relationship, every index -- and use that knowledge when writing code that interacts with the database.
How It Helps in Practice
You need to add a polymorphic association to your comments table so that comments can belong to either posts or products. Instead of looking up your existing table structure, checking what columns already exist, and remembering whether you use bigint or uuid for primary keys, you tell the assistant what you want. It queries your database schema through MCP, sees that you use bigint primary keys and already have a comments table with specific columns, and generates a migration that fits your existing conventions:
add_column :comments, :commentable_type, :string
add_column :comments, :commentable_id, :bigint
add_index :comments, [:commentable_type, :commentable_id]
The assistant does not guess at column types or make assumptions about your naming patterns. It reads the actual schema and writes a migration that is consistent with what is already there.
This is equally valuable for writing scopes and queries. When the assistant can see your indexes, it writes queries that use them. When it can see your column types, it avoids type mismatches. When it can check the actual data in development, it can verify that a complex query returns expected results before you commit it.
Configuration
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://localhost:5432/myapp_development"
]
}
}
}
Point it at your development database. Replace myapp_development with your actual database name. If you use non-default credentials, include them in the connection string.
Docker MCP -- Managing Your Service Dependencies
Author: Community | Tools: 14 | Setup: Zero-config (npx)
A production Rails application rarely runs alone. You have Postgres, Redis for caching and Action Cable, Sidekiq for background jobs, maybe Elasticsearch or Meilisearch for search, and often additional services for development like Mailcatcher or MinIO. Docker Compose wrangles all of these, and Docker MCP lets your assistant manage them directly.
What It Does
Docker MCP exposes 14 tools for container management: listing containers, starting and stopping services, inspecting container details, viewing logs, managing images and volumes, and interacting with networks. Your assistant can check which containers are running, read their logs, restart a crashed service, or inspect a container's configuration -- all without you switching to a terminal window.
How It Helps in Practice
You are debugging a Sidekiq job that silently fails. The job processes uploaded images and stores them in MinIO (an S3-compatible service running in Docker). You suspect the MinIO container might be having issues. Instead of opening a terminal, running docker ps, checking the MinIO container, then docker logs minio, you ask the assistant to check the status of your Docker services and look at the MinIO logs. It finds that MinIO restarted 10 minutes ago due to a memory limit and the upload bucket permissions were reset.
For development environment setup, Docker MCP is equally helpful. A new developer joins the project and needs to get the full stack running. The assistant can inspect the docker-compose.yml, start all services, verify they are healthy, and troubleshoot any that fail to start -- guiding the setup process from within the editor.
When you are adding a new service to your stack -- say, switching from delayed_job to Sidekiq and adding Redis -- the assistant can manage the Docker side of that transition: verifying Redis is running, checking its connectivity, and monitoring the Sidekiq container logs to confirm jobs are processing.
Configuration
{
"mcpServers": {
"docker": {
"command": "npx",
"args": ["-y", "docker-mcp"]
}
}
}
No API keys needed. Requires Docker to be installed and running on your machine.
Context7 MCP -- Rails Docs That Match Your Version
Author: Upstash | Tools: 2 | Setup: Zero-config (npx)
Rails has strong conventions, and those conventions evolve. Rails 7 introduced import maps and Hotwire as defaults. Rails 7.1 added normalizes and async queries. Rails 8 brought Solid Queue, Solid Cache, and Kamal as first-party deployment tools. Each version shifts what "the Rails way" means, and AI assistants trained on mixed-version documentation frequently generate code that uses patterns from the wrong version.
What It Does
Context7 MCP provides two tools: one resolves a library name to an ID, and the other queries that library's current documentation with a specific question. It indexes thousands of libraries and returns version-specific documentation and code examples. For Rails, this means the assistant can check whether a method exists in your version, look up the current API for Active Record associations, or verify how Turbo Streams work in the latest release.
How It Helps in Practice
You ask your assistant to add full-text search to your application. Without Context7, it might suggest using pg_search with syntax that worked in Rails 6 but ignores the built-in normalizes method added in Rails 7.1, or it might use the old where syntax instead of the newer in_order_of query method. With Context7, the assistant looks up the current Rails documentation and writes code that matches your version's API.
This is especially critical when working with Hotwire. Turbo Frames, Turbo Streams, and Stimulus have evolved rapidly, and the difference between pre-1.0 and current Turbo syntax is significant. Your assistant asking Context7 "how do Turbo Stream broadcasts work in Turbo 2.0" returns the exact current patterns, not the deprecated ones it might have memorized.
For gem documentation, Context7 is equally valuable. Devise, Pundit, Sidekiq, Shrine -- these gems have their own APIs that change between major versions. Context7 fetches the current docs so your assistant writes configuration and integration code that actually works with the versions in your Gemfile.
Configuration
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
No API key required. Works immediately.
GitHub MCP -- Convention-Heavy PRs and CI Integration
Author: Anthropic | Tools: 20 | Requires: GitHub personal access token
Rails pull requests tend to be large and convention-heavy. A feature PR might include a migration, model changes, controller updates, view templates, system tests, and route modifications. GitHub MCP connects your assistant to the GitHub API so it can manage these PRs, review diffs, track issues, and interact with CI workflows -- all from within your editor.
What It Does
The server provides 20 tools covering the full GitHub workflow: creating and managing repositories, opening and reviewing pull requests, creating issues with labels, working with branches, searching code, and monitoring GitHub Actions workflows.
How It Helps in Practice
You have finished a feature that adds a tagging system to your Rails app. The changes span 8 files: a migration, a model, a join table model, a controller, two view partials, a route update, and a system test. Creating a PR with a meaningful description that covers all of these changes is tedious. With GitHub MCP, the assistant reads the diff, understands the Rails conventions at play (polymorphic associations, nested routes, Turbo Stream responses), and generates a PR description that a reviewer can actually use.
On the CI side, Rails projects often have multi-step pipelines: running RuboCop, then model tests, then system tests, then security audits. When CI fails, you can ask the assistant to check which step failed and pull the relevant logs. If it is a flaky system test (a common Rails CI problem), the assistant can look at the test file, identify potential timing issues, and suggest fixes.
For teams following the GitHub Flow model with Rails, the assistant can also help manage the release process -- checking which PRs have been merged since the last release, generating changelogs based on PR descriptions, and creating release tags.
Configuration
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-github-token"
}
}
}
}
Create a personal access token with repo scope from your GitHub settings.
Playwright MCP -- System Tests That Write Themselves
Author: Microsoft | Tools: 20 | Setup: Zero-config (npx)
Rails has first-class support for system tests -- browser-driven tests that exercise your full application from the UI down to the database. Playwright MCP complements this by giving your AI assistant direct browser control, so it can both verify application behavior interactively and help you write system tests based on what it observes.
What It Does
Twenty tools for full browser automation: navigating pages, capturing accessibility snapshots, clicking elements, filling forms, managing viewport sizes, handling file uploads, waiting for specific content, taking screenshots, and evaluating JavaScript. It works with Chrome, Firefox, and WebKit.
How It Helps in Practice
You have just built a multi-step wizard for user onboarding. Before writing system tests, you want to verify the flow works end to end. You ask the assistant to open localhost:3000/onboarding, walk through each step, fill in the required fields, and report what happens. It drives the browser through the entire wizard, noting that step 3 has a validation error that does not clear after correction, and that the final step's Turbo Stream response takes 4 seconds to render.
Now you want to codify this as a system test. The assistant already knows every step of the flow, every field name, every expected outcome. It generates a Rails system test that uses Capybara syntax (checking Context7 for the correct patterns) and covers both the happy path and the edge cases it discovered during the interactive run:
test "user completes onboarding wizard" do
visit onboarding_path
fill_in "Company name", with: "Acme Corp"
click_on "Next"
# ... verified steps from the interactive run
end
The interactive exploration and test generation happen in the same conversation. The assistant observes the application's actual behavior through Playwright, then translates those observations into system tests.
Configuration
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["-y", "@playwright/mcp"]
}
}
}
No API keys or environment variables. Launches a local browser on demand.
Combining Everything -- The Rails Development Loop
These five servers mirror the natural Rails development workflow:
- Schema: PostgreSQL MCP reads your database structure. The assistant writes migrations that respect existing conventions.
- Services: Docker MCP manages Postgres, Redis, Sidekiq, and any other dependencies in your Docker Compose stack.
- Code: Context7 MCP ensures the assistant uses patterns from your Rails version, not deprecated APIs from older releases.
- Test: Playwright MCP drives a browser through your application, verifying behavior and generating system tests.
- Ship: GitHub MCP creates PRs with meaningful descriptions, monitors CI, and helps manage releases.
The total token cost is approximately 37,810 tokens -- about 19% of a 200K context window. The heaviest contributors are Playwright MCP and GitHub MCP, both at 20 tools each, but their breadth is justified by the range of tasks they cover in a Rails workflow.
Getting Started
Start where your workflow has the most friction:
- Writing migrations and queries by hand? PostgreSQL MCP lets the assistant see your schema and write accurate SQL.
- Fighting with Docker Compose? Docker MCP puts container management in your editor.
- Getting wrong Rails patterns from your assistant? Context7 MCP fixes version confusion immediately.
- Spending too long on PR descriptions? GitHub MCP generates them from the actual diff.
- Writing system tests after the fact? Playwright MCP lets you explore the app and generate tests in one step.
Rails developers tend to get the most value from PostgreSQL MCP and Context7 MCP first, since database interaction and version-correct patterns are daily pain points. Add the others as your workflow expands.
For the complete pre-configured stack, visit the Rails + Ruby Stack on stackmcp.dev. Select your AI client, enter your credentials, and copy the config. Your full Rails development environment will be MCP-connected in under a minute.