Remote MCP SSH Gateway

MIT License
3
  • Linux
  • Apple

Integrations

  • Provides access to MLB Stats API tools for retrieving and analyzing baseball statistics

MCP サーバー SSH クライアント

SSH経由でリモートMCPサーバーに接続するモデルコンテキストプロトコルサーバー(リモートSSHクライアント)。このクライアントは、リモートサーバーでホストされているMCPツールへのアクセスと利用を可能にし、MCP通信のための安全なチャネルを提供します。

特徴

  • SSH経由で任意のMCPサーバーに接続します
  • すべてのMCPプロトコルコマンドを安全なSSHチャネル経由でプロキシする
  • キーベースの認証のサポート
  • ツール、プロンプト、リソースを含む MCP 機能のサポート

インストール

uv管理 Python プロジェクトでは、次のように依存関係を追加します。

uv add m2m-mcp-server-ssh-client

あるいは、依存関係にpipを使用するプロジェクトの場合:

pip install m2m-mcp-server-ssh-client

ソースから直接インストールするには:

git clone https://github.com/Machine-To-Machine/m2m-mcp-server-ssh-client.git cd m2m-mcp-server-ssh-client pip install -e .

プロジェクト内でサーバーを実行するには:

uv run m2m-mcp-server-ssh-client

一般的な使用例

1. デモサーバーを使ったクイックスタート

様々なMCPツールが設定済みですぐに使える公開デモサーバーを運用しています。(このサーバーは、オープンな分散型レジストリをリリースするまでご利用いただけます。)

このデモ サーバーには、HackerNews、MLB Stats API、Formula 1 API ツールなど、実験に使用できる複数の MCP サーバーが含まれています。

クロード

Claude をこのサーバーに接続するには、Claude デスクトップ設定に以下を追加するだけです。

"mcpServers": { "remote-mcp-tools": { "command": "uvx", "args": [ "m2m-mcp-server-ssh-client", "--host", "mcp-beta.machinetomachine.ai", "--port", "8022", "--use-key-server" ] } }
コマンドライン
# Connect to the M2M public demo server with automatic key exchange uv run m2m-mcp-server-ssh-client --host mcp-beta.machinetomachine.ai --use-key-server

2. ローカル開発テスト

独自の SSH サーバーを設定するには、 m2m-mcp-server-ssh-serverを参照してください。

独自の MCP ツールを使用したローカルテストの場合:

# Connect to a local MCP SSH server uv run m2m-mcp-server-ssh-client

上記のコマンドは、ポート 8022 でリッスンしているローカル SSH サーバーに接続しようとします。

ローカルでテストする場合は、キー サーバーを使用することでキー交換を簡素化できます。

# Use the key server for automatic key management (if server has --run-key-server enabled) uv run m2m-mcp-server-ssh-client --use-key-server

上記のコマンドは、ポート 8000 で実行されているキー サーバーの使用を試みます。

3. リモートサーバー接続

独自にホストされた MCP サーバーに接続します。

# Using existing SSH keys uv run m2m-mcp-server-ssh-client --host your-server.example.com --client-key ~/.ssh/your_key --known-hosts ~/.ssh/known_hosts

リモート サーバーでキー サーバーを実行し、クライアントで構成することで、キー交換を簡素化できます。

AI プラットフォームでの使用

クロードデスクトップ統合

Claude デスクトップの設定に以下を追加します:

"mcpServers": { "remote-mcp-tools": { "command": "uvx", "args": [ "m2m-mcp-server-ssh-client", "--host", "mcp-beta.machinetomachine.ai", "--port", "8022", "--use-key-server" ] } }

MCP検査官

デバッグや利用可能なツールの調査:

npx @modelcontextprotocol/inspector -- uvx m2m-mcp-server-ssh-client --host mcp-beta.machinetomachine.ai --port 8022 --use-key-server

使用法

コマンドラインオプション

  • --host : リモートSSHサーバーホスト(デフォルト: "localhost")
  • --port : リモートSSHサーバポート(デフォルト: 8022)
  • --username : SSHユーザー名 (デフォルト: "mcp")
  • --client-key : クライアント秘密鍵ファイル (デフォルト: "~/.ssh/m2m_mcp_server_ssh_client")
  • --known-hosts : 既知のホストファイルへのパス(デフォルト: "~/.ssh/known_hosts")
  • --passphrase : 秘密鍵のパスフレーズ(デフォルト: なし)
  • --disable-host-key-checking : サーバー署名の検証をスキップする (デフォルト: False)
  • --log-level : ログレベルを設定する (デフォルト: INFO)

