Skip to main content
Glama

MCP Server: SSH Rails Runner

by tadasant

MCP 服务器:SSH Rails Runner

一个 MCP 服务器,支持通过 SSH 安全地远程执行 Rails 控制台命令。该服务器提供用于在已部署的 Rails 环境中执行只读操作和精心管理的变更的工具。

这非常适合 Cursor。您可以使用 Cursor Composer 导入 Rails 模型文件作为上下文,然后使用execute_read_onlydry_run_mutateexecute_mutate工具对数据库进行更改。无需费力地浏览复杂的管理界面即可完成数据整理和分析。

例子

例子

特征

  • 通过 SSH 执行远程 Rails 控制台
  • 安全的只读操作
  • 突变的试运行能力
  • 执行已批准的突变
  • 代码片段的资源管理

安装

npm install npm run build

配置

设置以下环境变量:

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

与 Claude Desktop 一起使用

添加到您的 Claude Desktop 配置:

{ "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" } } } }

如果未提供CODE_SNIPPET_FILE_DIRECTORY ,代码片段将存储在临时目录中(例如, /tmp/mcp-ssh-rails-runner-code-snippets )。 PROJECT_NAME_AS_CONTEXT是可选的,有助于在工具描述中识别项目上下文。

可用工具

服务器现在使用准备->执行工作流程:

mcp_ssh_rails_runner_prepare_code_snippet

  • 参数name (字符串,用于文件名)、 type (枚举:“readOnly”|“mutate”)、 code (字符串,Ruby 代码)、 description (字符串,可选)。
  • 功能:将提供的 Ruby 代码保存到名为code_snippet_<name>.json的本地文件中,将其标记为只读或变异,然后打开该文件进行审查。
  • 返回:所创建片段的file:// URI。

mcp_ssh_rails_runner_execute_code_snippet_read_only

  • 参数uri (字符串,来自prepareCodeSnippetfile:// URI)。
  • 功能:从 URI 读取代码片段,验证其是否标记为readOnly ,对代码执行安全检查,然后执行它。
  • 返回:Rails 命令的输出。

mcp_ssh_rails_runner_execute_code_snippet_mutate

  • 参数uri (字符串,来自prepareCodeSnippetfile:// URI)。
  • 功能危险区域!读取代码片段,验证其是否标记为mutate ,并直接执行。此工具没有试运行或其他安全检查。
  • 返回:Rails 命令的输出。
  • 用法仅在用户查看了准备好的代码(通过prepareCodeSnippet打开的文件)并明确确认他们想要执行变异后才调用此方法。

安全注意事项

  • 仅与您自己的本地计算机(临时)提供对远程环境的访问权限的受信任的 SSH 端点一起使用。
  • **至关重要的是,在使用executeCodeSnippetMutate执行任何修改之前,务必检查prepareCodeSnippet保存的代码。**确认修改的责任在于用户和调用方 AI。

执照

麻省理工学院

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

支持通过 SSH 安全地远程执行 Rails 控制台命令,以进行只读操作、变异规划以及在已部署的 Rails 环境中执行已批准的更改。

  1. 例子
    1. 特征
      1. 安装
        1. 配置
          1. 与 Claude Desktop 一起使用
            1. 可用工具
              1. mcp_ssh_rails_runner_prepare_code_snippet
              2. mcp_ssh_rails_runner_execute_code_snippet_read_only
              3. mcp_ssh_rails_runner_execute_code_snippet_mutate
            2. 安全注意事项
              1. 执照

                Related MCP Servers

                • A
                  security
                  A
                  license
                  A
                  quality
                  A secure shell command execution server implementing the Model Context Protocol (MCP). This server allows remote execution of whitelisted shell commands with support for stdin input.
                  Last updated -
                  1
                  74
                  Python
                  MIT License
                  • Apple
                • A
                  security
                  A
                  license
                  A
                  quality
                  A secure server for executing terminal commands within predefined paths, allowing safe interaction by Large Language Models with operating system environments.
                  Last updated -
                  1
                  11
                  3
                  JavaScript
                  MIT License
                  • Apple
                  • Linux
                • A
                  security
                  A
                  license
                  A
                  quality
                  A secure terminal execution server that enables controlled command execution with security features and resource limits via the Model Context Protocol (MCP).
                  Last updated -
                  1
                  12
                  1
                  JavaScript
                  MIT License
                  • Apple
                • -
                  security
                  F
                  license
                  -
                  quality
                  A secure SSH server implementation for Model Context Protocol that enables remote command execution and file operations, supporting both password and key-based authentication.
                  Last updated -
                  8
                  TypeScript

                View all related MCP servers

                MCP directory API

                We provide all the information about MCP servers via our MCP API.

                curl -X GET 'https://glama.ai/api/mcp/v1/servers/tadasant/mcp-server-ssh-rails-runner'

                If you have feedback or need assistance with the MCP directory API, please join our Discord server