fix(codex): make MCP startup work in Codex - #81
Conversation
AI ReviewFixes MCP server startup failure in Codex by making Checklist
Issues foundU6 — warning: 1,100-character one-liner embedded in The new
A concrete failure scenario: a developer tries to add a fourth fallback (e.g. Suggested fix (advisory only — not blocking): extract the body into No error-severity issues found. The fix is correct and well-tested for the three main resolution paths (Claude This review was generated automatically. A human maintainer should still make the merge decision. |
|
Hi @sVIKs — thanks for this fix. Two things are needed before it can be merged: 1. Rebase on
git fetch origin
git rebase origin/develop
# resolve CHANGELOG.md and README.md (keep both sides), then:
git rebase --continue
git push --force-with-lease2. Heads-up on the workflow file. This PR modifies After the rebase, the CI run may again sit at |
🤖 Generated with [Claude Code](https://claude.com/claude-code)
ec8106a to
ae78ac0
Compare
|
Rebased onto current The only manual conflict was Fresh verification on the rebased branch: A direct stdio The workflow-file note is understood; no merge was attempted. |
AI ReviewRe-review after synchronize: fixes MCP server startup failure in Codex by making Checklist
Issues foundU6 — warning: 1,100-character one-liner embedded in The
Suggested fix (advisory only — not blocking): extract the body into No error-severity issues found. The fix is correct and well-tested; the PR is clean and mergeable onto This review was generated automatically. A human maintainer should still make the merge decision. |
|
The remaining warning is understood and intentionally not changed in this PR. The inline code is the bootstrap resolver: when Using The current bootstrap has explicit guards, preserves the original Extraction would improve source formatting only after the plugin root is already known; it would not remove the root-discovery logic from |
What & why
Codex can install the Simulator plugin, but the MCP server failed before the JSON-RPC handshake because
.mcp.jsonlaunched it through$CLAUDE_PLUGIN_ROOT/mcp-server/run.sh.In Codex 0.145,
CLAUDE_PLUGIN_ROOTis not exposed to MCP subprocesses, so the shell resolves that command to/mcp-server/run.sh, exits immediately, and Codex reports the startup failure asconnection closed: initialize response.This change keeps Claude Code working and adds Codex-safe plugin-root resolution:
.mcp.jsonstill honors$CLAUDE_PLUGIN_ROOTfirst for Claude Code compatibility.CODEX_HOMEor~/.codex/plugins/cache/simulator/simulator/*.SIMULATOR_WORK_DIR; plugin root and workspace root are no longer conflated.A plain
cwd: "."would not be sufficient here: in Codex it makes$PWDthe plugin cache directory, which would break workspace-sensitive MCP operations.Type of change
Checklist
make build && make vet && make testpass locallymake discoveryproduces nopublic/driftplugins/simulator/docs/— N/A, untouched.envcommitted; TLS verification left on by defaultCHANGELOG.md## [Unreleased]entry addedNotes for reviewers
Verified both host paths explicitly:
CLAUDE_PLUGIN_ROOTand text-substituted$CLAUDE_PLUGIN_ROOT; both completeinitialize+tools/listwith 148 tools.HOME,codex plugin marketplace add,codex plugin add simulator@simulator, command fromcodex mcp list, theninitialize+tools/listwith 148 tools.Additional local checks:
python3 -m json.toolover all plugin/marketplace MCP manifestssh -n plugins/simulator/mcp-server/run.shCLAUDE_PLUGIN_ROOT, invalidCLAUDE_PLUGIN_ROOT+ Codex fallback,~/.codex,CODEX_HOME, local plugin-root layout, local repo-root layoutmake buildmake vetmake testmake discovery+git diff --exit-code -- public/make lintremains advisory and currently reports pre-existing Go lint issues; CI marks that stepcontinue-on-error.