[BUG] Custom agent used as an in-process teammate does not inherit project MCP tools

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 0 comments · opened Aug 3, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

A custom agent definition spawned as an agent-team teammate with --teammate-mode in-process cannot discover project-scoped MCP tools. The parent session connects to the MCP servers and exposes their tools, and a built-in general-purpose in-process teammate can discover and dispatch the same tools. A custom in-process teammate cannot.

The failure occurs before MCP authentication or tool execution. ToolSearch reports that the MCP tools are absent from the custom teammate's deferred tool registry.

All three custom-agent configurations fail:

  1. Exact MCP tool names in tools: — MCP names are missing from a five-entry deferred pool.
  2. Server wildcard patterns in tools: — patterns do not materialize the MCP tools.
  3. No tools: field — custom teammate receives 13 deferred non-MCP tools while the parent has 491.

In every custom-agent case, ToolSearch returns No matching deferred tools found for the MCP tools. No MCP call is dispatched.

The built-in general-purpose teammate is a successful control: it receives 483 deferred tools, selects the three MCP tools, and dispatches all three calls while also running in-process.

What Should Happen?

A custom teammate should inherit project/user MCP servers. If the custom agent contains a tools: allowlist, documented exact MCP tool names or mcp__<server>__* patterns should expose the selected tools. If tools: is omitted, the custom agent should inherit the available tool pool.

This expectation follows the Claude Code documentation for custom agents and agent teams:

https://code.claude.com/docs/en/sub-agents
https://code.claude.com/docs/en/agent-teams

Error Messages/Logs

No matching deferred tools found

Steps to Reproduce

  1. Configure one or more working project-scoped MCP servers in .mcp.json. Confirm they connect in the parent session and provide tools.
  2. Copy repro/.claude/agents/project-mcp-diagnostic.md into the project.
  3. Adjust the generalized server/tool names in that agent to match the configured MCP server.
  4. Run repro/reproduce.sh.
  5. Observe that ToolSearch in the custom teammate cannot find the MCP tool.
  6. Run repro/control-general-purpose.sh with the same project configuration.
  7. Observe that the built-in teammate can select and dispatch the tool.

Representative failing command:

PRIMARY_ITEM="PRIMARY-123"
SECONDARY_ITEM="SECONDARY-456"

claude \
  --name custom-inprocess-mcp-repro \
  --teammate-mode in-process \
  --debug mcp \
  --debug-file ./custom-inprocess-mcp-repro.log \
  "Spawn exactly one teammate using subagent_type project-mcp-diagnostic, named mcp-test-1. Pass it primary_item=${PRIMARY_ITEM} and secondary_item=${SECONDARY_ITEM}. Wait for completion and reproduce its result table exactly. Do not call MCP tools yourself."

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.220

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

Impact

In headless workflows- Agent-team workflows cannot reliably use specialist custom agents for project MCP operations in in-process mode. Specialist instructions and permissions cannot fix the problem because the tools are removed from the teammate runtime before the model can select them.

The available workarounds change the architecture: use a built-in general-purpose teammate or use a non-in-process teammate mode.

Additional notes

  • This is not an MCP credential or connectivity failure.
  • No permission prompt or permission denial caused the failure.
  • The custom teammate's frontmatter permissionMode was not relevant to tool discovery.

bug-report-custom-inprocess-mcp.zip

Ticket/item content and MCP responses are unnecessary to reproduce the issue.

View original on GitHub ↗