詳細な例

リモートサーバーへの基本接続

ポート 8022 で実行されているリモート MCP サーバー (SSH サーバー) に接続します。

uvx m2m-mcp-server-ssh-client --host mcp.example.com

カスタムSSHキーの使用

認証用の特定の SSH キーを指定します。

uvx m2m-mcp-server-ssh-client --host mcp.example.com --client-key ~/.ssh/mcp_custom_key

キーがパスフレーズで保護されている場合:

uvx m2m-mcp-server-ssh-client --host mcp.example.com --client-key ~/.ssh/mcp_custom_key --passphrase "your-passphrase"

トラブルシューティングのためのデバッグモード

接続の問題のトラブルシューティングのために詳細なログ記録を有効にします。

uvx m2m-mcp-server-ssh-client --host mcp.example.com --log-level DEBUG

キーサーバーの統合

MCP SSH クライアントは、動的なキー交換と検証のためにキー サーバーを使用できます。

uvx m2m-mcp-server-ssh-client --host mcp.example.com --use-key-server

キーサーバーを使用する場合:

  1. クライアントはhttp://host:key-server-port/server_pub_keyからサーバーの公開鍵を取得します。
  2. クライアントはhttp://host:key-server-port/registerで公開鍵をサーバーに登録します。
  3. SSH接続用に一時的なknown_hostsファイルが作成されます

この機能は--known-hostsおよび--disable-host-key-checkingとは排他的です。

ホストキーのチェックを無効にする

⚠️ セキュリティ警告--disable-host-key-checkingを使用すると、接続が中間者攻撃に対して脆弱になります。このオプションは、信頼できるネットワーク内、または開発/テスト目的でのみ使用してください。

uvx m2m-mcp-server-ssh-client --host localhost --disable-host-key-checking

Claudeデスクトップ用の設定

Claude 設定に追加:

"mcpServers": { "remote-servers": { "command": "uvx", "args": [ "m2m-mcp-server-ssh-client", "--host", "example.com", "--port", "8022", "--username", "mcp" ] } }

特定のキーを使用したより安全な構成の場合:

"mcpServers": { "remote-servers": { "command": "uvx", "args": [ "m2m-mcp-server-ssh-client", "--host", "mcp-server.example.com", "--port", "8022", "--username", "claude-mcp", "--client-key", "~/.ssh/claude_mcp_key", "--known-hosts", "~/.ssh/mcp_remote_server" ] } }

仕組み

MCP Server SSHクライアントは、MCPツール用のMCP Server SSH Server m2m-mcp-server-ssh-server実行しているリモートサーバーへのSSH接続を確立します。その後、以下の処理を実行します。

  1. リモート MCP サーバーの機能をミラーリングするローカル プロキシ サーバーを作成します。
  2. すべてのMCPリクエストをSSH接続を介してリモートサーバーに転送します。
  3. リモートサーバーからの応答をローカルクライアントに返します

これにより、リモート マシンで実行されているツールを、ローカルにインストールされているかのように使用できるようになります。

認証フロー

セキュリティに関する考慮事項

  • 実稼働環境では常にホストキー検証を使用する
  • セキュリティを強化するためにパスフレーズで保護されたSSHキーを使用する
  • MCP接続には専用のSSHキーの使用を検討してください
  • SSHキーファイルに適切な権限(600)を設定します
  • リモートサーバー上で、権限が制限された専用のユーザーを使用する

一般的な問題のトラブルシューティング

接続拒否

Error running MCP SSH client: [Errno 111] Connection refused

解決策: ホストとポートが正しいこと、および SSH サービスが実行されていることを確認します。

認証失敗

Error running MCP SSH client: Authentication failed

解決策:キーファイルのパスを確認してください。リモートサーバーに公開鍵がインストールされていることを確認してください。

ホストキーの検証に失敗しました

Error running MCP SSH client: Host key verification failed

解決策: ホスト キーをknown_hosts ファイルに追加するか、 --disable-host-key-checking (テストのみ) を使用します。

