こんにちは。クロスイノベーション本部クラウドイノベーションセンターの柴田です。
この記事では Visual Studio Code で GitHub Copilot の agent mode と Remote Development を併用した場合に MCP サーバーがどこで実行されるのかをご紹介します。
はじめに
GitHub Copilot とは
GitHub Copilot は GitHub が提供するコーディングアシスタントです。 AI を活用してコードの補完や生成など様々な機能を提供します。 version 1.99 からは MCP クライアントとしても利用できるようになりました。
Remote Development とは
Remote Development は Visual Studio Code の拡張機能の 1 つです。ソースコードを開いたりコマンドや拡張機能を実行したりといった Visual Studio Code の各種操作を、ローカル環境と同じようにコンテナ・リモートマシン・Windows Subsystem for Linux などのリモート環境上で行うことができます。
前提条件
この記事は以下の環境を前提とします。
- Visual Studio Code version 1.100.2
- Remote - SSH version 0.120.0
- GitHub Copilot version 1.322.0
この記事の内容の動作確認は Remote Development のうち Remote - SSH でのみ行っています。
MCP サーバーはどこで実行されるのか
GitHub Copilot の agent mode と Remote Development を併用した場合に MCP サーバーはどこで実行されるのでしょうか。
microsoft/vscode#243687 には以下のようにコメントされています。
VS Code will run the tool wherever it is configured. If it is configured in your user settings, then it will run on the VS Code 'host'. If they are configured in your remote settings or in workspace settings, then they will be run in the remote.
つまり先ほどの質問への答えは以下のようになります。
MCP サーバの構成をどこに記述したか | MCP サーバがどこで実行されるか |
---|---|
ユーザー設定(ローカルの settings.json ) |
ローカル環境 |
リモート設定(リモートの settings.json ) |
リモート環境 |
ワークスペース設定(ワークスペースの .vscode/mcp.json ) |
ワークスペースのある環境(≒ リモート環境) |
もし MCP サーバーが期待通り起動しない場合は、MCP サーバーの設定がどこに記述されているか、そして MCP サーバーがどこで実行されているかを確認してみるとよいでしょう。
おわりに
この記事では Visual Studio Code で GitHub Copilot の agent mode と Remote Development を併用した場合に MCP サーバーがどこで実行されるのかをご紹介しました。最後までお読みいただき、ありがとうございました。
参考資料
- MCP servers run on local machine, not in remote · Issue #10920 · microsoft/vscode-remote-release
- Vscode in WSL using other environment to connect to MCP Servers · Issue #245050 · microsoft/vscode
- Allow running and detecting servers on WSL2 · Issue #243687 · microsoft/vscode
執筆:@shibata.takao、レビュー:@kobayashi.hinami
(Shodoで執筆されました)