Skip to main content
Glama

Remote Demo MCP

rsyncを使用して、ビルド済みの静的ディレクトリをリモートホストにデプロイするローカルMCPサーバーです。

機能

  • MCP設定の固定deployUserを使用

  • localDirのベース名からprojectを導出

  • localDirの内容を以下にアップロード:

    • /var/www/html/demo-remote/{user}/{project}/

  • ローカルのrsyncコマンドを使用

  • rsyncセッションを/dev/ttyにアタッチすることで、OTP/対話型SSHフローをサポート

  • 失敗した場合は、ユーザーがキャンセルするまで再試行するかどうかを尋ねる

Related MCP server: nomad

インストール

npm install
npm run build

設定

デフォルトの設定パス:

  • ~/.config/remote-demo-mcp/config.json

パスを上書きする場合:

  • REMOTE_DEMO_MCP_CONFIG=/abs/path/config.json

例:

{
  "deployUser": "demo_user-01",
  "publicBaseUrl": "https://example.com",
  "sessionLog": {
    "enabled": false,
    "path": "/tmp/remote-demo-mcp-session.log",
    "logInputValue": false
  },
  "ssh": {
    "host": "xxx.xxx.xxx.xxx",
    "port": 2222,
    "username": "alice123#ec2-user#52.76.147.44",
    "interactiveAuth": true,
    "password": "",
    "hostKeyPolicy": "accept-new",
    "autoFillPassword": true
  },
  "rsyncOptions": ["-az", "--delete"]
}

サーバーは以下のオプションを追加して、自動的にレジューム可能なアップロードを有効にします:

  • --partial

  • --checksum

  • --progress (rsyncOptionsに既に--progressまたは--info=...が含まれている場合を除く)

