mcp add/remove: add --agents to target (and set up) specific agents - #353
Merged
sunishsheth2009 merged 1 commit intoAug 20, 2026
Conversation
Collaborator
|
i'm worried this creates multiple entrypoints for agent configuration which will be confusing. could you link the issue/complaint that prompted this change? |
xsh310
approved these changes
Aug 20, 2026
`ucode mcp add`/`remove` previously operated on every configured MCP client, with no way to scope to a subset — and `mcp add` required the agent to be set up already (via `ucode configure`), so a first-time setup needed two commands. Add `--agents`: - `mcp add --agents claude[,codex,...]` registers the server(s) for exactly those agents. Any that aren't configured yet are set up first (workspace + models, reusing the `configure --agents` path), so `ucode mcp add --agents claude --services system.ai.slack` is one-command setup. - `mcp remove --agents <list>` scopes removal: a server registered on several agents is unregistered only from the named ones and kept on the rest; only servers on a named agent are offered. Threads an `agents` filter through setup_mcp_clients; the CLI reuses configure_workspace_command for the add-side auto-setup. Without `--agents` behavior is unchanged.
sunishsheth2009
force-pushed
the
sunish-sheth_data/mcp-add-agents
branch
from
August 20, 2026 23:27
9e86b37 to
c5f0204
Compare
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.
What
Add an
--agentsoption toucode mcp addanducode mcp remove.Today both commands operate on every configured MCP client, and
mcp addrequires the agent to already be set up (viaucode configure) — so connecting a fresh agent to an MCP server takes two commands.ucode mcp add --agents <list>— register the server(s) for exactly those agents. Any that aren't configured yet are set up first (workspace + models), reusing theconfigure --agentspath, so it doubles as one-command setup:ucode mcp add --agents claude --services system.ai.slack # sets up claude if needed, then registers ucode mcp add --agents claude,codex --location system.aiucode mcp remove --agents <list>— scope removal to those agents. A server registered on several agents is unregistered only from the named ones and kept on the rest; only servers on a named agent are offered in the picker.Without
--agents, both commands behave exactly as before.Why
This makes
ucode mcp adda one-stop command: it can set the agent up and register the MCP server, so callers (and the Catalog Explorer / docs snippets) no longer need a separateucode configure --agentsstep. It's the natural home for the agent+MCP bundling thatconfigure --mcpused to provide, now under themcpverb namespace.How
setup_mcp_clientsgrows anagentsfilter that scopes the resolved clients (and errors clearly if a named agent isn't configured).add_mcp_commandthreadsagentsthrough to that filter; the CLI'smcp addreusesconfigure_workspace_commandto set up any un-configured named agents before registering.remove_mcp_commandapplies agent-scoped removal: it presents each selected server to the existing removal machinery with its client list narrowed to the named agents, then keeps the entry (with those agents stripped) or drops it when no agents remain.Testing
uv run ruff format/ruff check,uv run ty check src/, anduv run pytestall pass. Addedtests/test_mcp.pycoverage: add scoped to a subset of configured agents, add erroring on an unconfigured agent, remove scoped to one agent (kept on the rest), and remove offering only servers on the named agent. The only suite failures are the two pre-existing network-dependenttest_e2e_user_agenttests.This pull request and its description were written by Isaac.