StackMCP
Blog
·7 min read

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.

mcprubyrailspostgresdocker

Rails developers work across the full stack in a single session -- migrations, background jobs, system tests, controllers, deployments -- all guided by conventions that change between major versions. MCP servers help by giving your AI assistant direct access to your database, containers, docs, repository, and browser so it writes code that matches your actual environment and Rails version.

Server Author Tools Tokens Key Use
Postgres MCP Anthropic 8 ~4,120 Active Record, migrations, schema inspection
Docker MCP Docker 14 ~5,400 Postgres, Redis, Sidekiq containers
Context7 MCP Upstash 2 ~1,030 Rails 8 docs, Hotwire, gem APIs
GitHub MCP Anthropic 20 ~8,200 PRs, CI pipelines, code search
Playwright MCP Microsoft 20 ~7,800 System tests, browser verification
graph LR
    A[Your Editor] --> B[AI Assistant]
    B --> C[Postgres MCP]
    B --> D[Docker MCP]
    B --> E[Context7 MCP]
    B --> F[GitHub MCP]
    B --> G[Playwright MCP]
    C --> H[PostgreSQL]
    D --> I[Docker Compose]
    E --> J[Rails Docs]
    F --> K[GitHub API]
    G --> L[Browser]

PostgreSQL MCP -- Your Database Schema as Living Context

Author: Anthropic | Tools: 8 | Setup: Connection string required

Eight tools for database interaction: running SQL queries, inspecting table schemas, listing tables and columns, and examining indexes and constraints. The assistant sees every table, column type, foreign key, and index. For a comparison of database servers, see Postgres vs SQLite vs MySQL MCP.

Why use it

  • Generate migrations that match your existing column types and naming conventions by reading the actual schema
  • Write scopes and queries that use your indexes instead of guessing at what is indexed
  • Verify complex query results against development data before committing
  • Add polymorphic associations that are consistent with your existing primary key types (bigint vs uuid)

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.

Docker MCP -- Managing Your Service Dependencies

Author: Docker | Tools: 14 | Setup: Zero-config (npx)

Fourteen tools for container management: listing containers, starting and stopping services, inspecting details, viewing logs, managing images and volumes, and interacting with networks. A production Rails app rarely runs alone -- Postgres, Redis, Sidekiq, Elasticsearch, Mailcatcher, MinIO are all typical Docker Compose services.

Why use it

  • Debug a failing Sidekiq job by checking the MinIO container logs and finding it restarted due to a memory limit
  • Verify all services are healthy when setting up a development environment
  • Monitor Sidekiq container logs to confirm jobs are processing after switching queue backends
  • Inspect container network configuration when adding a new service like Redis or Meilisearch

Configuration

{
  "mcpServers": {
    "docker": {
      "command": "npx",
      "args": ["-y", "docker-mcp"]
    }
  }
}

No API keys needed. Requires Docker to be installed and running.

Context7 MCP -- Rails Docs That Match Your Version

Author: Upstash | Tools: 2 | Setup: Zero-config (npx)

Two tools: library name resolution and documentation querying. Context7 indexes Rails, Hotwire (Turbo, Stimulus), and thousands of gems. Rails 7 introduced import maps and Hotwire. Rails 7.1 added normalizes and async queries. Rails 8 brought Solid Queue, Solid Cache, and Kamal. Each version shifts what "the Rails way" means.

Why use it

  • Get current Turbo Stream broadcast syntax instead of deprecated pre-1.0 patterns
  • Use normalizes and in_order_of when they exist in your Rails version
  • Get accurate Devise, Pundit, Sidekiq, or Shrine configuration for the versions in your Gemfile
  • Avoid suggesting outdated view helpers or routing methods

Configuration

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}

No API key required.

GitHub MCP -- Convention-Heavy PRs and CI Integration

Author: Anthropic | Tools: 20 | Requires: GitHub personal access token

Twenty tools covering the full GitHub workflow: repositories, pull requests, issues, branches, code search, and GitHub Actions. Rails PRs tend to be large -- a feature PR might include a migration, model, controller, views, system tests, and routes. For more details, see the GitHub MCP guide.

Why use it

  • Generate PR descriptions that cover migrations, models, controllers, view partials, routes, and system tests with Rails convention context
  • Retrieve CI failures from RuboCop, model tests, system tests, and security audits and identify the failing step
  • Diagnose flaky system tests by examining the test file for timing issues
  • Search across the codebase for every file related to a specific feature across Rails' many directories

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.

Playwright MCP -- System Tests That Write Themselves

Author: Microsoft | Tools: 20 | Setup: Zero-config (npx)

Twenty tools for full browser automation: navigation, accessibility snapshots, clicking, typing, form filling, viewport resizing, tab management, file uploads, dialog handling, screenshots, and JavaScript evaluation. For a comparison with the alternative, see Playwright vs Puppeteer MCP. For a detailed setup walkthrough, see the Playwright MCP guide.

Why use it

  • Walk through a multi-step wizard in a real browser, noting validation errors and rendering issues, before writing any tests
  • Generate Rails system tests with Capybara syntax based on actual browser observations
  • Verify Turbo Stream responses render correctly and within acceptable time
  • Test both happy path and edge cases discovered during interactive exploration in the same conversation

Configuration

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["-y", "@playwright/mcp"]
    }
  }
}

No API keys or environment variables. Launches a local browser on demand.


For the complete pre-configured stack, visit the Rails + Ruby Stack. If you are troubleshooting connection issues during setup, see how to fix MCP server connection errors.

Related Stacks

Related Servers