互換性に関する注意:

  • 対話型セッションモードはnode-ptyを使用します。macOS/Linuxでposix_spawnp failedと表示される場合、多くはnode-ptyのヘルパー(.../node-pty/prebuilds/*/spawn-helper)に実行権限がないことが原因です。このサーバーはセッション開始時にヘルパーの実行権限を確認し、自動修正します。

リモートターゲットのベースパスはハードコードされており、上書きできません:

  • /var/www/html/demo-remote

ツール

deploy_static

キーワード:

  • EN: deploy to remote, deploy demo, publish demo, upload static site

  • 中文: 部署到远程, 部署demo, 部署 demo, 发布demo, 上传静态网页

userのルール:

  • deployUserはリモートパス用のアプリアプリケーションユーザーIDであり、SSHのusernameではありません

  • 使用可能な文字: A-Z a-z 0-9 _ -

  • 使用不可: ., .., スペース, /, \, およびその他の特殊文字

入力:

{
  "localDir": "/abs/path/to/dist",
  "clientCwd": "/abs/path/on-mcp-client",
  "dryRun": false
}

localDirのパス解決:

  • 絶対パス: そのまま使用

  • 相対パス: clientCwdが提供されている場合はそれを基準に解決

  • 相対パスのフォールバック: CODEX_START_DIRが設定されていればそれを使用、そうでなければprocess.cwd()(サーバー起動ディレクトリ)を使用

プロジェクト名の解決:

  • clientCwdが提供されている場合、プロジェクト名はclientCwdの最後のパスセグメントを使用

  • そうでない場合、プロジェクト名は解決されたlocalDirの最後のパスセグメントを使用

動作に関する注意:

  • ssh.interactiveAuth=trueかつdryRun=falseの場合、deploy_staticは設計上、即座に失敗します。

  • OTP/パスワードによる対話型デプロイを行うには、以下を使用してください:

    1. start_deploy_session

    2. poll_deploy_session

    3. nextAction=submit_inputの時にsubmit_deploy_inputを実行

  • ホストキーの確認(yes/no)およびパスワードプロンプトは、セッションモードで自動的に処理されます。

  • OTPは手動です: nextAction=submit_inputの時にsubmit_deploy_inputを呼び出してください。

出力 (structuredContent):

{
  "ok": true,
  "attempts": 1,
  "user": "alice",
  "project": "my-site",
  "remotePath": "/var/www/html/demo-remote/alice/my-site/",
  "publicUrl": "https://example.com/alice/my-site/index.html",
  "message": "Deploy succeeded after 1 attempt(s)."
}

verify_deploy

入力:

{
  "url": "https://example.com/alice/my-site/index.html",
  "timeoutMs": 8000
}

対話型OTPセッションツール

TTY以外のホストでデプロイ中にOTP/パスワードを入力する必要がある場合に使用します:

  1. start_deploy_session

  2. poll_deploy_session (出力と進捗を読み取る; state=waiting_inputの場合はコードを送信)

  3. submit_deploy_input (OTP/パスワードを送信)

  4. statesucceededまたはfailedになるまでステップ2を繰り返す

  5. オプションでcancel_deploy_session

poll_deploy_sessioncursorによる増分出力をサポートしており、nextCursorを返します。

セッションツールはオーケストレーションを決定論的にするためにnextActionを返します:

  • submit_input: submit_deploy_inputを呼び出す

  • poll: poll_deploy_sessionを呼び出す

  • done: ワークフロー終了 (succeeded / failed / cancelled)

セッションログ:

  • MCP設定ファイルのsessionLogで設定します。

  • sessionLog.enabledのデフォルトはfalseです。

  • sessionLog.pathのデフォルトは/tmp/remote-demo-mcp-session.logです。

  • sessionLog.logInputValueのデフォルトはfalseです(入力の長さのみが記録されます)。

  • 対話型セッションツールはrsyncをPTYで実行するため、パスワード/OTPプロンプトはpoll_deploy_session経由で検出可能です。

SSHホストキーポリシー:

  • accept-new (デフォルト): 初回のホストキーは自動的に受け入れられ、変更されたキーは拒否されます。

  • strict: 不明なホストキーを自動的に受け入れません。

  • insecure: ホストキーの検証を無効にします(リスクが高いため、一時的/デバッグ目的でのみ使用してください)。

Codex CLIの対話フロー:

  1. start_deploy_sessionを呼び出す

  2. poll_deploy_sessionをループする

  3. needsInput=trueまたはnextAction=submit_inputの場合、OTP/パスワードを指定してsubmit_deploy_inputを呼び出す。ユーザーへのヒント表示は「Please Enter MFA Code.」または「Please Enter Password.」とする。

  4. nextAction=doneになるまでポーリングを継続する

エージェントプロトコル契約 (CodexのようなMCPクライアント向け):

  1. start_deploy_sessionを1回呼び出す。

  2. レスポンスからnextActionを読み取る。

  3. nextAction=submit_inputの場合、submit_deploy_inputを呼び出す。

  4. nextAction=pollの場合、poll_deploy_sessionを呼び出す。

  5. nextAction=doneになるまでステップ2〜4を繰り返す。

  6. OTPフローでdeploy_staticを呼び出さないこと。セッションツールのみを使用すること。

  7. ポーリング中、転送の進捗をoutputからエンドユーザーに継続的に中継すること。

出力 (structuredContent):

{
  "ok": true,
  "url": "https://example.com/alice/my-site/index.html",
  "status": 200,
  "statusText": "OK",
  "responseTimeMs": 123,
  "message": "URL is reachable: HTTP 200 in 123ms"
}

実行

npm run dev
# or
npm run build && npm start

設定ファイルの初期化:

remote-demo-mcp init

以下が作成されます:

  • ~/.config/remote-demo-mcp/config.json

  • 対話モードでは、編集のために現在の各フィールド値が表示されます。

  • 入力せずにEnterキーを押すと、現在の値が変更されずに保持されます。

  • 設定が既に存在する場合、initは変更するかどうかを尋ね、上書き前に最終確認を求めます。

codex 使用

安裝 npm 包

npm install -g    @jake.e-com365/remote-demo-mcp

codex 添加 mcp

codex mcp add remote-demo-mcp remote-demo-mcp  

remote-demo-mcp 的配置

remote-demo-mcp init
vi ~/.config/remote-demo-mcp/config.json
{
  "deployUser": "jake",
  "publicBaseUrl": "https://demo-remote.e-com365.com/",
  "ssh": {
    "host": "xxx.xxx.xxx.xxx",
    "username": "alice123#ec2-user#18.140.183.126",
    "interactiveAuth": true,
    "port": 2222,
    "password": "xxx",
    "hostKeyPolicy": "accept-new",
    "autoFillPassword": true
  },
  "rsyncOptions": ["-az", "--delete"]
}

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    B
    maintenance
    A local MCP server for agentic remote development that enables code sync via rsync, SSH command execution, and long-running task management in remote tmux sessions.
    15
    2
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    SSH-based MCP server that enables remote execution of SSH commands, file transfers, and secure server management via the MCP protocol.
    ISC