Unable to use codex mcp server as an mcp within a codex session

Resolved 💬 7 comments Opened Nov 2, 2025 by Chargeuk Closed Apr 18, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.53.0

What subscription do you have?

Pro

Which model were you using?

GPT5-codex-medium

What platform is your computer?

Darwin 24.6.0 arm64 arm

What issue are you seeing?

On macOS I have tried to add an MCP server to ~/.codex/config.toml using the following settings:

[mcp_servers.codex_mcp]
command = "codex"
args = ["mcp-server"]
startup_timeout_sec = 60.0
tool_timeout_sec = 120.0

But when codex tries to use this mcp, it shows the following error:

• Called codex_mcp.codex({"prompt":"Hello!","sandbox":"read-only"})
└ Error: tool call error: tool call failed for codex_mcp/codex
Caused by:
0: timed out awaiting tools/call after 120s
1: deadline has elapsed

─ Worked for 2m 04s
• Tried starting a Codex session with “Hello!”, but the tool request timed out after 120 s. Want me to retry with different settings or keep an eye out for connectivity issues?

What steps can reproduce the bug?

  1. add the following mcp server to config.toml:

[mcp_servers.codex_mcp]
command = "codex"
args = ["mcp-server"]
startup_timeout_sec = 60.0
tool_timeout_sec = 120.0

  1. ask codex to use the codex_mcp tool

What is the expected behavior?

I expect a response from the codex instance within the mcp server

Additional information

this config was based off a config that apparently works for claude to access codex from https://victorkreitmann.com/til/2025/openai-codex-as-an-mcp-server/

View original on GitHub ↗

7 Comments

github-actions[bot] contributor · 8 months ago

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

  • #4844

Powered by Codex Action

Chargeuk · 8 months ago

This is not the same issue, as I can connect to the server when running npx @modelcontextprotocol/inspector codex mcp-server and I can also list tools and see responses to prompts.

However, this does not work from within a codex session. Almost all messages just time out. However, I did get it to work twice by sending: {"prompt":"Please respond with a friendly greeting from the codeInfo automation agent to confirm connectivity.","config":{"timeout":1200}}, but most of the time it just timed out.

Given the way it consistently works using @modelcontextprotocol/inspector, but almost always fails from within a running codex session, it points to an issue within the way the codex session is using the codex mcp server.

Can anyone else reproduce this, or provide an mcp configuration that works?
Thanks

Zyy0530 · 8 months ago

I’m seeing the same behavior.

When running a simple task via the Codex CLI that calls the codex mcp server (Codex as an MCP server), the tool successfully performs the side effect (writes a file locally) but the result never returns to the Codex CLI.

Environment / Config:

OS: M4 Mac mini (Apple Silicon)
Codex version: codex-cli 0.55.0

Codex config (~/.codex/config.toml):

# Codex Configuration
model = "gpt-5"
approval_policy = "never"
sandbox_mode = "danger-full-access"
model_reasoning_effort = "high"
show_raw_agent_reasoning = true
model_reasoning_summary = "detailed"

[features]
web_search_request = true

[mcp_servers.codex_server]
command = "codex"
args = ["mcp-server"]
startup_timeout_sec = 60
tool_timeout_sec = 600

Codex CLI invoke the codex_server tool:

tool codex_server.codex({"sandbox":"danger-full-access", "prompt": "Write a test.json file to the directory."})

Even though the codex_server can normally execute commands (it write the test.json file to the local filesystem), it has always been unable to return to the upper-level codex cli (client). After a while, the codex mcp server errors out with a timeout.

Has anyone else encountered a similar issue? Any workarounds?

Zyy0530 · 8 months ago

I rolled back to version 0.47.0, and it runs normally, but the same issue persists in version 0.48.0. This seems to be a breaking change introduced in version 0.48.0.

NikTheGeek1 · 8 months ago

I’m experiencing the same issue in version 0.58. Trying to connect to a Codex MCP server from the Codex CLI causes the interface to freeze.

sluongng contributor · 6 months ago

I think the ability to use subagents through codex mcp-server needs to be revisited.

From https://cursor.com/blog/scaling-agents, it's clear that there is a huge value unlock if the harness (Codex CLI) can orchestrate multiple subagents in parallel to divide and conquer huge tasks. The model clearly has the ability to do this already, as demonstrated in the blog post.

I would love to see the Codex team try running this themselves and provide best practices on how to do this effectively for other users.

etraut-openai contributor · 3 months ago

Closing outdated bug.