Skip to content

Fix Codex TOML parsing dropping multi-line/trailing-comma args arrays (silent version wipe on re-setup) - #3063

Open
wallidsaydi-creator wants to merge 1 commit into
upstash:masterfrom
wallidsaydi-creator:fix/codex-toml-multiline-args
Open

Fix Codex TOML parsing dropping multi-line/trailing-comma args arrays (silent version wipe on re-setup)#3063
wallidsaydi-creator wants to merge 1 commit into
upstash:masterfrom
wallidsaydi-creator:fix/codex-toml-multiline-args

Conversation

@wallidsaydi-creator

Copy link
Copy Markdown

Follow-up to #3060 (thanks @fahreddinozcan for the quick ack). Opening this PR so the fix is reviewable directly — no pressure on timing.

What it fixes

readTomlServerEntry in packages/cli/src/setup/mcp-writer.ts parses Codex config.toml server entries with per-line JSON.parse, which silently drops args when:

  1. The array is multi-line — what taplo/Prettier/cargo-fmt produce once a line exceeds print width (any real API key makes this likely).
  2. The array has a trailing comma — valid TOML, invalid JSON.

Downstream, isStdioContext7Entry then fails, resolveEntryToWrite falls back to a fresh canonical entry, and a re-setup that was only meant to rotate the API key silently wipes the user's pinned @upstash/context7-mcp@<version> to a floating version. Full repro chain in #3060.

The change

  • String-aware bracket balancing to join multi-line arrays before parsing.
  • String-aware trailing-comma strip (commas inside string literals are untouched).

Verification

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