MCP doesn't work for out internal MCP server
What version of Codex is running?
codex-cli 0.46.0
Which model were you using?
GPT-5-Codex
What platform is your computer?
Linux 5.15.167.4-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
I cannot get our internal mcp server to properly connect in Codex. I works fine in Claude Code.
This is the output after a longer debugging session with Codex:
- Every Codex launch logged MCP client for 'sql' failed to start: handshaking with MCP server failed: Send message error Transport
[rmcp::transport::worker::WorkerTransport<rmcp::transport::streamable_http_client::Client>> error: Transport channel closed, when send
initialized notification in ~/.codex/log/codex-tui.log.
- The MCP SQL server showed back-to-back Session created immediately followed by Session deleted, indicating the client dropped the
connection right after the notification step.
- Direct curl tests confirmed the server initially required a JSON payload and echoed Mcp-Session-Id; when those were missing the server
returned 400 Method not found: undefined, which likely triggered the transport close.
- Even after the server began returning 200 OK (i changed this on the server to ignore with header was missing) for the empty notifications/initialized request, Codex’s experimental RMCP transport
continued to abort the handshake with the same “transport channel closed” message.
- Using the npx mcp-remote@latest … --log bridge succeeds end-to-end; the handshake problem only occurs with the built-in RMCP client
in Codex.
No matter what I do, the MCP just doesn't seem to work properly using HTTPS protocol
What is the expected behavior?
That the MCP works like in Claude Code
What do you see instead?
Failed to connect
Additional information
_No response_
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
@mgryning Because your MCP server isn't public, would it be possible to isolate exactly where Codex is doing something unexpected? I'm happy to take a look if you're able to provide more specifics here.
Hi @gpeal
I cannot share the full source, but what seems to be happening is that codex connects, fails to initialize handshake, and then disconnect again. It seems that Codex connects with empty handshake.
I can share the route and middleware files used that specify the endpoints for my mcp server
session-middleware.js
router-factory.js
@mgryning Do you think you could put together a full MCP server using any of the available MCP SDKs that repros this?
Closing because of lack of response.