コンテンツにスキップ

【MCP】 VSCode でコマンド実行のセットアップが失敗する

背景

VSCode で LLM を用いたコーディングをする際に、MCP server を使ってみた。MCP server は、Playwright や Context7 などのツールやフレームワークを LLM から利用できるようにするためのもの。

この MCP server をセットアップする際に、npx や bunx、uvx などのコマンドを使うことがあるが、これらのコマンドが正しく動作しない場合がある。

問題

次のような設定で MCP server をセットアップしたところ、コマンドの実行が失敗した。

1
2
3
4
5
6
7
8
{
  "mcpServers": {
    "sequential-thinking": {
      "command": "bunx",
      "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
    }
  }
}
VSCode MCP Server Error
Connection state: Error spawn bun ENOENT

対応

bunx や npx、uvx などを使ったセットアップがうまくできなかったが、以下のようにバイナリのパスを直接指定することで解決できた。

1
2
3
4
5
6
7
8
{
  "mcpServers": {
    "sequential-thinking": {
      "command": "path/to/bin/bun",
      "args": ["x", "-y", "@modelcontextprotocol/server-sequential-thinking"]
    }
  }
}

参考