MCP Command Proxy

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Allows running Expo development server commands, specifically 'expo start', with the ability to capture logs and interact with the Expo CLI through key presses

MCP コマンドプロキシ

CLI コマンドのプロキシとして機能する MCP (Model Context Protocol) サーバー。Expo 開発用に特別に設計されていますが、あらゆるコマンドライン アプリケーションに適応できます。

カーソルでの使い方(Expoの例)

  1. Expoプロジェクトのディレクトリに移動します
  2. npx mcp-command-proxy --prefix "ExpoServer" --command "expo start" --port 8383実行します。
  3. 次のように、カーソル設定 -> MCP -> +新しい MCP サーバーの追加に移動します。
  4. 名前を「ExpoServer」、タイプを「SSE」、URLをhttp://localhost:8383/sseに設定します。
  5. 「保存」をクリックすると、CursorでMCPサーバーを使用できるようになります。以下のようになります。

他のサーバーとの競合を避けるため、 --port 8383フラグの使用を推奨します。また、.cursorrules ファイルに以下の指示を追加することもできます。

You can use MCP getRecentLogs tool to get the most recent logs from Expo server. And if needed, you can send key presses to the running process using sendKeyPress tool.

特徴

  • コマンドプロキシ: MCPサーバーを介して任意のCLIコマンドを実行します。
  • ログ収集: 実行中のプロセスからログをキャプチャして保存します (バッファ サイズは設定可能)
  • キー押下転送: クライアントから実行中のプロセスにキー押下を転送します
  • 透過的なエクスペリエンス:エンドユーザーは、コマンドを直接実行した場合とまったく同じようにコマンドの出力を見ることができます。
  • 対話型コマンド: Expo のような対話型 CLI ツールで動作します
  • MCP 統合: Claude やその他の MCP 対応 AI アシスタントとの簡単な統合のために MCP SDK を使用して構築されています

仕組み

  1. サーバーは擬似端末(PTY)で指定されたコマンドを開始します。
  2. すべての stdout/stderr 出力は次のとおりです。
    • リアルタイムでクライアントにストリーミング
    • 循環バッファに保存されます(サイズは設定可能、デフォルトは300行)
  3. クライアントからのキー入力は実行中のプロセスに転送されます
  4. サーバーは次のツールを提供します:
    • 収集されたログを表示する
    • キーの押下をプロセスに送信する
    • プロセスの現在の状態を取得する

ユースケース

  • Expo 開発: expo startを実行し、ログを収集しながら操作します。
  • ビルドプロセス: ビルドプロセスを監視し、ログを分析する
  • 長期実行サービス: サービスを監視し、最近のログ履歴を保持します
  • リモートコマンド実行: リモートクライアントからのコマンドの実行と監視

要件

  • Node.js 18歳以上
  • タイプスクリプト
  • pnpm(推奨)またはnpm

インストール

# Install dependencies pnpm install # Build the project pnpm build # Run directly pnpm start -- --prefix "MyServer" --command "expo start" # Or install globally pnpm install -g mcp-command-proxy --prefix "MyServer" --command "expo start"

使用法

基本的な使い方

# Using the CLI mcp-command-proxy --prefix "ExpoServer" --command "expo start" # Or programmatically import { createServer } from 'mcp-command-proxy'; const server = await createServer({ prefix: 'ExpoServer', command: 'expo start', bufferSize: 500, port: 8080 }); // To stop the server later server.stop();

オプション

  • --prefix, -p : サーバーの名前/プレフィックス (デフォルト: "CommandProxy")
  • --command, -c : 実行するコマンド(必須)
  • --buffer-size, -b : メモリに保持するログ行数(デフォルト: 300)
  • --port : HTTPサーバーのポート(デフォルト: 8080)
  • --help, -h : ヘルプを表示

MCP統合

このサーバーは、次の MCP ツールを実装します。

  1. getRecentLogs : バッファから最新のログを返します
    • パラメータ:
      • limit (オプション): 返されるログの数 (デフォルト: 100)
      • types (オプション): 含めるログの種類 (stdout、stderr、system) (デフォルト: all)
  2. sendKeyPress : 実行中のプロセスにキー押下を送信します
    • パラメータ:
      • key : 送信するキー(例:「enter」、「a」、「1」、「space」)
  3. getProcessStatus : プロセスの現在のステータスを返します
    • パラメータ: なし

ランニングエキスポスタート

mcp-command-proxy -p "ExpoServer" -c "expo start" -b 500

クロードと一緒に使う

  1. Claude をこの MCP サーバーに接続するように設定します (SSE エンドポイント: http://localhost:8080/sse )
  2. ClaudeにExpoやその他のコマンドを実行してもらう
  3. クロードはログを分析し、問題のトラブルシューティングを支援できます

発達

# Clone the repository git clone https://github.com/hormold/mcp-command-proxy.git cd mcp-command-proxy # Install dependencies pnpm install # Build the project pnpm build # Run in development mode pnpm dev

ライセンス

マサチューセッツ工科大学

-
security - not tested
A
license - permissive license
-
quality - not tested

AI アシスタントがモデル コンテキスト プロトコル (MCP) を介して Expo などのコマンドライン アプリケーションを実行および操作し、ログをキャプチャしてキー押下転送を可能にするプロキシ サーバー。

  1. How to use in Cursor (Expo example)
    1. Features
      1. How It Works
        1. Use Cases
          1. Requirements
            1. Installation
              1. Usage
                1. Basic Usage
                2. Options
                3. MCP Integration
              2. Examples
                1. Running Expo Start
                2. Using with Claude
              3. Development
                1. License
                  ID: r6mkzp5rs4