Describe the bug
Custom agents defined in .claude/agents/ with mcps: declared in their YAML frontmatter do not receive MCP tool connections when spawned as sub-agents via the task tool. The agent loads and runs, but MCP tools are absent from its tool inventory.
Workaround: Moving agent files to .copilot/agents/ (with symlinks in .claude/agents/) resolves the issue — sub-agents then receive all MCP tools correctly.
This may be related to #2630, but is a distinct issue: #2630 covers MCP propagation failing entirely for sub-agents. This bug is specifically about agent file location affecting MCP resolution.
Affected version
1.0.26
Steps to reproduce the behavior
-
Create a custom agent in .claude/agents/my-agent.md with mcps: frontmatter:
---
name: my-agent
description: Agent that uses MCP tools
mcps:
my-mcp:
type: local
command: some-mcp-command
args: [mcp, my-server]
---
Agent instructions here.
-
Configure .mcp.json at repo root with the same MCP servers (they work in the main interactive session).
-
Spawn the agent as a sub-agent via the task tool:
task(agent_type="my-agent", prompt="List all your available tools")
-
Result: Agent loads but reports no MCP tools — only basic tools (view, edit, grep, powershell, etc.)
-
Move agent to .copilot/agents/my-agent.md, symlink .claude/agents/my-agent.md → .copilot/agents/my-agent.md.
-
Reload session and repeat step 3.
-
Result: Agent now reports all MCP tools correctly.
Expected behavior
Agents in .claude/agents/ should receive MCP tools from their mcps: frontmatter when spawned as sub-agents, the same as agents in .copilot/agents/.
Additional context
- OS: Windows 11
- Shell: PowerShell 7
- Copilot CLI version: 1.0.26
- The main interactive session always has MCP tools regardless of agent location
- Session reload was required after moving files (mid-session moves hit a stale file path cache)
Describe the bug
Custom agents defined in
.claude/agents/withmcps:declared in their YAML frontmatter do not receive MCP tool connections when spawned as sub-agents via thetasktool. The agent loads and runs, but MCP tools are absent from its tool inventory.Workaround: Moving agent files to
.copilot/agents/(with symlinks in.claude/agents/) resolves the issue — sub-agents then receive all MCP tools correctly.This may be related to #2630, but is a distinct issue: #2630 covers MCP propagation failing entirely for sub-agents. This bug is specifically about agent file location affecting MCP resolution.
Affected version
1.0.26
Steps to reproduce the behavior
Create a custom agent in
.claude/agents/my-agent.mdwithmcps:frontmatter:Configure
.mcp.jsonat repo root with the same MCP servers (they work in the main interactive session).Spawn the agent as a sub-agent via the
tasktool:Result: Agent loads but reports no MCP tools — only basic tools (view, edit, grep, powershell, etc.)
Move agent to
.copilot/agents/my-agent.md, symlink.claude/agents/my-agent.md→.copilot/agents/my-agent.md.Reload session and repeat step 3.
Result: Agent now reports all MCP tools correctly.
Expected behavior
Agents in
.claude/agents/should receive MCP tools from theirmcps:frontmatter when spawned as sub-agents, the same as agents in.copilot/agents/.Additional context