Labsco
MCP SERVER

Rails Active MCP

by GoodPie

Rails console access for AI agents, with safety checks, read-only queries and a dry-run analyser.

Sandboxed Code Execution
Summary
The console, with the guardrails you would want on a shared one.

The safety model is the product: `dry_run` lets you ask "what would this do" before anything runs, `safe_query` gives real data access with no write path, and safe mode blocks the classes of statement that ruin a database. The author is upfront that this is a personal project under active development — treat production use as a decision, not a default.

What it is

A Ruby gem that exposes a Rails application's console over MCP, built on the official MCP Ruby SDK. It loads your Rails app, then offers four tools with dangerous-operation detection, timeouts and audit logging in front of them.

What you get
  • `console_execute` — run Ruby with safety checks, a configurable timeout, and every execution logged
  • `safe_query` — read-only database access with automatic result limiting; an optional `where` hash filters before the method runs, and the same applies to `sum`, `average`, `minimum`, `maximum`, `pluck` and `exists?`
  • `model_info` — schema columns and constraints, associations, validations and available methods for a model
  • `dry_run` — categorise code by danger level and suggest safer alternatives without ever executing it
  • Blocked outright: mass deletions, system commands, file operations, raw SQL execution, code evaluation and process manipulation, graded critical, high, medium and low
  • Environment presets — `production_mode!`, `development_mode!` and `test_mode!` set the safety posture in one line
Requirements

A Rails application. Add `gem 'rails-active-mcp'` to the Gemfile, `bundle install`, then `rails generate rails_active_mcp:install` — the installer writes an initializer, server scripts, and the project-level config files for whichever MCP clients you select, so the server is detected when you open the project. Manual clients use STDIO with the command `bundle exec rails-active-mcp-server` and the Rails project root as the working directory. Configuration lives in `config/initializers/rails_active_mcp.rb`, covering `safe_mode`, `command_timeout`, `max_results`, `allowed_models`, custom safety patterns and audit logging. MIT.

Setup effort

Build from source — clone the repository and build it, then point your client at the binary