Skip to content

fix(mcp): Codex MCP declarative (config base), not blocking CLI#37

Merged
vaintrub merged 1 commit into
masterfrom
fix/codex-mcp-no-hang
May 31, 2026
Merged

fix(mcp): Codex MCP declarative (config base), not blocking CLI#37
vaintrub merged 1 commit into
masterfrom
fix/codex-mcp-no-hang

Conversation

@vaintrub

Copy link
Copy Markdown
Owner

Regression (from #36)

codex mcp add --url <remote> blocks/fails in non-interactive chezmoi apply — on the jetson it ran slow then printed codex mcp add context7 failed. CI missed it (CI's codex is unauthed → fails fast, no hang). The graceful || echo failed meant apply still completed, but Codex MCP never registered + the slow-fail is ugly.

Fix — declarative, not CLI

Codex MCP servers live in ~/.codex/config.toml [mcp_servers], which the repo already manages via modify_config.toml + codex-config-base.toml. So render them there from the shared mcp: list:

[mcp_servers.context7]
url = "https://mcp.context7.com/mcp"

No CLI, no node/auth/network during apply — just config. (Schema verified against Codex config reference; remote-http MCP is stable, not experimental.)

Claude keeps claude mcp add -s user --transport http (works; no declarative user-scope config file exists for it).

Still one source

packages.yaml mcp: drives both — Claude reads it in the 70 script (CLI), Codex's config base renders it (declarative). Removed the hanging codex mcp add loop from 70.

Verified

  • 70 renders: claude mcp add ×1, codex mcp add ×0; sh -n OK.
  • chezmoi cat ~/.codex/config.toml (full modify_ pipeline) → valid TOML with [mcp_servers.context7] url=… (merge preserves it — proven earlier).

#36's 'codex mcp add --url' blocks/fails on remote servers in non-interactive
chezmoi apply (seen on the jetson: slow then 'failed'; CI missed it — unauthed
codex failed fast). Codex MCP belongs in ~/.codex/config.toml [mcp_servers],
already managed by modify_config.toml — so render it declaratively in
codex-config-base.toml from the shared mcp: list. No CLI, no node/auth/network
during apply. Claude keeps its working 'claude mcp add' (no declarative
user-scope path exists). Same single source (packages.yaml mcp:).
@vaintrub vaintrub merged commit 9a8342f into master May 31, 2026
3 checks passed
@vaintrub vaintrub deleted the fix/codex-mcp-no-hang branch May 31, 2026 15:03
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.

1 participant