Skip to content

fix(codex): set platform env for plugin MCP server#722

Merged
mksglu merged 1 commit into
mksglu:nextfrom
NgoQuocViet2001:fix/codex-mcp-platform-env
May 26, 2026
Merged

fix(codex): set platform env for plugin MCP server#722
mksglu merged 1 commit into
mksglu:nextfrom
NgoQuocViet2001:fix/codex-mcp-platform-env

Conversation

@NgoQuocViet2001

Copy link
Copy Markdown
Contributor

Summary

  • set CONTEXT_MODE_PLATFORM=codex in the Codex plugin MCP manifest
  • document the same env for the manual Codex fallback config
  • add a manifest regression test so the Codex MCP server stays aligned with hook wrappers

Why

On Windows machines with both Claude Code and Codex installed, context-mode can otherwise fall through config-dir detection and pick claude-code because ~/.claude exists before ~/.codex. The Codex hook wrappers already set CONTEXT_MODE_PLATFORM=codex; this makes the plugin MCP server get the same platform signal.

This keeps Codex plugin storage and doctor output under ~/.codex/context-mode instead of accidentally falling back to Claude storage before client/platform metadata is available.

Validation

  • npx vitest run tests/plugins/codex-manifest.test.ts --reporter=dot
  • npx vitest run tests/core/cli.test.ts tests/plugins/codex-manifest.test.ts tests/adapters/detect.test.ts --reporter=dot
  • npx vitest run tests/core/server.test.ts -t "getDefaultSessionDir|ctx_doctor reports storage|Storage sessions" --reporter=dot
  • npm run typecheck
  • git diff --check

Manual Codex check on Windows:

  • Codex CLI: codex-cli 0.133.0
  • installed a temporary local Codex marketplace/plugin containing the updated .codex-plugin/mcp.json
  • codex mcp get context-mode-env-test showed CONTEXT_MODE_PLATFORM attached to the MCP server env, confirming Codex consumes this manifest field in the actual plugin registration path

@mksglu
mksglu merged commit a90d399 into mksglu:next May 26, 2026
5 checks passed
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.

2 participants