Skip to content

Attempts OAuth even when the MCP SSE server does not support oauth #5588

Closed

Description

@gitcnd

What version of Codex is running?

codex-cli 0.47.0

What subscription do you have?

Plus

Which model were you using?

n/a

What platform is your computer?

WSL (Ubuntu, windows 10)

What issue are you seeing?

Says ■ MCP client for rog failed to start: handshaking with MCP server failed: connection closed: initialize response

After:-

Tries OAuth - 404 does not exist:-

12:34:39 Connect from ('127.0.0.1', 60802)
12:34:39 Request from 127.0.0.1:60802 < {'Method': 'GET', 'Path': '/.well-known/oauth-authorization-server/sse', 'Headers': {'mcp-protocol-version': '2024-11-05', 'accept': '/', 'host': 'allow-127-0-0-1.local.aurafriday.com:31173'}, 'Body length': 0} Body:
12:34:39 RESPonse to 127.0.0.1:60802 > b'HTTP/1.1 404 Not Found\r\nContent-Type: text/plain\r\nContent-Length: 9\r\nConnection: close\r\nAccess-Control-Allow-Origin: null\r\nAccess-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Allow-Credentials: true\r\nAccess-Control-Max-Age: 86400\r\nContent-Type: text/plain; charset=utf-8\r\nCache-Control: no-store\r\nContent-Length: 9\r\n\r\nNot Found'
12:34:39 Session Initiated graceful socket shutdown (FIN sent)

Tries streaming HTTP - works fine:-

12:34:39 Connect from ('127.0.0.1', 60803)
12:34:39 Request from 127.0.0.1:60803 < {'Method': 'POST', 'Path': '/sse', 'Headers': {'accept': 'text/event-stream, application/json', 'content-type': 'application/json', 'host': 'allow-127-0-0-1.local.aurafriday.com:31173', 'content-length': '198'}, 'Body length': 198} Body: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"202
5-06-18","capabilities":{"elicitation":{}},"clientInfo":{"name":"codex-mcp-client","title":"Codex","version":"0.47.0"}}}
12:34:39 Streaming HTTP Parsed initial request: {'jsonrpc': '2.0', 'id': 0, 'method': 'initialize', 'params': {'protocolVersion': '2025-06-18', 'capabilities': {'elicitation': {}}, 'clientInfo': {'name': 'codex-mcp-client', 'title': 'Codex', 'version': '0.47.0'}}}
12:34:39 New streaming HTTP connection from 127.0.0.1:60803, session_id=d9f8203e86bc402295a5eee5367c2467
12:34:39 Streaming HTTP response to 127.0.0.1:60803 > b'HTTP/1.1 200 OK\r\nContent-Type: text/event-stream; charset=utf-8\r\nConnection: keep-alive\r\nCache-Control: no-store\r\nX-Accel-Buffering: no\r\nAccess-Control-Allow-Origin: null\r\nAccess-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Allow-Credentials: true\r\nAcces
s-Control-Max-Age: 86400\r\n\r\nevent: endpoint\r\ndata: /messages/?session_id=d9f8203e86bc402295a5eee5367c2467\r\n\r\n'
12:34:39 Streaming HTTP Processing initial request for session d9f8203e86bc402295a5eee5367c2467
12:34:40 JSONRPC Request session=d9f8203e86bc402295a5eee5367c2467, method=initialize, id=0
12:34:40 SSE Message to 127.0.0.1:60803 > data: {"jsonrpc": "2.0", "id": 0, "result": {"protocolVersion": "2025-06-18", "capabilities": {"experimental": {}, "prompts": {"listChanged": false}, "resources": {"subscribe": false, "listChanged": false}, "tools": {"listChanged": false}}, "serverInfo": {"name": "mcp-link-server", "version": "1.2.30", "workspace_contained": false}}}\r\n\r\n0m

Inexplicably, re-tries OAuth again on a new connection:-

12:34:40 Connect from ('127.0.0.1', 60804)
12:34:40 Request from 127.0.0.1:60804 < {'Method': 'GET', 'Path': '/sse/.well-known/oauth-authorization-server', 'Headers': {'mcp-protocol-version': '2024-11-05', 'accept': '/', 'host': 'allow-127-0-0-1.local.aurafriday.com:31173'}, 'Body length': 0} Body:
12:34:40 Auth Found UUID 'allow' in hostname 'allow-127-0-0-1.local.aurafriday.com:31173' from 127.0.0.1:60804
12:34:40 Auth Attempting Hostname UUID for user: rog_codex from 127.0.0.1:60804
12:34:40 Auth Successful Hostname UUID authentication for user: rog_codex from 127.0.0.1:60804
12:34:40 RESPonse to 127.0.0.1:60804 > b'HTTP/1.1 404 Not Found\r\nContent-Type: text/plain\r\nContent-Length: 9\r\nConnection: close\r\nAccess-Control-Allow-Origin: null\r\nAccess-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Allow-Credentials: true\r\nAccess-Control-Max-Age: 86400\r\nContent-Type: text/plain; charset=utf-8\r\nCache-Control: no-store\r\nContent-Length: 9\r\n\r\nNot Found'
12:34:40 Session Initiated graceful socket shutdown (FIN sent)

And tried a thrid time as well:-

12:34:40 Connect from ('127.0.0.1', 60805)
12:34:40 Request from 127.0.0.1:60805 < {'Method': 'GET', 'Path': '/.well-known/oauth-authorization-server', 'Headers': {'mcp-protocol-version': '2024-11-05', 'accept': '/', 'host': 'allow-127-0-0-1.local.aurafriday.com:31173'}, 'Body length': 0} Body:
12:34:40 Auth Found UUID 'allow' in hostname 'allow-127-0-0-1.local.aurafriday.com:31173' from 127.0.0.1:60805
12:34:40 Auth Attempting Hostname UUID for user: rog_codex from 127.0.0.1:60805
12:34:40 Auth Successful Hostname UUID authentication for user: rog_codex from 127.0.0.1:60805
12:34:40 RESPonse to 127.0.0.1:60805 > b'HTTP/1.1 404 Not Found\r\nContent-Type: text/plain\r\nContent-Length: 9\r\nConnection: close\r\nAccess-Control-Allow-Origin: null\r\nAccess-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Allow-Credentials: true\r\nAccess-Control-Max-Age: 86400\r\nContent-Type: text/plain; charset=utf-8\r\nCache-Control: no-store\r\nContent-Length: 9\r\n\r\nNot Found'
12:34:40 Session Initiated graceful socket shutdown (FIN sent)

But, even though it obtained a successful session ID and established a working connection... it then reports a fail.

[cnd@RoG:~/Downloads/cursor/python_mcp]$ codex
╭─────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.47.0) │
│ │
│ model: gpt-5-codex /model to change │
│ directory: /mnt/c/Users/cnd/Downloads/cursor/python_mcp │
╰─────────────────────────────────────────────────────────╯

To get started, describe a task or try one of these commands:

/init - create an AGENTS.md file with instructions for Codex
/status - show current session configuration
/approvals - choose what Codex can do without approval
/model - choose what model and reasoning effort to use
/review - review any changes and find issues

■ MCP client for rog failed to start: handshaking with MCP server failed: connection closed: initialize response

› Explain this codebase

100% context left · ? for shortcuts

What steps can reproduce the bug?

Connect to any MCP SSE server that doesn't support oauth, and watch the exchange

What is the expected behavior?

Uses the working connection it already established! (instead of reporting an error)

Additional information

This is a localhost SSE (127.0.0.1) with local prompting for connection approval, so it's always safe to use without oauth

Activity

  1. added
    mcpIssues related to the use of model context protocol (MCP) servers
    on Oct 24, 2025
  2. rvbuelow commented on Oct 24, 2025

    @rvbuelow

    I've just ran into this issue when updating from v0.47.0 to v0.48.0 which broke the codex-mcp-memory integration. Reverting to v0.47.0 makes it work again.

  3. gpeal commented on Oct 24, 2025

    @gpeal
    Contributor

    Codex only supports streamable http servers, not SSE. The release notes were incorrect and have been fixed. Sorry for the confusion.

  4. gitcnd commented on Oct 25, 2025

    @gitcnd
    Author

    My bad - I said SSE when I meant Streaming HTTP - as you can see from the logs, this is not SSE.

    This is a bug, not a doc mistake.

  5. reopened this on Oct 25, 2025
  6. self-assigned this
    on Oct 25, 2025
  7. gpeal commented on Oct 29, 2025

    @gpeal
    Contributor

    @gitcnd is this MCP server public? If it's not, it might be tricky to debug. Codex will go through oauth discovery to see if a server supports it but shouldn't require it. I just tried with the figma localhost mcp server and it worked fine. Any suggestions to repro?

  8. gitcnd commented on Nov 1, 2025

    @gitcnd
    Author

    Yes - it's a self-contained solution available here: https://github.com/AuraFriday/mcp-link-server/releases (more info at www.aurafriday.com )
    Let me know if I can help with anything!

  9. etraut-openai commented on Jan 17, 2026

    @etraut-openai
    Contributor

    Closing out old bugs.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmcpIssues related to the use of model context protocol (MCP) servers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions