Codex CLI hangs when configured to use codex mcp-server as an MCP server

Open 💬 11 comments Opened Nov 14, 2025 by NikTheGeek1
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.58.0

What subscription do you have?

pro

Which model were you using?

gpt-5.1-codex

What platform is your computer?

Darwin 24.6.0 arm64 arm

What issue are you seeing?

When configuring Codex CLI to connect to Codex’s own MCP server (via the codex mcp-server subcommand), the Codex CLI hangs indefinitely when listing MCP servers (e.g., using the /mcp command). The MCP server never initializes successfully and no tools are exposed.

What steps can reproduce the bug?

  1. Add the following to ~/.codex/config.toml:
[mcp_servers.codex]
command = "codex"
args = ["mcp-server"]
  1. Start the Codex CLI with: codex
  2. In the CLI, run: /mcp

What is the expected behavior?

Expected Behavior
• Codex CLI should successfully start codex mcp-server as an MCP server.
• /mcp should list the MCP server and its tools.

Actual Behavior
• /mcp hangs indefinitely
• Trying to kill the Codex CLI with cmd + C doesn't work
• No MCP tools ever appear.
• The child codex mcp-server process appears to start but the CLI never completes the MCP handshake.

Additional information

_No response_

View original on GitHub ↗

11 Comments

github-actions[bot] contributor · 8 months ago

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

  • #4844
  • #5444
  • #6020
  • #5044
  • #5855

Powered by Codex Action

Zyy0530 · 8 months ago

same issue

NikTheGeek1 · 8 months ago
same issue

@Zyy0530 If you want a workaround, I found a reliable approach:
use a small Node.js HTTP MCP wrapper instead of connecting the Codex CLI directly to codex mcp-server.

The idea is to run a tiny HTTP server that:

  1. launches codex mcp-server internally (via stdio)
  2. auto-approves Codex confirmation prompts
  3. re-exports the Codex MCP tools over HTTP using @modelcontextprotocol/sdk

Then in your config.toml, enable the HTTP MCP client and point Codex to the wrapper:

[features]
rmcp_client = true

[mcp_servers.codex-http-wrapper]
url = "http://127.0.0.1:2091/mcp"

This gives you full access to all Codex tools, just routed through a stable HTTP layer instead of the stdio path that currently hangs.

Not ideal long-term, but it’s a clean and reliable workaround until the direct stdio communication is fixed.

raghudinesht · 7 months ago

same issue

thomaswitt · 5 months ago

Same here. Used to work great, until it didnt.

etraut-openai contributor · 5 months ago

@thomaswitt, you mentioned that it used to work great. Does that mean you suspect a regression? If so, can you provide any further details, including repro steps and the version where you saw the behavior change? We haven't spent much time on this issue because we don't have a good repro.

thomaswitt · 5 months ago

@etraut-openai I added codex as an MCP server in claude:

    "codex": {
      "_website": "https://github.com/openai/codex",
      "_description": "Access openai codex via MCP",
      "type": "stdio",
      "command": "codex",
      "args": [
        "-m",
        "gpt-5.2-codex",
        "-s",
        "read-only",
        "-a",
        "never",
        "-c",
        "model_reasoning_effort=high",
        "mcp-server"
      ],
      "env": {}
    },

I see that Claude calls the MCP server:

codex - codex (MCP)(prompt: "Review the following architecture plan for …

but then runs basically for 30-40+ minutes. It insists that the MCP call aborted:

  Thomas is checking if I'm still here again. The Codex MCP call got aborted. Let me try again -
  maybe with a shorter prompt or just acknowledge and retry.

⏺ Nope, wide awake! The Codex MCP server keeps aborting — let me retry with a more focused prompt:

I also see in the ps task list that the command itself is running: codex -m gpt-5.2-codex -s read-only -a never -c model_reasoning_effort=high mcp-server

This doesnt happen EVERY time, but in 70% of the time.

I didn't have these problems until around end of this year. Unfortunately I can't pinpoint them to a specific release.

etraut-openai contributor · 5 months ago

OK, thanks for the details. That's still not a lot to go on. Since this issue has been reported only by a few users in the past several months, it hasn't been a big priority for us to investigate (relative to many other higher-impact issues), so community help is welcome here. If anyone is able to pinpoint concrete repro steps — or better yet, root cause the problem, that would be most helpful.

thomaswitt · 5 months ago

@etraut-openai It would be helpful if I could SOMEWHERE get some debugging output from Codex. I don't know if it's even starting to work, if it hangs because of questions (tried to avoid that with -a never) ... at least a mcp list command for the current thread ids and get an in-between result would be very helpful, as it apparently doesn't stream his results (that's at least what I assume).

