Repository navigation
[BR-2276] Detect MCP config capability across operating systems - #1363
Open
sunishsheth2009 wants to merge 5 commits into
Open
sunishsheth2009 wants to merge 5 commits into
sunishsheth2009 wants to merge 5 commits into
Conversation
sunishsheth2009
force-pushed
the
sunish/br-2276-agent-detection
branch
from
October 29, 2026 23:29
f9e62ad to
f2589d1
Compare
sunishsheth2009
marked this pull request as ready for review
October 30, 2026 04:06
sunishsheth2009
force-pushed
the
sunish/br-2276-agent-detection
branch
from
October 30, 2026 19:24
f55b388 to
edb6048
Compare
sunishsheth2009
added a commit
to sunishsheth2009/ucode
that referenced
this pull request
Oct 30, 2026
…cks#1364) ## BR-2167 Coding agents keep MCP registrations in a global config keyed by server name. Adding workspace B's MCP server while workspace A remains active can expose B's tools to an A session; appending a workspace suffix does not isolate the sessions. Model configuration already selects one active workspace. This PR makes MCP registration follow that active-workspace boundary: - `ug mcp add --workspace B` refuses to register while A is active and points to `ug configure --workspace B`. On first setup, MCP add selects its workspace without configuring agent models. - An explicit configure switch saves the destination workspace's own MCP selections, removes registrations left from the previous workspace, configures models and policy, then restores the destination's saved user MCP entries. Managed MCPs are reconciled before user entries are restored, including the single-agent Codex path. - Switching back restores A's saved MCP entries. A and B can use the same server name; the active agent config contains the selected workspace's URL under that name, with no workspace suffix. - MCP-only configure paths and Claude Cowork sync use the selected workspace. README documents the switch. Example: with A active and `system-ai-github` saved for A, first run `ug configure --workspace B --agent codex`. A's registration is removed and B's saved registration is installed, if one exists. Run `ug mcp add --agents codex --names system.ai.github` if B has no saved selection. Start a new Codex session to use B's tools. Running `ug configure --workspace A --agent codex` restores A's saved URL. ## Validation - `tests/test_mcp.py tests/test_cli.py tests/test_agent_vscode.py`: 1,023 passed locally after the review fixes. - Workspace-switch regression covers A → B → A, including identical MCP names with different workspace URLs, and the active workspace on first MCP setup. - Ruff check/format on `src/` and `tests/`, Ty check on `src/`, and `git diff --check` passed. - Fixed the Linux/Windows VS Code unit fixture and preserved source-workspace managed MCP delivery state until reconciliation. The new regression verifies removal of a stale managed fallback while retaining destination user choices. - Review fixes: stale entries are matched per (name, client); restoration reads post-reconciliation state; and a saved workspace is restored after revert leaves no active workspace. Focused regressions cover all three. - The preceding CI run passed Linux and Windows unit tests, the Claude managed-config workspace-switch journey, CUJ 6 repeated config/removal, and the full Codex Linux journey. CI for the review-fix commit is pending. - The earlier live staging test covered MCP registration with a disposable HOME and unchanged machine-wide files. A live A → B → A agent session/tool call was not rerun for this revision. LiteSwap does not exercise local CLI/agent config paths. BR-2276 PR databricks#1363 changes nearby MCP client detection and registration code but has no functional dependency. Rebase it after this PR if this merges first.
xsh310
approved these changes
Oct 30, 2026
xsh310
reviewed
Oct 30, 2026
xsh310
reviewed
Oct 30, 2026
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.
BR-2276
UG could report Claude Code or Codex as unavailable when their CLI was off PATH, even though UG could write the agent's user MCP config. The previous macOS app-path check also missed other install layouts and did not cover Windows or Linux.
This change detects MCP configuration capability through each agent's existing config path resolver:
mcp liststatus.CLAUDE_CONFIG_DIRandCODEX_HOMEremain supported.ug mcp add --agents claudeor--agents codexcan create user MCP config even with no CLI on PATH and no prior config. Removal uses the same direct writers.This PR is based on main and contains only BR-2276 changes. The MCP workspace-selection prerequisite, #1364, has merged.
Validation
tests/test_mcp.py tests/test_cli.py tests/test_agent_vscode.py: 1,062 passed on the rebased branch.src/andtests/, Ty check forsrc/, andgit diff --checkpassed.Limit
A config file can survive an uninstallation. Config-only detection means UG can write that client's user MCP configuration; it does not prove the app is currently installed. Fresh installs with no CLI and no config require explicit
--agentsselection.