fix: add an MCP status command and report discovered-config drift - #1160
Draft
sahrizvi wants to merge 1 commit into
Draft
fix: add an MCP status command and report discovered-config drift#1160sahrizvi wants to merge 1 commit into
sahrizvi wants to merge 1 commit into
Conversation
`status` is the name people reach for when a server will not connect, and it was the one name that did not exist. The gap was narrower than it looks: `mcp list` already probed live and already printed the failure reason, so `status` is registered as a sibling sharing that handler rather than a second view to keep in sync. It is a distinct command rather than an alias because an alias widens yargs' alias column enough to rewrap unrelated sibling rows in the help output. MCP discovery is first-source-wins, so a server already present in the user's config was skipped outright and a changed `.vscode/mcp.json` — a new port, a moved command — was never mentioned. `driftFields()` now reports which fields disagree, naming nested keys individually (`environment.ALTIMATE_EXTENSION_RPC`) so the message points at the thing to fix. The configured value still wins; silently overwriting a user's own config would be worse than the silence it replaces. Closes #790 Closes #878 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018fJ3X7pcGT4R9yzjsJnqsV
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
6 tasks
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #790
Closes #878
Type of change
What does this PR do?
1. Adds
mcp status(#790).statusis the name people reach for when a server won't connect, and it was the one name that didn't exist.Being straight about the size of this: the gap was narrower than the issue implies.
mcp listalready probed live (mcp.status()initialises the MCP service) and already printed the failure reason. The missing piece was the entry point, not the view — sostatusshares that handler rather than duplicating a view that would then need keeping in sync.It's a sibling command rather than an alias because
aliases: ["ls", "status"]widened yargs' alias column enough to rewrap an unrelated row (mcp auth listlost its[aliases: ls]onto a second line). As its own command the help output stays additive — the diff against the committed snapshot is exactly one added line.2. Reports discovered-config drift (#878). Discovery is first-source-wins, so a server already in the user's config is skipped outright, and a changed
.vscode/mcp.json— a newALTIMATE_EXTENSION_RPCport, a moved command — was never mentioned.driftFields()now reports which fields disagree, naming nested keys individually (environment.ALTIMATE_EXTENSION_RPC) so the message points at the thing to fix rather than justenvironment.enabledis excluded, since discovery sets it for its own reasons.The configured value still wins. This reports the disagreement and where to look, and leaves the decision to the user — silently overwriting someone's own config would be worse than the silence it replaces. That's the "detect and report" option of the three the issue offered.
How did you verify your code works?
opencodesuite: no regressions.HOMEplus a temp project containing a drifted.vscode/mcp.json, asserting both that the drifted field is named and that an agreeing config stays silent.statusregistration, each fails exactly one test.origin/main; typecheck clean.Flaky tests, flagged rather than hidden: the subprocess-heavy suites (
test/pty,test/cli/run) fail intermittently under parallel load — different tests each run, all passing across repeated isolated runs. These flakes pre-date this PR, but it does make them more likely to surface: it adds two more e2e files that each spawn real CLI subprocesses.Test-harness fix worth knowing about: the e2e pattern copied from
mcp-add.test.tsusesbun run --cwd <pkg>, which makes the CLI's working directory the repo package — so it read the repo's own.opencodeconfig and never saw the temp project, meaning discovery never ran and the drift assertion couldn't fire. Fixed here by setting the spawn cwd to the project.mcp-add.test.tsis unaffected in practice (it passes--global), so it's left alone.Screenshots / recordings
Not a UI change.
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_018fJ3X7pcGT4R9yzjsJnqsV