Skip to content

Conversation

@bra1nDump
Copy link
Contributor

Summary

Fixes compatibility issues with codex versions 0.43.0-alpha.5 and later by automatically detecting the installed codex version and using the correct MCP subcommand.

Problem

Starting from codex version 0.43.0-alpha.5, OpenAI introduced a new mcp-server subcommand to replace the older mcp command for running Codex as an MCP server. This change broke compatibility for users upgrading to newer versions, causing connection errors like "MCP error -32000: Connection closed" (#39).

Solution

This PR adds automatic version detection that:

  • Detects the installed codex version at runtime using codex --version
  • Uses mcp-server for versions >= 0.43.0-alpha.5
  • Falls back to mcp for older versions (< 0.43.0-alpha.5)
  • Defaults to mcp-server if version detection fails (assumes newer installation)

Testing

  • Tested with codex 0.27.0 (uses mcp)
  • Tested with codex 0.42.0 (uses mcp)
  • Tested with codex 0.43.0-alpha.4 (uses mcp)
  • Tested with codex 0.43.0-alpha.5 (uses mcp-server)
  • Tested with codex 0.44.0 (uses mcp-server)
  • Tested with codex 0.46.0 (uses mcp-server)

Changes

  • Added getCodexMcpCommand() function in src/codex/codexMcpClient.ts
  • Version detection logic with proper parsing of stable and alpha versions
  • Dynamic command selection in the connect() method

Fixes

🤖 Generated with Claude Code
via Happy

Fixes compatibility issues with codex versions 0.43.0-alpha.5 and later
which introduced the new 'mcp-server' subcommand.

The code now:
- Detects the installed codex version at runtime
- Uses 'mcp-server' for versions >= 0.43.0-alpha.5
- Falls back to 'mcp' for older versions
- Defaults to 'mcp-server' if version detection fails

This resolves MCP connection errors when using newer codex versions.

Fixes #39

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@bra1nDump bra1nDump merged commit c2f4d9b into main Oct 10, 2025
4 checks passed
jasonnoahchoi pushed a commit to jasonnoahchoi/happy-cli that referenced this pull request Dec 5, 2025
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.

Codex 0.44.0 MCP Error -32000: Connection closed

2 participants