Are you the author? Sign in to claim
ssh-mcp-remote
Remote MCP-style HTTP+SSE server that exposes simple tools including ssh.exec for executing commands on remote hosts over SSH.
Node.js + Express による HTTP サーバー
MCP Remote Connector から利用できるような形で、以下の 2 エンドポイントを提供します:
GET /sse : サーバーからのイベントを受け取るための SSE ストリームPOST /query: MCP 風のツール呼び出し (search, fetch, ssh.exec)レスポンスは MCP 互換の形に近づけるため、必ず次の形を返します:
{
"content": [
{ "type": "text", "text": "<JSON文字列>" }
]
}
text フィールド内に、実際の JSON オブジェクトを文字列化したものが入ります。
リポジトリのルート (ghostfolio) で依存をインストールします。
cd ssh-mcp-remote
npm install
cd ssh-mcp-remote
npm start
デフォルトではポート 8787 で起動します。Replit や Render などのホスティング環境では、環境変数 PORT が自動的に付与されるため、それを利用してリッスンします。
起動後:
http://localhost:8787/ : ヘルスチェック用の簡単な JSON レスポンスhttp://localhost:8787/sse: SSE ストリーム (ブラウザや MCP Remote Connector が接続)POST http://localhost:8787/query: MCP 風ツール呼び出しcurl -X POST http://localhost:8787/query \
-H "Content-Type: application/json" \
-d '{
"tool": "search",
"query": "ssh"
}'
返り値は ssh ツール 1 件だけを含むダミーのレスポンスです。
curl -X POST http://localhost:8787/query \
-H "Content-Type: application/json" \
-d '{
"tool": "fetch",
"id": "ssh"
}'
search と同様のダミー応答を返します。
curl -X POST http://localhost:8787/query \
-H "Content-Type: application/json" \
-d '{
"tool": "ssh.exec",
"args": {
"host": "192.168.0.x",
"user": "mizuki",
"password": "your-password",
"command": "ls -la"
}
}'
または username や privateKey も利用可能です:
curl -X POST http://localhost:8787/query \
-H "Content-Type: application/json" \
-d '{
"tool": "ssh.exec",
"args": {
"host": "192.168.0.x",
"username": "mizuki",
"privateKey": "C:/Users/you/.ssh/id_rsa",
"command": "uname -a"
}
}'
レスポンスの content[0].text 内には、次のような JSON 文字列が入ります:
{
"host": "192.168.0.x",
"user": "mizuki",
"command": "ls -la",
"stdout": "...",
"stderr": "...",
"code": 0,
"error": null
}
同時に、SSE に接続しているクライアントには type: "ssh.exec.result" のイベントとして同じ内容が PUSH されます。
実際の UI や設定方法は ChatGPT のバージョンによって異なります。ここでは概念的な例を示します。
http://localhost:8787/sse/queryRemote MCP Connector の設定画面が以下のような項目を要求する場合:
http://localhost:8787/sse/queryと設定すれば、このサーバーが Remote MCP として機能します。
Replit や Render にこのプロジェクトをデプロイした場合、ベース URL は以下のようになります。
https://ssh-mcp-remote.onrender.com (サービス名に応じて変わります)https://your-repl-name.your-username.repl.co/sse/queryChatGPT MCP Remote Connector 側では、上記の Base URL とパスを指定してください。
例: Render に ssh-mcp-remote という名前でデプロイした場合:
https://ssh-mcp-remote.onrender.com/sse/query# セットアップ
cd ssh-mcp-remote
npm install
# 起動
npm start
# 動作確認 (例: ssh.exec)
curl -X POST http://localhost:8787/query \
-H "Content-Type: application/json" \
-d '{
"tool": "ssh.exec",
"args": {
"host": "192.168.0.x",
"user": "mizuki",
"password": "your-password",
"command": "ls -la"
}
}'
この構成を元に、ChatGPT MCP Remote Connector から ssh.exec を呼び出せば、NAS や Linux/VPS 上でコマンドを実行し、その結果を ChatGPT 側で扱えるようになります。
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
Google's universal MCP server supporting PostgreSQL, MySQL, MongoDB, Redis, and 10+ databases
Official GitHub integration for repos, issues, PRs, and CI/CD workflows