Repository navigation
fix(setup): name structural problems in client configurations - #2154
Merged
Merged
Conversation
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>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Some client configurations parse fine but have the wrong shape:
{"mcpServers": null},"mcpServers": "x", a JSON array root[], ormcp_servers = 5in Codex TOML. For these:rea setupreported the raw Zod issue list as the malformed detail. It did not name the key ("path": [],"expected": "record").rea uninstallreportedConfiguration is not valid JSON and was not changed, although the file is valid JSON.parseClientConfigurationnow raisesClientConfigurationShapeErrorfor these cases:"<serversKey>" must be an object,"mcp.servers" must be an objectfor OpenCode V2, orThe configuration root must be an object.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.
parseDocumentis left untouched, so this does not conflict with #2096. The root-shapeZodErrorit raises is translated at theparseClientConfigurationboundary.Fixes #2152
Before / after (isolated HOME,
~/.cursor/mcp.json={"mcpServers": null, "keep": 1})An unparseable file (
{"mcpServers": {) still reportsInvalid JSON/JSONC at offset …in setup andnot valid JSONin uninstall.Validation
tests/boundary/filesystem/clientLifecycle.test.tscover{"mcpServers": null}and[]. Each checks thereadConfigurationFilemalformed 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 lintpasses.npm test: 9155 passed, 14 failed in 7 files. These are the same environmental files that fail on cleanorigin/mainon this host: Hopper not installed, Command Line Tools only (ibtool),hdiutil, and inspector target-location cases.🤖 Generated with Claude Code