mcpField
M
mcp-server-commands

mcp-server-commands

ローカル
github.com/bytedance開発ツール39.4k3 週間前に更新

mcp-server-commands について

mcp-server-commands は、MCP クライアントの代わりに任意のシェルコマンドを実行する MCP サーバーです。指定した作業ディレクトリでエージェントにコマンドを実行させたい開発者に向いています。README には、アクセス制御や安全性の制限についての記載が少ないです。

主な機能

  1. 01任意のコマンドライン命令の実行
  2. 02--cwd オプションによる作業ディレクトリの指定
  3. 03stdio、SSE、Streamable HTTP のトランスポート
  4. 04npx による導入と実行

活用シーン

  1. 01MCP クライアントからプロジェクトのビルドやテストを実行する
  2. 02HTTP エンドポイント経由でリモートホスト上のコマンドを実行する

MCP 対応

コマンド実行機能を MCP ツールとして MCP クライアントに提供します。クライアントは stdio、または /sse・/mcp のリモートエンドポイント経由で接続します。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

mcp.json · 共通設定
{
"mcpServers": {
"bytedance-mcp-server-commands": {
"command": "npx",
"args": [
"-y",
"@agent-infra/mcp-server-commands"
]
}
}
}
起動コマンドnpx -y @agent-infra/mcp-server-commands

ローカルサーバーにはマシン上の実行環境(Node.js 18 以上など)が必要です。設定ファイルの場所はクライアントごとに異なります。

パッケージ
npm@agent-infra/mcp-server-commandslatest

ツール

2

掲載時のツール一覧 · 2 週間前に更新

パラメーター型必須説明
cwdstringいいえ現在の作業ディレクトリ。通常は空のままにします
commandstringはい引数付きコマンド

詳細

Commands MCP Server

NPM Downloads

Install MCP Server VS Code にインストール VS Code Insiders にインストール

任意のコマンドを実行できる Model Context Protocol(MCP)サーバーです。

README の画像

要件
  • Node.js 18 以降
  • VS Code、Cursor、Windsurf、Claude Desktop、またはその他の MCP クライアント
はじめに
ローカル(Stdio)

まず、使用するクライアントに Commands MCP サーバーをインストールします。一般的な設定は次のとおりです。

{
  "mcpServers": {
    "commands": {
      "command": "npx",
      "args": [
        "-y",
        "@agent-infra/mcp-server-commands@latest",
        "--cwd",
        "/tmp"
      ]
    }
  }
}
VS Code にインストール

VS Code CLI を使用して Commands MCP サーバーをインストールすることもできます。

# For VS Code
code --add-mcp '{"name":"commands","command":"npx","args":["@agent-infra/mcp-server-commands@latest"]}'

インストール後、VS Code の GitHub Copilot エージェントで Commands MCP サーバーを使用できるようになります。

Cursor にインストール

Cursor Settings -> MCP -> Add new MCP Server に移動します。任意の名前を付け、タイプに command を選択し、コマンドに npx @agent-infra/mcp-server-commands を指定します。Edit をクリックすると、設定の確認やコマンド引数の追加もできます。

{
  "mcpServers": {
    "commands": {
      "command": "npx",
      "args": [
        "-y",
        "@agent-infra/mcp-server-commands@latest"
      ]
    }
  }
}
Windsurf にインストール

Windsurf MCP のドキュメントに従って、次の設定を使用します。

{
  "mcpServers": {
    "commands": {
      "command": "npx",
      "args": [
        "-y",
        "@agent-infra/mcp-server-commands@latest"
      ]
    }
  }
}
Claude Desktop にインストール

MCP のインストールガイドに従って、次の設定を使用します。

{
  "mcpServers": {
    "commands": {
      "command": "npx",
      "args": [
        "-y",
        "@agent-infra/mcp-server-commands@latest"
      ]
    }
  }
}
リモート(SSE / Streamable HTTP)

同時に、--port $your_port 引数を使用してブラウザ MCP を起動すると、SSE および Streamable HTTP サーバーに変換できます。

# normal run remote mcp server
npx @agent-infra/mcp-server-commands --port 8089

次のいずれかの MCP サーバーリモートエンドポイントを使用できます。

  • Streamable HTTP(推奨):http://127.0.0.1:8089/mcp
  • SSE:http://127.0.0.1:8089/sse

続いて、MCP クライアントの設定で、url に SSE エンドポイントを設定します。

{
  "mcpServers": {
    "commands": {
      "url": "http://127.0.0.1:8089/sse"
    }
  }
}

Streamable HTTP の場合は、url に次の値を設定します。

{
  "mcpServers": {
    "commands": {
      "type": "streamable-http", // If there is MCP Client support
      "url": "http://127.0.0.1:8089/mcp"
    }
  }
}
インメモリ呼び出し

MCP クライアントが JavaScript / TypeScript ベースで開発されている場合、ユーザーが Commands MCP を使用するためにコマンドラインインターフェースをインストールする必要がないよう、プロセス内呼び出しを直接利用できます。

import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';

// type: module project usage
import { createServer } from '@agent-infra/mcp-server-commands';
// commonjs project usage
// const { createServer } = await import('@agent-infra/mcp-server-commands')

const client = new Client(
  {
    name: 'test commands client',
    version: '1.0',
  },
  {
    capabilities: {},
  },
);

const server = createServer();
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();

await Promise.all([
  client.connect(clientTransport),
  server.connect(serverTransport),
]);

// list tools
const result = await client.listTools();
console.log(result);

// call tool
const toolResult = await client.callTool({
  name: 'run_script',
  arguments: {
    interpreter: 'node',
    script: 'console.log(1+1);',
  },
});
console.log(toolResult);
開発

http://127.0.0.1:6274/ にアクセスします。

npm run dev

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。