mcp_ssh_rails_runner_prepare_code_snippetLABSCO SUMMARY
An agent can do the data fix on production without an admin screen.
The prepare-then-execute split is the design: code lands in a file you can read, marked read-only or mutating, and only then runs against the deployed console. Pull your model files in as context first and the query it writes will match your schema.
What it is
A remote Rails console over SSH, split into a prepare step and an execute step. Code is saved to a local file, marked read-only or mutating, and opened for review; execution then takes that file's URI — so nothing reaches the server until you have seen it.
What you get
- Ruby code saved as a reviewable snippet, typed read-only or mutate, and opened for you to read
- A read-only snippet executed against the deployed Rails console over SSH
- A prepared mutating snippet executed once you are satisfied with it
- Snippets stored in a directory you nominate, or a temporary one by default
- A project name carried into the tool descriptions, so the model knows which Rails app it is working on
Requirements
SSH access to the host — hostname, user and a private key path — plus the Rails working directory on that machine, all in the client config. Whatever your Rails console can do on that host, these calls can do.
Setup effort
One command plus credentials — npx mcp-server-ssh-rails-runner, then supply credentials
USE CASES
Answering a data question about production
Have the query written to a read-only snippet, read it, then run it against the deployed console and take the numbers back.
Checking what a fix would touch before running it
Prepare the change as a read-only version first — count the rows it would hit — before preparing the mutation itself.
Making the correction once it looks right
Execute the snippet marked as a mutation, against the file you already reviewed rather than against fresh code.
Doing data wrangling without building an admin UI
Write the one-off script, review it, run it — instead of shipping a screen that exists for a single afternoon.
3 tools
Listed in project docs. Your client may show a different list.
mcp_ssh_rails_runner_execute_code_snippet_read_onlymcp_ssh_rails_runner_execute_code_snippet_mutateBEFORE YOU INSTALL
What to know first
Tools you get
3 tools named in the project's documentation.
Requires
npx on PATH
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
Server setup
npx mcp-server-ssh-rails-runnerMCP Clients
Claude Desktop
{
"mcpServers": {
"ssh-rails-runner": {
"command": "npx",
"args": [
"mcp-server-ssh-rails-runner"
],
"env": {
"SSH_HOST": "<YOUR_SUBDOMAIN>.remote.host",
"SSH_USER": "<YOUR_SSH_USER>",
"SSH_PRIVATE_KEY_PATH": "<YOUR_SSH_PRIVATE_KEY_PATH>",
"RAILS_WORKING_DIR": "<YOUR_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": "<YOUR_CODE_SNIPPET_FILE_DIRECTORY>"
}
}
}
}SSH_HOST is the server your Rails app is deployed on, SSH_USER the SSH user there, SSH_PRIVATE_KEY_PATH the path on this machine to that user's private key, and RAILS_WORKING_DIR the app's directory on the remote host. PROJECT_NAME_AS_CONTEXT is optional: it is a short name for your project (it shows up in the tool descriptions) or delete the line. CODE_SNIPPET_FILE_DIRECTORY is optional too; without it, snippets go to a temporary directory.