Skip to content

mcp add/remove: add --agents to target (and set up) specific agents - #353

Merged
sunishsheth2009 merged 1 commit into
databricks:mainfrom
sunishsheth2009:sunish-sheth_data/mcp-add-agents
Aug 20, 2026
Merged

mcp add/remove: add --agents to target (and set up) specific agents#353
sunishsheth2009 merged 1 commit into
databricks:mainfrom
sunishsheth2009:sunish-sheth_data/mcp-add-agents

Conversation

@sunishsheth2009

Copy link
Copy Markdown
Collaborator

What

Add an --agents option to ucode mcp add and ucode mcp remove.

Today both commands operate on every configured MCP client, and mcp add requires the agent to already be set up (via ucode 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 the configure --agents path, 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.ai

ucode 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 add a 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 separate ucode configure --agents step. It's the natural home for the agent+MCP bundling that configure --mcp used to provide, now under the mcp verb namespace.

How

  • setup_mcp_clients grows an agents filter that scopes the resolved clients (and errors clearly if a named agent isn't configured).
  • add_mcp_command threads agents through to that filter; the CLI's mcp add reuses configure_workspace_command to set up any un-configured named agents before registering.
  • remove_mcp_command applies 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/, and uv run pytest all pass. Added tests/test_mcp.py coverage: 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-dependent test_e2e_user_agent tests.

This pull request and its description were written by Isaac.

@lilly-luo

Copy link
Copy Markdown
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?

`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
sunishsheth2009 force-pushed the sunish-sheth_data/mcp-add-agents branch from 9e86b37 to c5f0204 Compare August 20, 2026 23:27
@sunishsheth2009
sunishsheth2009 merged commit 95d2356 into databricks:main Aug 20, 2026
2 checks passed
@sunishsheth2009
sunishsheth2009 deleted the sunish-sheth_data/mcp-add-agents branch August 20, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants