Repository navigation
fix(mcp): keep command and args in the same settings layer - #412
Open
raymondginger2018-sudo wants to merge 1 commit into
Open
raymondginger2018-sudo wants to merge 1 commit into
raymondginger2018-sudo wants to merge 1 commit into
Conversation
`mergeMcpServers` resolved `command` and `args` independently: a project entry that names its own command but omits `args` inherited the user-level `args`, which belong to a different executable. The result is a pair no layer ever wrote - e.g. a project-level `.cmd` shim receiving `["@playwright/mcp@latest"]`: the host starts it, it exits on the unknown argument, and that server's tools disappear without an error. Resolve the pair together instead: the layer that supplies `command` owns `args`; borrow `args` across layers only when both name the same command. This also heals configurations already on disk: a project override without args now means "no args" rather than "somebody else's args". Tests: `settings-and-notify.test.ts` 47 passed. The env-priority test asserted the old per-field behaviour for `args`; it now asserts the coherent-pair rule, and a dedicated case covers both branches (different commands vs the same command on both layers). `npm run check` (typecheck + eslint + prettier) is clean.
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
mergeMcpServersresolvescommandandargsindependently:A project entry that names its own command but omits
argstherefore inherits the user-levelargs, which belong to a different executable. The merged pair is one no layer ever wrote — for example a project-level.cmdshim receiving["@playwright/mcp@latest"]. The host spawns it, the shim exits on the unknown argument, and that server's tools disappear with no error anywhere.Change
Resolve the pair together: the layer that supplies
commandownsargs;argsis borrowed across layers only when both layers name the same command.This also heals configurations already on disk: a project override without
argsnow means "no args" instead of "somebody else's args".Tests
settings-and-notify.test.ts: 47 passed.args; it now asserts the coherent-pair rule (env layering is untouched).keeps command and its args in the same layercovers both branches: different commands (args dropped) and the same command on both layers (args inherited).npm run check(typecheck + eslint + prettier): clean.Notes
Two failures in
model-settings.test.tsare pre-existing on this machine, not caused by this change: they fail identically with the patch stashed (git stashA/B on the same tree,pass 4 / fail 2both ways).