Secure remote Rails command execution via SSH with read-only, dry-run, and mutation tools for safe data management
SSH Rails Runner is an MCP (Model Context Protocol) server designed to enable secure, remote execution of Ruby on Rails operations through an SSH interface. By leveraging this unique setup, developers and AI applications can interact with a deployed Rails environment from any location, executing both read-only commands and carefully managed mutative operations.
Developers can use the execute_read_only
, dry_run_mutate
, and execute_mutate
tools to perform data analysis, model validation, and other database-related tasks, all while minimizing potential security risks. This server works seamlessly with popular AI applications like Cursor, where users can leverage APIs or integrations to manage their Rails models directly.
SSH Rails Runner supports several key features that make it a valuable tool for AI applications:
Remote Rails Console Execution via SSH: Users and applications can execute Ruby on Rails commands from any machine with access to the remote server over an encrypted SSH connection.
Safe Read-Only Operations: The execute_read_only
feature allows developers and AI applications to query and retrieve data without making any permanent changes, ensuring data integrity.
Dry Run Capability for Mutations: Developers can use the dry_run_mutate
tool to plan and validate potential database mutations. This ensures that all proposed changes are safe before they are actually executed.
Execution of Approved Mutations: Once a mutation is validated through the dry run process, it can be executed using the execute_mutate
tool with explicit user approval.
Resource Management for Code Snippets: The server provides tools to manage code snippets, ensuring that all changes are tracked and controlled securely.
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
graph TD
client1(Claude Desktop) -->|MCP Client| protocol2(MCP Protocol)
client2(Continue) -->|MCP Client| protocol2
server3[MCP Server: SSH Rails Runner] -->|MCP Protocol| data_source4[Data Source/Tool]
style client1 fill:#e1f5fe
style server3 fill:#f3e5f5
style data_source4 fill:#e8f5e8
To install SSH Rails Runner, follow these steps:
npm install
npm run build
Once installed, configure the environment variables as follows:
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
Imagine you are working on a machine learning project that depends heavily on data accuracy. Using SSH Rails Runner, you can write queries to extract specific data points from your database for analysis. With Cursor, an AI application like Claude Desktop, you can set up read-only operations to ensure data integrity while performing complex analyses.
Suppose you need to optimize a machine learning model by tweaking its parameters. You can use the dry_run_mutate
tool to apply proposed changes without actually affecting your production environment. Once validated, these changes can be safely applied using execute_mutate
, ensuring that all modifications are thoroughly tested.
SSH Rails Runner is compatible with several MCP clients:
MCP Client | Resources (Read) | Tools (Mutate) | Prompts (Execution) | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
{
"mcpServers": {
"ssh-rails-runner": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/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"
}
}
}
}
How does the execute_read_only
tool work?
execute_read_only
feature runs Ruby on Rails console commands in a safe, non-mutative manner. This ensures that you can query your database for any necessary data without causing unintended side effects.What is the purpose of the dry_run_mutate
feature?
dry_run_mutate
tool allows developers to plan and validate potential mutations before applying them in a live environment. This helps prevent errors and ensures that only safe changes are made.Can I use this server with other AI applications besides Cursor?
How do I handle database mutations securely?
dry_run_mutate
tool. Once validated, explicit user approval is required for execution.What happens if an error occurs during execution?
If you are interested in contributing to this project, please follow these guidelines:
Explore the broader MCP ecosystem by visiting:
By leveraging SSH Rails Runner, developers and AI applications can enhance their workflows with secure, efficient, and well-integrated tools.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods