feat: Forward MCP tools to delegate sessions#375
Conversation
Subagents created via delegation now inherit MCP configuration from their parent, allowing them to access MCP-provided tools. This matches the pattern used for other tools like bash and allowedTools. Each subagent creates its own MCPXmlBridge instance, maintaining isolation while enabling full MCP functionality in delegates. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
PR Overview: Forward MCP Tools to Delegate SessionsSummaryThis PR enables Model Context Protocol (MCP) tool inheritance in delegated subagent sessions. When a parent agent creates a delegate subagent, the subagent now inherits the parent's MCP configuration, allowing it to access MCP-provided tools. This matches the existing pattern used for other tools like bash and allowedTools. Files Changed
Architecture & Impact AssessmentWhat This PR AccomplishesSubagents created via delegation now inherit MCP configuration from their parent agent, enabling:
Key Technical Changes
Affected System Componentsgraph TD
A[Parent Agent] -->|delegateTool call| B[delegate function]
B -->|creates| C[Subagent ProbeAgent]
A -->|forwards MCP config| B
B -->|passes MCP params| C
C -->|initializeMCP| D[MCPXmlBridge]
D -->|connects to| E[MCP Servers]
C -->|can now use| F[MCP Tools]
style A fill:#e1f5ff
style C fill:#fff4e1
style D fill:#f0f0f0
Component Relationshipsgraph LR
subgraph Parent[Parent Agent Context]
P1[enableMcp flag]
P2[mcpConfig object]
P3[mcpConfigPath string]
end
subgraph Delegate[Delegation Layer]
D1[delegateTool]
D2[delegate function]
end
subgraph Subagent[Subagent Context]
S1[ProbeAgent instance]
S2[MCPXmlBridge instance]
S3[MCP Tool Access]
end
Parent --> D1
D1 --> D2
D2 --> S1
S1 --> S2
S2 --> S3
style Parent fill:#e3f2fd
style Subagent fill:#f3e5f5
Scope Discovery & Context ExpansionDirect Impact
Related Components (Inferred)Based on the codebase structure, these areas are related but not directly modified:
Potential Follow-up Areas
TestingAll 113 delegate-related tests pass, including:
Labels
Metadata
Powered by Visor from Probelabs Last updated: 2026-02-02T12:29:12.169Z | Triggered by: pr_opened | Commit: 807185c 💡 TIP: You can chat with Visor using |
Security Issues (8)
Architecture Issues (4)
Performance Issues (4)
Quality Issues (8)
Powered by Visor from Probelabs Last updated: 2026-02-02T12:29:15.075Z | Triggered by: pr_opened | Commit: 807185c 💡 TIP: You can chat with Visor using |
Summary
Subagents created via delegation now inherit MCP configuration from their parent, allowing them to access MCP-provided tools. This matches the pattern used for other tools like bash and allowedTools.
Details
enableMcp,mcpConfig, andmcpConfigPathparameters to the delegate function signaturedelegateToolto thedelegate()functionTest Results
All 113 delegate-related tests pass.
🤖 Generated with Claude Code