Preserve MCP client config and secure install writes - #267
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4e7ebef. Configure here.
tnsardesai
left a comment
There was a problem hiding this comment.
Correctness
- Non-blocking bug — Nested duplicate keys are accepted —
cmd/mcp/config.go:L411-L419- Problem:
objectAtchecks only the objects it visits. Install succeeds with two differentAuthorizationkeys insidekernel.headers; I reproduced this against the reviewed head. - Impact: the client may interpret an ambiguous authentication value differently.
- Fix: check object keys recursively before patching, including imported legacy fields.
- Evidence: the PR body says ambiguous config is rejected.
- Problem:
Standards
- Non-blocking CI coverage gap — Go tests do not run on this stacked PR —
PR-level- Problem: this PR targets
hypeship/add-antigravity-mcp-target, but.github/workflows/test.yamlruns on pull requests targetingmainonly. - Impact: reviewers have no Go test check on this PR head.
make testpassed locally. - Fix: run the workflow against this head SHA or cover stacked PRs in its trigger.
- Problem: this PR targets
masnwilliams
left a comment
There was a problem hiding this comment.
This is a meaningful improvement over the per-client installers: hand-edited Kernel fields and other servers survive reinstalls, the config keeps its surrounding formatting, and credential-capable files get private permissions. I ran go test ./... locally; it passes.
A few follow-ups worth addressing, though I would not block this PR on them:
objectAtchecks duplicate keys only along the paths being edited. A config with twoAuthorizationkeys inkernel.headersstill installs successfully and retains both. This was also identified in the existing review. Validating object keys recursively once when reading the destination and legacy documents would make the stated rejection of ambiguous config reliable and remove repeated validation during patching.- For VS Code,
installConfigchmods legacysettings.jsonbefore writingmcp.json. With an unwritable destination directory, install fails, but the old settings file has already changed from 0644 to 0600. Please move that side effect after a successful destination write or report it as a separate operation, and cover the failure path. mergeConfignow owns section creation, legacy import, transport migration, stdio argument parsing, fx auth policy, and syntax-tree edits. As more targets evolve, I would split document mutation from transport-specific entry policy rather than extend theconfigFieldoptions (ifMissing/skipWhen) for additional special cases.
None of these changes the overall direction or the existing approval.
896e43c to
4d111d3
Compare

Summary
Validation
Remaining limits
Note
Medium Risk
The CLI now edits real user config files on disk with new validation and VS Code path/migration behavior; mistakes could break MCP setup or permissions, though atomic writes and tests reduce exposure.
Overview
Replaces per-editor install helpers with a spec-driven
kernel mcp installflow in newconfig.go, using hujson to patch only the Kernel MCP entry while keeping other servers, custom Kernel fields (headers, fxbearer_token_env), and mcp-remote CLI flags.Install now rejects empty/malformed JSON, duplicate keys, and symlink config paths without mutating the file; VS Code targets user
mcp.json(servers.kernel) and copies missing Kernel fields from legacysettings.json(mcp.servers). Writes go through private temp files + atomic rename, tighten modes to 0600 when needed, and skip rewrites when content already matches.installhelp text is generated fromtargetSpecs. Adds broad regression tests inconfig_test.goand the tailscale/hujson dependency.Reviewed by Cursor Bugbot for commit 4d111d3. Bugbot is set up for automated code reviews on this repo. Configure here.