Claudes session logs are also not much more insightful:


{
  "debug": "Starting connection with timeout of 300000ms",
  "timestamp": "2026-01-30T16:03:01.386Z",
  "sessionId": "44fd07a6-1f6d-4f9c-be71-6e635b6f2b93",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Successfully connected to stdio server in 52ms",
  "timestamp": "2026-01-30T16:03:01.436Z",
  "sessionId": "44fd07a6-1f6d-4f9c-be71-6e635b6f2b93",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"codex-mcp-server\",\"title\":\"Codex\",\"version\":\"0.92.0\"}}",
  "timestamp": "2026-01-30T16:03:01.436Z",
  "sessionId": "44fd07a6-1f6d-4f9c-be71-6e635b6f2b93",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Calling MCP tool: codex",
  "timestamp": "2026-01-30T16:06:46.773Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (30s elapsed)",
  "timestamp": "2026-01-30T16:07:16.774Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (60s elapsed)",
  "timestamp": "2026-01-30T16:07:46.774Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (90s elapsed)",
  "timestamp": "2026-01-30T16:08:16.833Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (120s elapsed)",
  "timestamp": "2026-01-30T16:08:46.915Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (150s elapsed)",
  "timestamp": "2026-01-30T16:09:17.036Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (180s elapsed)",
  "timestamp": "2026-01-30T16:09:47.118Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (210s elapsed)",
  "timestamp": "2026-01-30T16:10:17.222Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (240s elapsed)",
  "timestamp": "2026-01-30T16:10:47.329Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (270s elapsed)",
  "timestamp": "2026-01-30T16:11:17.456Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (300s elapsed)",
  "timestamp": "2026-01-30T16:11:47.511Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (330s elapsed)",
  "timestamp": "2026-01-30T16:12:17.615Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (360s elapsed)",
  "timestamp": "2026-01-30T16:12:47.668Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (390s elapsed)",
  "timestamp": "2026-01-30T16:13:17.761Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (421s elapsed)",
  "timestamp": "2026-01-30T16:13:47.909Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (451s elapsed)",
  "timestamp": "2026-01-30T16:14:17.969Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (481s elapsed)",
  "timestamp": "2026-01-30T16:14:48.089Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (511s elapsed)",
  "timestamp": "2026-01-30T16:15:18.198Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (541s elapsed)",
  "timestamp": "2026-01-30T16:15:48.201Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (571s elapsed)",
  "timestamp": "2026-01-30T16:16:18.201Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (601s elapsed)",
  "timestamp": "2026-01-30T16:16:48.202Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (631s elapsed)",
  "timestamp": "2026-01-30T16:17:18.204Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (661s elapsed)",
  "timestamp": "2026-01-30T16:17:48.204Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (691s elapsed)",
  "timestamp": "2026-01-30T16:18:18.206Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (721s elapsed)",
  "timestamp": "2026-01-30T16:18:48.285Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (751s elapsed)",
  "timestamp": "2026-01-30T16:19:18.350Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (781s elapsed)",
  "timestamp": "2026-01-30T16:19:48.467Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (811s elapsed)",
  "timestamp": "2026-01-30T16:20:18.577Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (841s elapsed)",
  "timestamp": "2026-01-30T16:20:48.711Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (872s elapsed)",
  "timestamp": "2026-01-30T16:21:18.805Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (902s elapsed)",
  "timestamp": "2026-01-30T16:21:48.888Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (932s elapsed)",
  "timestamp": "2026-01-30T16:22:18.961Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (962s elapsed)",
  "timestamp": "2026-01-30T16:22:49.025Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (992s elapsed)",
  "timestamp": "2026-01-30T16:23:19.134Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1022s elapsed)",
  "timestamp": "2026-01-30T16:23:49.262Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1052s elapsed)",
  "timestamp": "2026-01-30T16:24:19.338Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1082s elapsed)",
  "timestamp": "2026-01-30T16:24:49.392Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1112s elapsed)",
  "timestamp": "2026-01-30T16:25:19.524Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1142s elapsed)",
  "timestamp": "2026-01-30T16:25:49.586Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1172s elapsed)",
  "timestamp": "2026-01-30T16:26:19.585Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1202s elapsed)",
  "timestamp": "2026-01-30T16:26:49.586Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1232s elapsed)",
  "timestamp": "2026-01-30T16:27:19.587Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1262s elapsed)",
  "timestamp": "2026-01-30T16:27:49.587Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1292s elapsed)",
  "timestamp": "2026-01-30T16:28:19.608Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1322s elapsed)",
  "timestamp": "2026-01-30T16:28:49.667Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1353s elapsed)",
  "timestamp": "2026-01-30T16:29:19.812Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1383s elapsed)",
  "timestamp": "2026-01-30T16:29:49.859Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1413s elapsed)",
  "timestamp": "2026-01-30T16:30:19.934Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1443s elapsed)",
  "timestamp": "2026-01-30T16:30:50.033Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1473s elapsed)",
  "timestamp": "2026-01-30T16:31:20.035Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1503s elapsed)",
  "timestamp": "2026-01-30T16:31:50.035Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1533s elapsed)",
  "timestamp": "2026-01-30T16:32:20.035Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1563s elapsed)",
  "timestamp": "2026-01-30T16:32:50.036Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1593s elapsed)",
  "timestamp": "2026-01-30T16:33:20.036Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1623s elapsed)",
  "timestamp": "2026-01-30T16:33:50.039Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1653s elapsed)",
  "timestamp": "2026-01-30T16:34:20.100Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1683s elapsed)",
  "timestamp": "2026-01-30T16:34:50.273Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1713s elapsed)",
  "timestamp": "2026-01-30T16:35:20.348Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1743s elapsed)",
  "timestamp": "2026-01-30T16:35:50.453Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1773s elapsed)",
  "timestamp": "2026-01-30T16:36:20.502Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1803s elapsed)",
  "timestamp": "2026-01-30T16:36:50.636Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1833s elapsed)",
  "timestamp": "2026-01-30T16:37:20.702Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1863s elapsed)",
  "timestamp": "2026-01-30T16:37:50.767Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1894s elapsed)",
  "timestamp": "2026-01-30T16:38:20.821Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1924s elapsed)",
  "timestamp": "2026-01-30T16:38:50.957Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1954s elapsed)",
  "timestamp": "2026-01-30T16:39:21.019Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (1984s elapsed)",
  "timestamp": "2026-01-30T16:39:51.054Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2014s elapsed)",
  "timestamp": "2026-01-30T16:40:21.148Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2044s elapsed)",
  "timestamp": "2026-01-30T16:40:51.232Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2074s elapsed)",
  "timestamp": "2026-01-30T16:41:21.275Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2104s elapsed)",
  "timestamp": "2026-01-30T16:41:51.275Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2134s elapsed)",
  "timestamp": "2026-01-30T16:42:21.281Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2164s elapsed)",
  "timestamp": "2026-01-30T16:42:51.283Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2194s elapsed)",
  "timestamp": "2026-01-30T16:43:21.318Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2224s elapsed)",
  "timestamp": "2026-01-30T16:43:51.385Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2254s elapsed)",
  "timestamp": "2026-01-30T16:44:21.448Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2284s elapsed)",
  "timestamp": "2026-01-30T16:44:51.531Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2314s elapsed)",
  "timestamp": "2026-01-30T16:45:21.592Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2344s elapsed)",
  "timestamp": "2026-01-30T16:45:51.713Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2375s elapsed)",
  "timestamp": "2026-01-30T16:46:21.789Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2405s elapsed)",
  "timestamp": "2026-01-30T16:46:51.939Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2435s elapsed)",
  "timestamp": "2026-01-30T16:47:22.034Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2465s elapsed)",
  "timestamp": "2026-01-30T16:47:52.104Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2495s elapsed)",
  "timestamp": "2026-01-30T16:48:22.195Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2525s elapsed)",
  "timestamp": "2026-01-30T16:48:52.256Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2555s elapsed)",
  "timestamp": "2026-01-30T16:49:22.358Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2585s elapsed)",
  "timestamp": "2026-01-30T16:49:52.358Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2615s elapsed)",
  "timestamp": "2026-01-30T16:50:22.359Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (2645s elapsed)",
  "timestamp": "2026-01-30T16:50:52.360Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' failed after 2659s: MCP error -32001: AbortError: The operation was aborted.",
  "timestamp": "2026-01-30T16:51:06.191Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Calling MCP tool: codex",
  "timestamp": "2026-01-30T16:51:21.784Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (30s elapsed)",
  "timestamp": "2026-01-30T16:51:51.784Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (60s elapsed)",
  "timestamp": "2026-01-30T16:52:21.785Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (90s elapsed)",
  "timestamp": "2026-01-30T16:52:51.785Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (120s elapsed)",
  "timestamp": "2026-01-30T16:53:21.789Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (150s elapsed)",
  "timestamp": "2026-01-30T16:53:51.792Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' still running (180s elapsed)",
  "timestamp": "2026-01-30T16:54:21.792Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' failed after 208s: MCP error -32000: Connection closed",
  "timestamp": "2026-01-30T16:54:50.571Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Starting connection with timeout of 300000ms",
  "timestamp": "2026-01-30T16:55:14.523Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Successfully connected to stdio server in 128ms",
  "timestamp": "2026-01-30T16:55:14.650Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"codex-mcp-server\",\"title\":\"Codex\",\"version\":\"0.92.0\"}}",
  "timestamp": "2026-01-30T16:55:14.650Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Calling MCP tool: codex",
  "timestamp": "2026-01-30T16:55:14.650Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
{
  "debug": "Tool 'codex' failed after 3s: MCP error -32001: AbortError: The operation was aborted.",
  "timestamp": "2026-01-30T16:55:18.177Z",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "cwd": "/Users/thomas/Dev/myproject"
}
thomaswitt · 5 months ago

@etraut-openai I also found this debug output in /private/tmp/...claude../tasks/, in case that helps....

{
  "parentUuid": "779944d3-055d-4e70-95c2-bc1cc5569cb6",
  "isSidechain": true,
  "userType": "external",
  "cwd": "/Users/thomas/Dev/myproject",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "version": "2.1.25",
  "gitBranch": "264-ingestion",
  "agentId": "afa4c31",
  "slug": "stateful-weaving-pancake",
  "message": {
    "model": "claude-opus-4-5-20251101",
    "id": "msg_01Fn1cbUSCFRhgER3VLbQjL6",
    "type": "message",
    "role": "assistant",
    "content": [
      {
        "type": "tool_use",
        "id": "toolu_01KFTifai2R3nqagY2Qui163",
        "name": "mcp__codex__codex",
        "input": {
          "prompt": "You are reviewing a [...shortened...]",
          "cwd": "/Users/thomas/Dev/myproject"
        },
        "caller": {
          "type": "direct"
        }
      }
    ],
    "stop_reason": null,
    "stop_sequence": null,
    "usage": {
      "input_tokens": 3,
      "cache_creation_input_tokens": 814,
      "cache_read_input_tokens": 53067,
      "cache_creation": {
        "ephemeral_5m_input_tokens": 0,
        "ephemeral_1h_input_tokens": 814
      },
      "output_tokens": 2,
      "service_tier": "standard"
    }
  },
  "requestId": "req_011CXe8KRzESAv3ZF5amaWKf",
  "type": "assistant",
  "uuid": "8306e5d7-6c65-4b0d-80d9-4bc56cadb885",
  "timestamp": "2026-01-30T19:38:39.940Z"
}
{
  "parentUuid": "8306e5d7-6c65-4b0d-80d9-4bc56cadb885",
  "isSidechain": true,
  "userType": "external",
  "cwd": "/Users/thomas/Dev/myproject",
  "sessionId": "76a784c5-ffe7-4bcc-9e34-722017cab969",
  "version": "2.1.25",
  "gitBranch": "264-ingestion",
  "agentId": "afa4c31",
  "slug": "stateful-weaving-pancake",
  "type": "progress",
  "data": {
    "type": "mcp_progress",
    "status": "started",
    "serverName": "codex",
    "toolName": "codex"
  },
  "toolUseID": "toolu_01KFTifai2R3nqagY2Qui163",
  "parentToolUseID": "toolu_01KFTifai2R3nqagY2Qui163",
  "uuid": "b58b00b4-596f-4809-9f3a-82dd88d916b8",
  "timestamp": "2026-01-30T19:38:40.051Z"
}

After a while, this file disappears, but claude still says codex - codex (MCP)(prompt: "You are reviewing...
So maybe the commuication that the job is done doesnt go well?

Penlect · 4 months ago

I can reproduce a narrower root cause for this on codex-cli 0.114.0.

This is not a full MCP handshake failure. initialize and tools/list succeed. The hang is specifically that codex mcp-server never replies to:

  • resources/list
  • resources/templates/list

That explains why /mcp wedges: the snapshot path waits for tools, resources, and resource templates together, so tools may already be available but the overall /mcp request stays blocked until the resource timeout expires.

Minimal JSON-RPC repro

This reproduces against a command that launches codex ... mcp-server over stdio.

Control: initialize and tools/list work

python3 - <<'PY' | timeout 15s <command that launches codex mcp-server>
import json
msgs = [
  {
    "jsonrpc": "2.0",
    "id": 0,
    "method": "initialize",
    "params": {
      "capabilities": {"elicitation": {"form": {}}},
      "clientInfo": {
        "name": "codex-mcp-client",
        "version": "0.114.0",
        "title": "Codex"
      },
      "protocolVersion": "2025-06-18"
    }
  },
  {
    "jsonrpc": "2.0",
    "method": "notifications/initialized"
  },
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list",
    "params": {}
  }
]
for msg in msgs:
    print(json.dumps(msg), flush=True)
PY
````

Observed:

* `initialize` responds immediately
* `tools/list` responds immediately

### Failure: `resources/list` never responds

```bash
python3 - <<'PY' | timeout 8s <command that launches codex mcp-server>
import json
msgs = [
  {
    "jsonrpc": "2.0",
    "id": 0,
    "method": "initialize",
    "params": {
      "capabilities": {"elicitation": {"form": {}}},
      "clientInfo": {
        "name": "codex-mcp-client",
        "version": "0.114.0",
        "title": "Codex"
      },
      "protocolVersion": "2025-06-18"
    }
  },
  {
    "jsonrpc": "2.0",
    "method": "notifications/initialized"
  },
  {
    "jsonrpc": "2.0",
    "id": 2,
    "method": "resources/list",
    "params": {}
  }
]
for msg in msgs:
    print(json.dumps(msg), flush=True)
PY

Observed:

  • initialize responds
  • no response is ever sent for resources/list before timeout kills the pipeline

Failure: resources/templates/list never responds

Same setup, replacing the last request with:

{"jsonrpc":"2.0","id":3,"method":"resources/templates/list","params":{}}

Observed:

  • initialize responds
  • no response is ever sent for resources/templates/list

Source-level explanation

Current source appears to explain this:

  • ClientRequest::ListResourcesRequest and ClientRequest::ListResourceTemplatesRequest are accepted
  • handle_list_resources() and handle_list_resource_templates() only log and return
  • those handlers do not receive RequestId
  • unlike implemented handlers, they never call send_response(...) or send_error(...)

So the server is silently accepting the request and then never replying.

Requested fixes

Server-side

For resources/list and resources/templates/list, please either:

  1. return valid empty results, or
  2. return an explicit JSON-RPC error such as METHOD_NOT_FOUND

The current behavior of accepting the request and never replying is a protocol bug.

Client-side

/mcp should not block tool listing on optional resource enumeration.

Even if one server:

  • lacks resource capability
  • returns method-not-found for resource methods
  • or is slow/broken on resource enumeration

/mcp should still render tools and remain responsive.

This also looks related to the broader “Codex over-indexes on resources/list” issue family for tool-only MCP servers.