Unable to use codex mcp server as an mcp within a codex session
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?
- 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
- 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/
7 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
This is not the same issue, as I can connect to the server when running
npx @modelcontextprotocol/inspector codex mcp-serverand 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
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 CLI invoke the codex_server tool:
Even though the
codex_servercan 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?
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.
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.
I think the ability to use subagents through
codex mcp-serverneeds 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.
Closing outdated bug.