MCP服务器加载问题

GitHub Copilot CLI在作为ACP代理时,无法加载通过ACP newSession请求传递的MCP服务器,导致无法使用这些服务器提供的工具。

  • by cedricvidal
  • JavaScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 cedricvidal/copilot-acp-mcp-issue

使用说明

Copilot ACP MCP Server Loading Issue

This is a standalone reproduction of an issue where MCP servers passed via the ACP newSession request are not being loaded by copilot --acp.

Issue Summary

When using copilot --acp as an ACP agent, MCP servers specified in the newSession request's mcpServers field are not loaded. The agent does not have access to tools provided by these MCP servers.

Expected Behavior

When an ACP client sends a newSession request with MCP servers configured:

{
  "cwd": "/path/to/project",
  "mcpServers": [
    {
      "name": "time",
      "command": "uvx",
      "args": ["mcp-server-time"],
      "env": []
    }
  ]
}

The agent should:

  1. Start the specified MCP servers
  2. Make their tools available for the session
  3. Be able to use tools like get_current_time from the mcp-server-time server

Actual Behavior

The MCP servers are not loaded. When asked "What time is it?", Copilot does not use the MCP time server's tools.

Reproduction Steps

Prerequisites

  1. Install GitHub Copilot CLI:

    brew install copilot-cli
    
  2. Install uv (for running MCP servers):

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  3. Install dependencies:

    npm install
    

Run the reproduction

# Run with MCP config - should use time server but doesn't
npm run test-mcp

Or manually:

npx tsx client.ts --mcp-config=mcp-config.json --prompt="What time is it?" copilot --acp

What you'll see

The client will:

  1. Load the MCP config with the time server
  2. Start copilot --acp
  3. Send a newSession request with the MCP servers
  4. Ask "What time is it?"

Expected: Copilot uses the get_current_time tool from mcp-server-time Actual: Copilot responds without using the MCP time server

Files

  • client.ts - ACP client that connects to copilot --acp and passes MCP servers
  • mcp-config.json - MCP server configuration (compatible with Claude Desktop format)

MCP Config Format

The mcp-config.json uses the same format as Claude Desktop:

{
  "mcpServers": {
    "time": {
      "command": "uvx",
      "args": ["mcp-server-time"]
    }
  }
}

ACP Protocol Reference

Per the ACP specification, the newSession request includes:

interface NewSessionRequest {
  cwd?: string;
  mcpServers?: McpServer[];
  // ...
}

interface McpServer {
  name: string;
  command: string;
  args?: string[];
  env?: EnvVariable[];
}

Environment

  • macOS
  • copilot-cli version: (run copilot --version)
  • @agentclientprotocol/sdk: 0.13.1

Related