SSH MCP Remote

SSH MCP Remote

Enables remote command execution on SSH hosts (NAS, Linux, VPS) through an HTTP+SSE server, allowing users to run shell commands and receive results via the ssh.exec tool.

Category
Visit Server

README

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 風ツール呼び出し

/query の使い方

search ツール (ダミー)

curl -X POST http://localhost:8787/query \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "search",
    "query": "ssh"
  }'

返り値は ssh ツール 1 件だけを含むダミーのレスポンスです。

fetch ツール (ダミー)

curl -X POST http://localhost:8787/query \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "fetch",
    "id": "ssh"
  }'

search と同様のダミー応答を返します。

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

または usernameprivateKey も利用可能です:

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 されます。

ChatGPT MCP Remote Connector への登録例

実際の UI や設定方法は ChatGPT のバージョンによって異なります。ここでは概念的な例を示します。

  • Server URL (ローカル): http://localhost:8787
  • SSE Endpoint: /sse
  • Query Endpoint: /query

Remote MCP Connector の設定画面が以下のような項目を要求する場合:

  • Base URL: http://localhost:8787
  • SSE Path: /sse
  • Query Path: /query

と設定すれば、このサーバーが Remote MCP として機能します。

クラウド (Replit / Render) にデプロイした場合の URL 例

Replit や Render にこのプロジェクトをデプロイした場合、ベース URL は以下のようになります。

  • Base URL (Render): https://ssh-mcp-remote.onrender.com (サービス名に応じて変わります)
  • Base URL (Replit): https://your-repl-name.your-username.repl.co
  • SSE Path: /sse
  • Query Path: /query

ChatGPT MCP Remote Connector 側では、上記の Base URL とパスを指定してください。

例: Render に ssh-mcp-remote という名前でデプロイした場合:

  • Base URL: https://ssh-mcp-remote.onrender.com
  • SSE Path: /sse
  • Query Path: /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 側で扱えるようになります。

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured