Skip to main content
Glama

MCP Server: SSH Rails Runner

by tadasant

MCP サーバー: SSH Rails ランナー

SSH経由でRailsコンソールコマンドを安全にリモート実行できるMCPサーバー。このサーバーは、デプロイされたRails環境において、読み取り専用操作と慎重に管理されたミューテーションの両方のためのツールを提供します。

これはCursorと非常に相性が良いです。Cursor Composerを使ってRailsモデルファイルをコンテキストとして読み込み、 execute_read_onlydry_run_mutateexecute_mutateツールを使ってデータベースに変更を加えることができます。データのラングリングや分析を行うために、複雑な管理UIを苦労して操作する必要はありません。

例

特徴

  • 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 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 (文字列、 prepareCodeSnippetからのfile:// URI)。
  • 機能: URI からコード スニペットを読み取り、それがreadOnlyとしてマークされていることを確認し、コードの安全性チェックを実行して実行します。
  • 戻り値: Rails コマンドの出力。

mcp_ssh_rails_runner_execute_code_snippet_mutate

  • 引数: uri (文字列、 prepareCodeSnippetからのfile:// 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.

読み取り専用操作、変更計画、デプロイされた Rails 環境での承認済み変更の実行のために、SSH 経由で Rails コンソール コマンドを安全にリモート実行できるようにします。

    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