依存関係

  • anyio (>=4.5.0)
  • asyncssh (>=2.20.0)
  • mcp (>=1.1.3)
  • ピダンティック (>=2.0.0)

発達

開発環境のセットアップ

git clone https://github.com/Machine-To-Machine/m2m-mcp-server-ssh-client.git cd m2m-mcp-server-ssh-client uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate uv pip install -e ".[dev]"

コード品質

# Run linting uv run ruff check . # Run formatting check uv run ruff format --check . # Run security checks uv run bandit -r src/

デバッグ

MCP インスペクタを使用してクライアントをデバッグできます。

npx @modelcontextprotocol/inspector uvx m2m-mcp-server-ssh-client --host example.com

高度なデバッグを行うには、次のワークフローを使用します。

  1. --log-level DEBUGでクライアントを起動します
  2. SSH接続パラメータとハンドシェイクプロセスを確認する
  3. カスタムキーを使用する場合は、正しいパスと権限を確認してください
  4. まず基本的な接続をテストするためにssh -vを直接使用します

貢献

m2m-mcp-server-ssh-client拡張と改善のための貢献を歓迎します。新機能の追加、既存機能の強化、ドキュメントの改善など、皆様からのご意見は大変貴重です。

プルリクエストは大歓迎です!新しいアイデア、バグ修正、機能強化など、お気軽にご投稿ください。

寄稿ガイドライン

  1. リポジトリをフォークする
  2. 機能ブランチを作成する: git checkout -b feature-name
  3. 変更をコミットします: git commit -am 'Add some feature'
  4. ブランチにプッシュ: git push origin feature-name
  5. プルリクエストを送信する

ライセンス

MIT ライセンス - 詳細については LICENSE ファイルを参照してください。

著者

  • マシンツーマシン
-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

m2m-mcp-server-ssh-client は、MCP サーバーを統合する統合 MCP サーバーインターフェースを提供し、MCP サーバーを集約する m2m-mcp-server-ssh-server バックエンドに SSH 経由で安全に接続します。このセットアップにより、堅牢な SSH キーベース認証を使用して、多様なリモートツールへの安全な単一アクセスが可能になります。

  1. Features
    1. Installation
      1. Common Use Cases
        1. 1. Quick Start with Demo Server
        2. 2. Local Development Testing
        3. 3. Remote Server Connection
      2. Usage with AI Platforms
        1. Claude Desktop Integration
        2. MCP Inspector
      3. Usage
        1. Command Line Options
      4. Detailed Examples
        1. Basic Connection to a Remote Server
        2. Using a Custom SSH Key
        3. Debug Mode for Troubleshooting
        4. Key Server Integration
        5. Disabling Host Key Checking
        6. Configure for Claude Desktop
      5. How It Works
        1. Authentication Flow
      6. Security Considerations
        1. Troubleshooting Common Issues
          1. Connection Refused
          2. Authentication Failure
          3. Host Key Verification Failed
        2. Dependencies
          1. Development
            1. Setup Development Environment
            2. Code Quality
          2. Debugging
            1. Contributing
              1. Contribution Guidelines
            2. License
              1. Authors

                Related MCP Servers

                • A
                  security
                  A
                  license
                  A
                  quality
                  An MCP server that enables secure terminal command execution, directory navigation, and file system operations through a standardized interface for LLMs.
                  Last updated -
                  10
                  23
                  Python
                  MIT License
                  • Apple
                • -
                  security
                  A
                  license
                  -
                  quality
                  A secure MCP (Model Context Protocol) server hosted on Google Cloud Run that enables team collaboration by providing authenticated access via Google Cloud IAM, allowing teams to share custom MCP servers over the internet before official MCP authentication is implemented.
                  Last updated -
                  16
                  TypeScript
                  MIT License
                • -
                  security
                  F
                  license
                  -
                  quality
                  A personal MCP server for securely storing and accessing API keys across projects using the macOS Keychain, letting AI assistants and applications retrieve credentials through natural language.
                  Last updated -
                  10
                  TypeScript
                  • Apple
                • -
                  security
                  F
                  license
                  -
                  quality
                  A server that enables remote command execution over SSH through the Model Context Protocol (MCP), supporting both password and private key authentication.
                  Last updated -
                  JavaScript

                View all related MCP servers

                ID: n9j5lavce3