### Describe the bug Custom agents defined in `~/.copilot/agents/` with `mcp-servers` declared in their YAML frontmatter do NOT receive MCP tool connections when invoked as sub-agents (via the `task` tool) or as the primary agent via `--prompt` mode. The agent only receives basic tools (`view`, `skill`, `report_intent`) instead of the MCP server tools declared in its profile. ### Affected version 1.0.23 ### Steps to reproduce the behavior ## Steps to reproduce 1. **Configure MCP servers globally** in `~/.copilot/mcp-config.json`: ```json { "mcpServers": { "my-mcp-server": { "type": "http", "url": "https://example.com/mcp", "tools": ["*"] } } } ``` 2. **Create a custom agent** in `~/.copilot/agents/my-agent.agent.md`: ```yaml --- name: my-agent description: Agent that uses MCP tools tools: - "my-mcp-server/*" mcp-servers: my-mcp-server: type: 'http' url: 'https://example.com/mcp' tools: ["*"] --- Agent prompt here. ``` 3. **In the interactive CLI session**, MCP tools work perfectly — the main agent can call `my-mcp-server` tools without issues. 4. **Invoke the custom agent as a sub-agent** via the `task` tool: ``` Use my-agent to perform a task that requires my-mcp-server tools ``` 5. **Result:** The custom agent reports it only has access to `view`, `skill`, and `report_intent`. None of the MCP server tools declared in its `mcp-servers` frontmatter are available. 6. **Also fails with `--prompt` mode:** ```bash copilot --agent=my-agent --prompt "List your available tools" --allow-all ``` Same result — no MCP tools available. ### Expected behavior ## Expected behavior When a custom agent declares `mcp-servers` in its YAML frontmatter, those MCP connections should be established and the tools should be available to the agent, regardless of whether the agent runs as: - A sub-agent via the `task` tool - The primary agent via `--agent` + `--prompt` - The primary agent in interactive mode The [Custom agents configuration docs](https://docs.github.com/en/copilot/reference/custom-agents-configuration) confirm that `mcp-servers` is a supported YAML frontmatter property. The `tools` property is documented to control tool access including from MCP servers. ### Additional context ## Actual behavior - **Interactive session (main agent):** ✅ MCP tools from `mcp-config.json` work - **Sub-agent via `task` tool:** ❌ Only `view`, `skill`, `report_intent` available - **Primary agent via `--prompt`:** ❌ Only `skill`, `report_intent` available - **Primary agent via `--agent` + `--prompt`:** ❌ Same — no MCP tools ## Impact This prevents custom agents from being used for any workflow that depends on MCP server tools (e.g., Teams, Mail, Calendar, database, or any external API). The workaround is to have the main agent execute the MCP calls directly instead of delegating to the custom agent — which defeats the purpose of agent specialization. ## Environment - **OS:** Windows 11 - **Copilot CLI:** v1.0.23 - **MCP server type:** HTTP (Streamable HTTP) - **Agent location:** `~/.copilot/agents/` - **MCP config location:** `~/.copilot/mcp-config.json`