Skip to content

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

Open

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.

Activity

  1. added
    bug
    CLI
    mcp
    on Apr 1, 2026
  2. github-actions commented on Apr 1, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. added
    agent
    and removed
    CLI
    on Apr 2, 2026
  4. added
    subagent
    and removed
    agent
    on Apr 11, 2026
  5. aldi949 commented on Sep 23, 2026

    @aldi949

    @Skroby hey — I came across this while looking into recurring MCP/subagent problems and found several similar reports.

    Is this still affecting you today? Also, roughly how much time did you spend figuring out that the MCP server itself was fine and the tools just weren't reaching the subagent?

    I'm trying to understand whether visibility into what tools/context a subagent actually receives is a recurring pain or just an occasional bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmcpsubagent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions