Skip to content

Subagents do not inherit parent session's registered MCP tools #16475

@Skroby

Description

@Skroby

What version of Codex CLI is running?

codex-cli 0.117.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.4

What platform is your computer?

Darwin 25.3.0 arm64 arm (macOS 26)

What terminal emulator and version are you using (if applicable)?

Ghostty 1.x (also reproduced inside Docker containers with no TTY)

What issue are you seeing?

Subagents spawned by a Codex session do not inherit the parent session's registered MCP tools, despite the documentation stating they should.

Setup: A Codex CLI interactive session has an MCP stdio server registered that exposes several mcp__team__* tools (spawn_worker, enqueue_task, get_status, etc.). The parent session can discover and call these tools successfully. When the parent session spawns an internal subagent (via Codex's own Agent tool), the subagent cannot see or call any of the mcp__team__* tools. The subagent behaves as if no MCP servers are configured.

Context MCP tools visible?
Parent session Yes — all mcp__team__* tools listed and callable
Subagent spawned by parent No — tools not listed, calls fail

The MCP server process itself remains healthy throughout; the parent session can still use the tools after the subagent fails. This rules out a server crash or timeout.

What steps can reproduce the bug?

  1. Register a stdio MCP server in ~/.codex/config.toml:
[mcp_servers.team]
command = "/path/to/team-mcp-server"
args = []
  1. Start a Codex CLI session and verify the MCP tools are available:
codex> /mcp
🔌 MCP Tools
• Server: team
    • Status: enabled
    • Tools: mcp__team__spawn_worker, mcp__team__enqueue_task, ...
  1. Ask Codex to delegate a subtask that requires the MCP tools. Codex spawns an internal subagent.

  2. The subagent reports that the mcp__team__* tools are unavailable and cannot proceed.

  3. Return to the parent session — MCP tools still work fine there.

What is the expected behavior?

Per the Subagents documentation:

Optional fields such as nickname_candidates, model, model_reasoning_effort, sandbox_mode, mcp_servers, and skills.config inherit from the parent session when you omit them.

Since the subagent does not override mcp_servers, it should inherit the parent session's MCP server registrations and have access to all the same MCP tools.

Additional information

Related issues:

Cross-ecosystem precedent:

This appears to be a common pitfall in AI CLI MCP implementations where the stdio MCP connection (or its tool registry) is scoped to the parent process and not forwarded when spawning child agent sessions.

Workaround: None known. Instructing the subagent to use the MCP tools via prompt engineering does not help since the tools are simply not registered in its session. The only mitigation is to avoid delegating MCP-dependent work to subagents entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentIssues related to the core agent loopbugSomething isn't workingmcpIssues related to the use of model context protocol (MCP) servers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions