Skip to content

feat: use native HTTP transport for Codex CLI#312

Open
MattBro wants to merge 3 commits intomainfrom
matt/codex-streamable-http
Open

feat: use native HTTP transport for Codex CLI#312
MattBro wants to merge 3 commits intomainfrom
matt/codex-streamable-http

Conversation

@MattBro
Copy link
Contributor

@MattBro MattBro commented Mar 3, 2026

Problem

Codex CLI was configured to use SSE transport via mcp-remote, which doesn't support codex mcp login for native OAuth authentication. Then it was trying to login when starting codex, and that was timing out because there was a 10 second timeout. If we rather use codex mcp add posthog --url https://mcp.posthog.com/mcp it triggers oauth at that point, which is nice because then it's already set up when I start codex. Alternatively, we could add it to the ~/.codex/config.toml file, but then the user would have to run codex mcp login posthog which isn't really intuitive.

https://www.loom.com/share/1311023cfcaf466eabad4029e20191d9

Changes

  • Switched Codex from getDefaultServerConfig(apiKey, 'sse') (mcp-remote wrapper) to buildMCPUrl('streamable-http') with native codex mcp add --transport http
  • Same pattern already used by Claude Code client
  • OAuth mode (no API key) just passes the URL, so codex mcp login posthog handles auth natively
  • Updated tests to match new args, added OAuth mode test

How did you test this code

  • Unit tests pass (npx jest --testPathPattern='codex.test' — 9/9 passing)

🤖 Generated with Claude Code

MattBro and others added 2 commits March 3, 2026 16:14
Switches Codex from SSE via mcp-remote to Streamable HTTP using Codex's
native --transport http support, enabling `codex mcp login` OAuth flow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
--url for streamable HTTP servers, --bearer-token-env-var for auth.
Codex doesn't have --transport or --header flags.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MattBro MattBro requested a review from a team March 3, 2026 21:44
@gewenyu99
Copy link
Contributor

gewenyu99 commented Mar 3, 2026

We support Codex? (@daniloc is probably the one we need here)

@rafaeelaudibert
Copy link
Member

@gewenyu99 this is for wizard mcp add so yeah, we support it

Covers both the CLI and the desktop app since they share config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants