console_executeLABSCO 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 loggedsafe_query— read-only database access with automatic result limiting; an optionalwherehash filters before the method runs, and the same applies tosum,average,minimum,maximum,pluckandexists?model_info— schema columns and constraints, associations, validations and available methods for a modeldry_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!andtest_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. Clients the installer does not configure itself, such as Claude Desktop and Windsurf, launch bin/rails-active-mcp-wrapper, which the installer creates and which starts the server from the Rails project root. 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
Follow the published steps — bundle install
USE CASES
Answering a data question against the real app
Run a read-only count or query through the model layer, with results capped so nothing dumps the table.
Checking what a model actually looks like
Pull columns, associations and validations instead of opening the schema file and three model classes.
Assessing a risky snippet before running it
Analyse the code for danger level and read the suggested alternative without executing it.
Running a one-off console command safely
Execute Ruby with a timeout and safety checks, and have the execution recorded in the audit log.
4 tools
Listed in project docs. Your client may show a different list.
model_infosafe_querydry_runBEFORE YOU INSTALL
What to know first
Tools you get
4 tools named in the project's documentation.
Requires
bundle on PATH
Where it runs
All 6 documented clients run the server on your machine.
INSTALLATION
Connect your client
Server setup
In your Rails application's Gemfile, add the line gem 'rails-active-mcp' (a Gemfile entry, not a shell command). Then run:
bundle install
rails generate rails_active_mcp:installMCP Clients
Claude Desktop
{
"mcpServers": {
"rails-active-mcp": {
"command": "<YOUR_PATH_TO_RAILS_PROJECT_BIN_RAILS>",
"args": [],
"env": {
"RAILS_ENV": "development"
}
}
}
}<YOUR_PATH_TO_RAILS_PROJECT_BIN_RAILS> is the full path of bin/rails-active-mcp-wrapper in your Rails app. bin/rails-active-mcp-wrapper is created by rails generate rails_active_mcp:install; it changes into the Rails root and loads your Ruby version manager before it starts the server, so no working-directory setting is needed. The installer prints this entry with your path filled in when you pick Claude Desktop.
Claude Code
{
"mcpServers": {
"rails-active-mcp": {
"command": "bundle",
"args": [
"exec",
"rails-active-mcp-server"
]
}
}
}GitHub Copilot in VS Code
{
"servers": {
"rails-active-mcp": {
"command": "bundle",
"args": [
"exec",
"rails-active-mcp-server"
],
"cwd": "${workspaceFolder}"
}
}
}Cursor
{
"mcpServers": {
"rails-active-mcp": {
"command": "<YOUR_PATH_TO_RAILS_PROJECT_BIN_RAILS>",
"args": [],
"env": {
"RAILS_ENV": "development"
}
}
}
}<YOUR_PATH_TO_RAILS_PROJECT_BIN_RAILS> is the full path of bin/rails-active-mcp-wrapper in your Rails app. bin/rails-active-mcp-wrapper is created by rails generate rails_active_mcp:install; it changes into the Rails root and loads your Ruby version manager before it starts the server, so no working-directory setting is needed. If you pick Cursor when the installer asks, it writes this entry to .cursor/mcp.json for you.
Windsurf
{
"mcpServers": {
"rails-active-mcp": {
"command": "<YOUR_PATH_TO_RAILS_PROJECT_BIN_RAILS>",
"args": [],
"env": {
"RAILS_ENV": "development"
}
}
}
}<YOUR_PATH_TO_RAILS_PROJECT_BIN_RAILS> is the full path of bin/rails-active-mcp-wrapper in your Rails app. bin/rails-active-mcp-wrapper is created by rails generate rails_active_mcp:install; it changes into the Rails root and loads your Ruby version manager before it starts the server, so no working-directory setting is needed. Add it to ~/.codeium/windsurf/mcp_config.json; the installer prints it with your path filled in when you pick Windsurf.
Zed
{
"context_servers": {
"rails-active-mcp": {
"command": {
"path": "bundle",
"args": [
"exec",
"rails-active-mcp-server"
],
"env": {}
}
}
}
}