Skip to content

MCP doesn't work for out internal MCP server #5044

Closed

Description

@mgryning

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::WorkerTransportrmcp::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

Activity

  1. added
    bug
    on Oct 10, 2025
  2. added
    mcp
    on Oct 10, 2025
  3. gpeal commented on Oct 14, 2025

    @gpeal
    Contributor

    @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.

  4. added and removed
    bug
    on Oct 14, 2025
  5. mgryning commented on Oct 15, 2025

    @mgryning
    Author

    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

  6. gpeal commented on Oct 15, 2025

    @gpeal
    Contributor

    @mgryning Do you think you could put together a full MCP server using any of the available MCP SDKs that repros this?

  7. added
    enhancement
    and removed on Oct 28, 2025
  8. etraut-openai commented on Nov 15, 2025

    @etraut-openai
    Contributor

    Closing because of lack of response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementmcp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions