Secure remote Rails command execution via SSH with safe read-only and mutation tools
The SSH Rails Runner MCP Server is a specialized implementation of the Model Context Protocol (MCP) designed to provide secure remote execution capabilities for Rails console commands via SSH. This server serves as an essential bridge between various AI applications and their targeted Rails environments, enabling read-only operations and carefully managed mutations in deployed applications.
The SSH Rails Runner MCP Server offers a robust set of features that align with the Model Context Protocol (MCP) standards. Key capabilities include:
By adhering to MCP standards, this server ensures compatibility and interoperability with a variety of AI applications, making it an indispensable tool in modern software development workflows.
The SSH Rails Runner MCP Server follows the MCP standard for enabling secure data access and manipulation. The protocol flow diagram illustrates the process:
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
The compatibility matrix details the supported AI applications and their features:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
To get started, follow these steps:
Install Dependencies: Run the following commands to set up your environment.
npm install
npm run build
Set Environment Variables: Configure the necessary environment variables for SSH and Rails environment access.
export SSH_HOST=your.remote.host
export SSH_USER=your_ssh_user
export SSH_PRIVATE_KEY_PATH=your_SSH_PRIVATE_KEY_PATH
export RAILS_WORKING_DIR=/path/to/rails/app
In typical AI workflows, the SSH Rails Runner MCP Server can be used to:
Imagine you are using the SSH Rails Runner MCP Server in conjunction with Claude Desktop. You can leverage Model Context Protocol (MCP) to run complex SQL queries, perform data filtering, and analyze logs on a remote Rails environment. This setup allows developers to keep all code changes under review before deploying any modifications.
For AI models that require frequent updates, the SSH Rails Runner MCP Server enables safe mutation operations such as updating machine learning parameters or training datasets. Users can use tools like execute_mutate
for controlled deployment of these changes, ensuring they have the latest model configurations.
To integrate the SSH Rails Runner MCP Server with AI applications, add it to your configuration file following this example:
{
"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"
}
}
}
}
The following matrix provides a structured understanding of performance and compatibility:
MCP Client | Compatibility |
---|---|
Claude Desktop | Full |
Continue | Full |
Cursor | Limited |
Incompatibilities with some clients (like Cursor) are due to restricted support for certain features, ensuring that the SSH Rails Runner MCP Server remains a versatile tool for AI workflows.
The server uses a Prepare -> Execute workflow:
execute读-only
: Safely executes pre-verified Ruby code.execute_mutate
: Directly executes user-approved mutation commands.execute_mutate
tool. The responsibility lies fully with the user and calling AI application.You can define multiple MCP servers in your configuration file by adding additional entries under "mcpServers".
execute_read_only
and execute_mutate
commands?execute_read_only
enables safe data exploration without modifications. execute_mutate
allows direct database changes, but only after a user has verified the code.
Yes, while primary compatibility is tested for Cursor and Continue, this server should generally be compatible with any MCP-compatible client.
Version control isn't directly managed by the server but can be integrated using Git or similar tools to track changes on both local and remote environments.
There are no predefined limits, but best practices recommend managing session length and resource usage for efficient performance.
Contributions to the SSH Rails Runner MCP Server are welcome. To contribute:
Developers can enhance this server by adding new features, optimizing current tools, or improving security measures.
Explore more about Model Context Protocol (MCP) through these resources:
By integrating the SSH Rails Runner MCP Server into your development workflow, you can leverage powerful AI applications while maintaining data security and integrity in your Rails environments.
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