Skip to content

Support per-client skill MCP scopes - #520

Open
xsh310 wants to merge 1 commit into
mainfrom
xshen/per-client-skill-scopes
Open

Support per-client skill MCP scopes#520
xsh310 wants to merge 1 commit into
mainfrom
xshen/per-client-skill-scopes

Conversation

@xsh310

@xsh310 xsh310 commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

What

Store the skills MCP connection's scope as a per-agent map (skill_locations_by_client) instead of a single flat skill_locations list. Each configured coding agent (Claude, Codex, …) gets its own set of skill schemas and is registered with its own scoped gateway URL, so different agents can carry different skills.

This PR is the state model that lets later PRs in the stack target individual agents (skill add/skill remove --agents …). On its own it changes no user-facing command behavior — every command still operates on all configured agents — it just stores the scope per agent and reads/writes it coherently.

Backward compatible: connections written by older builds (flat skill_locations only) still read correctly, and skill_locations is kept as a union mirror for older readers.

State shape

The skills connection is a single entry in state.json's mcp_servers (kind: "skills", name databricks-skill-registry):

{
  "name": "databricks-skill-registry",
  "kind": "skills",
  "clients": ["claude", "codex"],
  "skill_locations_by_client": {                // NEW — authoritative, per-agent scope
    "claude": ["system.ai", "team.ml"],
    "codex":  ["system.ai"]
  },
  "skill_locations": ["system.ai", "team.ml"],  // union across agents (legacy readers only)
  "url": ".../ai-gateway/skills/?schema=system.ai&schema=team.ml",
  "auth": "proxy"
}
  • skill_locations_by_client — the source of truth: one catalog.schema list per agent.
  • skill_locations — derived, the union of every agent's list. Kept only so an older build or any legacy reader still sees a coherent scope.
  • Each agent is registered with a gateway URL scoped to its own list.

What happens on a skill command

  • ug skill add --mcp <catalog.schema,…>: unions the given schemas into every configured agent's list (keeping what each already has), re-registers only the agents whose scope actually changed (each with its own scoped URL), and saves the per-agent map plus a refreshed union mirror.
  • ug configure skills --mcp <catalog.schema,…>: sets (replaces) every configured agent's list to exactly the given schemas.
  • ug configure skills with no --location, and the on-launch download path: registers/keeps the schema-less connection (utility tools only) while preserving each agent's existing scope.
  • Reads : skill_locations_for_client(entry, client) returns that agent's list: from skill_locations_by_client when present, otherwise the flat skill_locations mirrored to every agent, so pre-upgrade state reads identically.
  • Migration: no eager rewrite: a legacy flat entry is upgraded to the per-agent map the next time any skill command writes the connection.

Stacking

Stacked on #519 (skill-managed-download-only). With managed skills delivered by download only, the skills MCP connection holds only a developer's own skill add --mcp schemas, so this per-agent scope is purely developer state — there is no global managed set to union in.

First PR of the per-agent skills stack (this → add --agents → per-agent statusremove → per-agent remove → deprecate configure skills). Base moves to main once #519 merges.

Original design and initial implementation by Arthur Jenoudet; reworked into the per-client model here.

This pull request and its description were written by Isaac.

@xsh310
xsh310 force-pushed the xshen/per-client-skill-scopes branch from 497380c to 909f1fc Compare September 8, 2026 18:25
Base automatically changed from skill-managed-download-only to main September 8, 2026 19:09
Store the skills MCP connection's scope as a per-client map
(`skill_locations_by_client`) instead of a single flat `skill_locations`
list, so `skill add`/`skill remove` can target individual agents. Reads
fall back to the flat list, mirrored to every client, for connections
written by older builds; `skill_locations` is kept as the union mirror.

Co-authored-by: Arthur Jenoudet <arthur.jenoudet@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@xsh310
xsh310 force-pushed the xshen/per-client-skill-scopes branch from 909f1fc to 0d4df44 Compare September 8, 2026 19:09
Comment thread src/ucode/mcp.py
@xsh310
xsh310 marked this pull request as ready for review September 8, 2026 20:19
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.

1 participant