MCP Server: SSH Rails Runner

by tadasant

14 stars
241 downloads
Not rated
GitHub

About

MCP server that facilitates an SSH connection to a deployed Rails app so you can run Rails REPL commands

Details

Author
tadasant
GitHub stars
14
Downloads
241
Categories
Developer Tools, Other, Database

- Remote Rails console execution over SSH
- Safe read-only operations with safety checks
- Dry-run capability for mutations
- Prepare—Execute workflow for code snippets
- Resource management for saved code snippets

Install with npm install && npm run build, then configure environment variables SSH_HOST, SSH_USER, SSH_PRIVATE_KEY_PATH, and RAILS_WORKING_DIR. Optionally set PROJECT_NAME_AS_CONTEXT and CODE_SNIPPET_FILE_DIRECTORY. Add the server to Claude Desktop configuration using the npx mcp-server-ssh-rails-runner command. Use the three provided tools: prepare_code_snippet to save and review Ruby code, execute_code_snippet_read_only for safe read-only operations, and execute_code_snippet_mutate for approved mutations.

An MCP server that enables secure remote execution of Rails console commands via SSH. This server provides tools for both read-only operations and carefully managed mutations in a deployed Rails environment.

This works great with Cursor. You can use Cursor Composer to pull in your Rails model files as context and then use theexecute_read_only,dry_run_mutate, andexecute_mutatetools to make changes to the database. No need to trudge through complicated Admin UI's to get your data wrangling and analysis done.

- Remote Rails console execution over SSH
- Safe read-only operations
- Dry-run capability for mutations
- Execution of approved mutations
- Resource management for code snippets

Set the following environment variables:

SSH_HOST=your.remote.host SSH_USER=your_ssh_user SSH_PRIVATE_KEY_PATH=your_SSH_PRIVATE_KEY_PATH RAILS_WORKING_DIR=/path/to/rails/app

Add to your Claude Desktop configuration:

{ "mcpServers": { "ssh-rails-runner": { "command": "npx", "args": ["mcp-server-ssh-rails-runner"], "env": { "SSH_HOST": "your.remote.host", "SSH_USER": "your_ssh_user", "SSH_PRIVATE_KEY_PATH": "your_SSH_PRIVATE_KEY_PATH", "RAILS_WORKING_DIR": "/path/to/rails/app/root", "PROJECT_NAME_AS_CONTEXT": "Name that shows up in tool descriptions to help the LLM describe what kind of Rails project we're working with.", "CODE_SNIPPET_FILE_DIRECTORY": "/path/to/store/code/snippets/locally" } } } }

IfCODE_SNIPPET_FILE_DIRECTORYis not provided, snippets will be stored in a temporary directory (e.g.,/tmp/mcp-ssh-rails-runner-code-snippets).PROJECT_NAME_AS_CONTEXTis optional and helps identify the project context in tool descriptions.

The server now uses a Prepare -> Execute workflow:

mcp_ssh_rails_runner_prepare_code_snippet

- Arguments:name(string, for filename),type(enum: "readOnly" | "mutate"),code(string, Ruby code),description(string, optional).
- Function: Saves the provided Ruby code to a local file namedcode_snippet_<name>.json, marks it as read-only or mutate, and opens the file for review.
- Returns: Thefile://URI of the created snippet.

mcp_ssh_rails_runner_execute_code_snippet_read_only

- Arguments:uri(string,file://URI fromprepareCodeSnippet).
- Function: Reads the code snippet from the URI, verifies it's marked asreadOnly, performs a safety check on the code, and executes it.
- Returns: The output of the Rails command.

mcp_ssh_rails_runner_execute_code_snippet_mutate

- Arguments:uri(string,file://URI fromprepareCodeSnippet).
- Function:DANGER ZONE!Reads the code snippet, verifies it's marked asmutate, andexecutes it directly. There is no dry run or further safety check within this tool.
- Returns: The output of the Rails command.
- Usage:ONLY CALL THIS AFTER THE USER HAS REVIEWED the prepared code (via the opened file fromprepareCodeSnippet) AND EXPLICITLY CONFIRMED they want to execute the mutation.

- Only use with trusted SSH endpoints from your own local machine that is (temporarily) provided access to the remote environment.
- Crucially, always review the code saved byprepareCodeSnippetbefore executing any mutation withexecuteCodeSnippetMutate.The responsibility for confirming mutations lies with the user and the calling AI.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

The official developer experience MCP Server for Amazon DynamoDB. This server provides DynamoDB expert design guidance and data modeling assistance.

An MCP server for interacting with SAP systems using ABAP Development Tools (ADT).

Edit Android preferences using adb and Node.js.

Hosted MCP server and coordination layer for AI coding agents — live API contracts, database schema, frontend/backend mismatch detection, and shared handoff tickets for Claude Code, Cursor, Codex, and Lovable.

Execute shell commands without permission prompts.

Execute bash commands on the host machine.

Execute shell commands with structured output via a powerful CLI server.

A secure MCP server for executing controlled command-line operations with comprehensive security features.

MCP server for controlling cmux (Ghostty-based terminal) via native CLI. Send commands, read output, send control characters — all in background via Unix socket.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.