Skip to content

fix(setup): name structural problems in client configurations - #2154

Merged
kaoru0822-kitauji merged 1 commit into
mainfrom
fix/issue-2152
Oct 12, 2026
Merged

kaoru0822-kitauji merged 1 commit into
mainfrom
fix/issue-2152

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Summary

Some client configurations parse fine but have the wrong shape: {"mcpServers": null}, "mcpServers": "x", a JSON array root [], or mcp_servers = 5 in Codex TOML. For these:

  • rea setup reported the raw Zod issue list as the malformed detail. It did not name the key ("path": [], "expected": "record").
  • rea uninstall reported Configuration is not valid JSON and was not changed, although the file is valid JSON.

parseClientConfiguration now raises ClientConfigurationShapeError for these cases: "<serversKey>" must be an object, "mcp.servers" must be an object for OpenCode V2, or The configuration root must be an object.

  • Setup's malformed detail carries that message.
  • Uninstall uses it (Configuration was not changed: "mcpServers" must be an object. Repair it, then rerun uninstall.). The "not valid JSON/TOML/JSONC" wording is kept for genuine parse failures.

Nothing changes about what is written: these files are still refused unchanged, with no backup.

parseDocument is left untouched, so this does not conflict with #2096. The root-shape ZodError it raises is translated at the parseClientConfiguration boundary.

Fixes #2152

Before / after (isolated HOME, ~/.cursor/mcp.json = {"mcpServers": null, "keep": 1})

setup   before: …/mcp.json is malformed: [ { "expected": "record", "code": "invalid_type", "path": [], "message": "Invalid input: expected record, received null" } ]
setup   after:  …/mcp.json is malformed: "mcpServers" must be an object
uninstall before: Configuration is not valid JSON and was not changed. Repair it, then rerun uninstall.
uninstall after:  Configuration was not changed: "mcpServers" must be an object. Repair it, then rerun uninstall.

An unparseable file ({"mcpServers": {) still reports Invalid JSON/JSONC at offset … in setup and not valid JSON in uninstall.

Validation

  • New cases in tests/boundary/filesystem/clientLifecycle.test.ts cover {"mcpServers": null} and []. Each checks the readConfigurationFile malformed detail, the uninstall item detail, and that the file is unchanged. They fail on main and pass with this change; all 50 tests in the file pass.
  • npm run lint passes.
  • npm test: 9155 passed, 14 failed in 7 files. These are the same environmental files that fail on clean origin/main on this host: Hopper not installed, Command Line Tools only (ibtool), hdiutil, and inspector target-location cases.

🤖 Generated with Claude Code

A client configuration that parses but whose root or MCP server table is
not an object (for example {"mcpServers": null} or []) made setup print a
raw Zod issue dump and made uninstall claim the file was not valid JSON.
parseClientConfiguration now raises a ClientConfigurationShapeError naming
the root or the servers key, which setup reports as the malformed detail
and uninstall reports instead of a syntax error.

Fixes #2152

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T11:57:04.450817Z 49f9360 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kaoru0822-kitauji
kaoru0822-kitauji merged commit 51367ca into main Oct 12, 2026
30 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/issue-2152 branch October 12, 2026 13:53
@github-actions github-actions Bot mentioned this pull request Oct 12, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: cli CLI adapter and one-shot commands labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] setup and uninstall misdescribe a client config whose root or server table is not an object

2 participants