[Bug] MCP stdio server fails to connect in interactive sessions with error -32000, succeeds in standalone invocations
Bug Description
codex-worker (stdio MCP server) consistently fails to connect from an interactive session
with error "-32000", while a standalone claude mcp list invocation from a plain terminal
succeeds consistently and reliably.
Config (.mcp.json, project scope):
{
"mcpServers": {
"codex-worker": {
"type": "stdio",
"command": "node",
"args": ["<absolute-path>/@openai/codex/bin/codex.js", "mcp-server"],
"env": {}
}
}
}
Versions: Claude Code 2.1.215 (also reproduced on 2.1.198 before auto-update mid-session),
Node v26.3.0, Windows 11.
Ruled out (still fails after each):
- Removing the cmd.exe wrapper, invoking node directly on the .js entry point
- Setting MCP_TIMEOUT=20000 before launch
- Running from an elevated (Administrator) PowerShell vs a standard one
- A completely fresh app window/process (not just /exit and back)
- Manual "Reconnect" from within /mcp on an already-approved server
Consistent pattern: every standalone claude mcp list (or claude --debug= mcp list)
invocation succeeds and shows codex-worker as Connected. Every interactive session's own
connection attempt at startup, and its own "Reconnect" action, fails with -32000.
Also found: ~/.claude.json has 6 different project-state entries for the same directory
(backslash vs forward-slash, case variations) — only the forward-slash variant
(F:/CaseFlow-Cloud) carries real session data (lastSessionId, lastGracefulShutdown, etc).
This looks like project-key normalization inconsistency, possibly introduced by an
auto-update that happened mid-session (2.1.198 -> 2.1.215). Unconfirmed whether this is
the root cause of the -32000, but it's a real, reproducible anomaly worth checking.
Environment Info
- Platform: win32
- Terminal: null
- Version: 2.1.215
- Feedback ID: 54a2e781-5716-43fc-b824-82b91718c898
Errors
[]This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