Skip to content

ucode configure skills: MCP-connection mode (add/remove/replace) + status#1

Closed
xsh310 wants to merge 1 commit into
skills-refactor-setup-helpersfrom
skills-mcp-mode
Closed

ucode configure skills: MCP-connection mode (add/remove/replace) + status#1
xsh310 wants to merge 1 commit into
skills-refactor-setup-helpersfrom
skills-mcp-mode

Conversation

@xsh310

@xsh310 xsh310 commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Stacked on databricks#235 (draft). Base branch is skills-refactor-setup-helpers (PR 0's branch), not main, so this PR's diff shows only PR 1's changes. Merge databricks#235 first. (Opened on the fork because PR 0's branch lives on the fork, not on databricks/ucode.)

What this delivers

MCP mode end-to-end for ucode configure skills. Download mode lands in a follow-up PR.

Single multi-schema connection

  • Exactly one skills MCP entry: name databricks-skill-registry, kind: "skills", rebuilt on every run (single-connection invariant — _resolve_skills_mcp_servers drops any prior kind=="skills" entry and any entry with that name, keeps everything else, appends one rebuilt entry, and merges prior clients).
  • skill_locations: list[str] is the source of truth. The URL is always derived from it via build_skills_mcp_url ({ws}/ai-gateway/skills/?schema=a&schema=b; empty list -> bare {ws}/ai-gateway/skills/), never parsed back.
  • The skills entry rides alwaysLoad=True into build_mcp_http_entry (Claude-only; other clients get URL only).

CLI surface

  • ucode configure skills --location <list> (required, comma-separated).
  • --mcp mutates the connection; --remove / --replace refine the set mutation (add = union, remove = difference, replace = deduped requested); all order-stable.
  • Guards mirror configure_mcp (RuntimeError -> exit 1): --remove+--replace together; --remove/--replace without --mcp; --path with --mcp.
  • Bare default (no --mcp): registers the connection for the given schemas — the useful interim behavior until download mode ships.
  • Soft-warn (still writes) when the resulting set exceeds 10 schemas.

Download-only flags in this PR

Download mode does not exist yet, so rather than silently ignore download-only affordances, the bare default raises a clear "download mode is not available yet; use --mcp" error if --path, --yes, or a 3-part <catalog>.<schema>.<skill> location is supplied. A 3-part location with --mcp is also rejected (it names a single skill, which is download-only).

status

New top-level "Skills" section (peer of Coding Agents / Tracing): Connection, Mode (mcp if skill_locations non-empty else download), Locations (comma-joined, or none — utility tools only), Configured (agent display names). Renders "not configured" when no skills entry exists. The skills entry is also excluded from each agent's per-client MCP-servers line so it isn't double-listed.

Tests added

  • test_databricks.py: build_skills_mcp_url for empty / one / two locations (order preserved).
  • test_mcp.py: resolve_skill_location_set (add/remove/replace/empty, dedupe, order); _resolve_skills_mcp_servers (canonical entry, single-entry rebuild while an mcp-service entry survives, drops stale/old-named entries, URL derives from list not a stale url, bare route on empty); configure_skills_mcp_command flows (add-to-empty with alwaysLoad, add-second, remove, replace, remove-last -> [] + bare URL + entry kept, mcp-service entries preserved, soft-warn over cap); configure_skills_command bare default.
  • test_cli.py: two-mode dispatch (default/--mcp/--mcp --remove/--mcp --replace), comma --location, mutual-exclusion and download-only guards -> exit 1, malformed -> exit 1 naming --location, missing --location -> exit 2; status Skills renderings (not-configured/mcp/download) and skills entry absent from per-client MCP lines.

How verified

uv run ruff check ., uv run ruff format --check, and the full suite run with FORCE_COLOR unset (that env var otherwise injects ANSI into CliRunner buffers and flakes 3 unrelated CLI color tests locally). Result: 1 failed, 932 passed, 39 skipped. The single failure is the pre-existing test_e2e_user_agent.py case (the local claude binary is Claude Code, not the Anthropic CLI) — unrelated to this change.

This pull request and its description were written by Isaac.

Introduces `ucode configure skills` for managing a single Unity Catalog
Skills MCP connection (`databricks-skill-registry`) whose scope is a set
of `catalog.schema` locations, rendered as a multi-schema `?schema=` URL
(aligns with the backend route in universe #2256555).

- `build_skills_mcp_url(workspace, locations)`: repeated `?schema=`; empty
  list -> bare `/ai-gateway/skills/` (utility tools only).
- Single `kind:"skills"` entry with `skill_locations` as the source of
  truth; the URL is derived and never parsed back. Every run rebuilds
  exactly one skills entry, preserving non-skills entries.
- `--location a.b,c.d --mcp [--remove|--replace]` adds/removes/replaces the
  location set; `--remove`/`--replace` are mutually exclusive and require
  `--mcp`; a soft warning fires above 10 schemas. The bare form (no
  `--mcp`) registers the connection for the given schemas; download-only
  affordances (`--path`, `--yes`, a 3-part `.skill` location) without
  `--mcp` raise a clear "not available yet" error.
- `alwaysLoad` is set on the skills entry for the Claude client only.
- `ucode status` gains a top-level Skills section (Connection / Mode /
  Locations / Configured); the skills entry is excluded from each agent's
  per-client MCP-servers line.

Also extracts `_setup_mcp_clients` from `configure_mcp_command` (shared by
the mcp and skills commands) and adds an `always_load` keyword to
`build_mcp_http_entry` (default off) as behavior-preserving prep.

Co-authored-by: Isaac
@xsh310
xsh310 force-pushed the skills-mcp-mode branch from d31dd25 to bdb4ccc Compare July 23, 2026 16:01
@xsh310

xsh310 commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

Superseded by databricks#236 (folded into a single PR against databricks/ucode:main).

@xsh310 xsh310 closed this Jul 23, 2026
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