Skip to content

[skills] Add an interactive schema picker to ug skill add --mcp - #588

Merged
xsh310 merged 2 commits into
skills-download-workspace-idfrom
skills-mcp-add-picker
Sep 16, 2026
Merged

xsh310 merged 2 commits into
skills-download-workspace-idfrom
skills-mcp-add-picker

Conversation

@xsh310

@xsh310 xsh310 commented Sep 13, 2026 •

Copy link
Copy Markdown
Collaborator

What

ug skill add --mcp with no --location errored asking for a typed schema. On an
interactive terminal it now opens a picker of the workspace's schemas that contain
skills, streamed in as discovery finds them, and adds the selected schemas to the
skills MCP connection's scope.

Why

The download path already has an interactive picker; the MCP scope path was the only
add-side flow still requiring a typed --location. This makes the two symmetric.

How

  • The picker (in mcp.py, beside the other skill MCP-scope commands) reuses the download
    picker's machinery: the workspace walk (list_all_skills) and the streaming checkbox
    widget. list_all_skills probes one schema per call, so each streamed batch is one
    schema's skill set; the loader renders one row per schema with its exact skill count.
  • Already-scoped schemas are flagged and stay selectable; re-selecting is a no-op, since
    adding is additive (removal is ug skill remove --mcp).
  • To let both mcp.py (picker) and skills_download.py (download) use the workspace walk
    without a circular import, the UC skills read layer (SkillRef, the API client, and
    list_all_skills) moves into a new skills_api.py that depends only on databricks.py.
  • add_skills_command's apply body is extracted into add_skill_locations_to_mcp, shared
    by the command and the picker so each runs a single client setup.
  • Non-interactive (no TTY) still errors asking for --location, so scripts fail loudly.

Testing

uv run ruff check, ruff format --check, ty check src, and uv run pytest all pass
(the pre-existing test_e2e_user_agent / test_claude_smart_routing_v2 failures also fail
on the base). The read-layer tests move to test_skills_api.py; added tests for the schema
picker, its command, add_skill_locations_to_mcp / configured_skill_locations, and the CLI
dispatch.

Stack

Part of gh stack #576, on top of #586 (skills-download-workspace-id).

This pull request and its description were written by Isaac.

Screen.Recording.2026-09-12.at.11.35.02.PM.mov

Stack created with GitHub Stacks CLI • Give Feedback 💬

@xsh310
xsh310 added this pull request to stack #576 September 13, 2026 04:28
Comment thread src/ucode/cli.py Outdated
Comment thread src/ucode/skills_download.py Outdated
Comment thread src/ucode/mcp.py Outdated
Comment thread src/ucode/skills_download.py Outdated
Comment thread src/ucode/mcp.py Outdated
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch 2 times, most recently from d6d37f1 to c934e64 Compare September 13, 2026 06:25
@xsh310
xsh310 marked this pull request as ready for review September 13, 2026 06:37
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from c934e64 to 54a8370 Compare September 14, 2026 03:08
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from 54a8370 to 35a710b Compare September 14, 2026 20:09
Comment thread src/ucode/mcp.py Outdated
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from 35a710b to d94e61f Compare September 14, 2026 22:32
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch 2 times, most recently from dee8c30 to bad3f91 Compare September 15, 2026 01:41
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from bad3f91 to 29363a9 Compare September 15, 2026 03:40
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch 2 times, most recently from 70ae698 to f84cc77 Compare September 15, 2026 14:43
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from 4e2cacf to f2830f3 Compare September 16, 2026 20:08
xsh310 and others added 2 commits September 16, 2026 13:21
`ug skill add --mcp` with no --location errored asking for a typed schema. On an
interactive terminal it now opens a picker of the workspace's schemas that contain
skills, streamed in as discovery finds them, and adds the selected schemas to the
skills MCP scope.

The picker mirrors the download picker and reuses its machinery: the workspace walk
(list_all_skills) and the streaming checkbox widget. Because list_all_skills probes
one schema per call, each batch is one schema's skill set, so the loader renders one
row per schema with its exact skill count. Already-scoped schemas are flagged and
stay selectable, since adding is additive (removal is `ug skill remove --mcp`).

To let both the picker (in mcp.py) and the download flow use the workspace walk
without a circular import, the UC skills read layer (SkillRef, the API client, and
list_all_skills) moves into a new skills_api.py that depends only on databricks.py;
mcp.py and skills_download.py both import it. add_skills_command's apply body is
extracted into add_skill_locations_to_mcp, shared by the command and the picker.

Co-authored-by: Isaac <no-reply@databricks.com>
The `ug skill add --mcp` schema picker's loader dropped list_all_skills'
return, so a timed-out walk silently showed a partial schema list. Capture
the deadline and surface it in the footer, mirroring the download picker.

Co-authored-by: Isaac <no-reply@databricks.com>
@xsh310
xsh310 force-pushed the skills-mcp-add-picker branch from f2830f3 to a3a356e Compare September 16, 2026 20:21
@xsh310
xsh310 merged commit 97367b6 into main Sep 16, 2026
18 of 38 checks passed
@xsh310
xsh310 deleted the skills-mcp-add-picker branch September 16, 2026 20:29
xsh310 added a commit that referenced this pull request Sep 16, 2026
## What

`ug skill remove --mcp` was interactive-only. This adds `--location`
support so a specific set of
`<catalog>.<schema>` schemas can be dropped from the skills MCP
connection's scope
non-interactively, and makes the no-`--location` case behave like `ug
skill add --mcp`: a picker on
an interactive terminal, a clear error otherwise.

## Why

`ug skill add --mcp --location` (and its picker, from #588) had no
removal counterpart. Scripts and
non-interactive callers could not remove a schema from the MCP scope,
and `ug skill remove --mcp` in
a non-interactive shell fell into a picker that cannot be used. This
makes the add and remove paths
symmetric.

## How

- CLI (`skills_remove`): `--mcp` now accepts `--location`. With
locations it calls the new
`remove_skills_locations_command`; with none it opens the existing
picker on a TTY, otherwise it
errors asking for `--location`. `--path` and `--skills` stay rejected
with `--mcp`, and `--agents`
  scoping is unchanged.
- The removal core is extracted into `remove_skill_locations_from_mcp`,
shared by the interactive
`remove_skills_command` and the new non-interactive command, mirroring
#588's
  `add_skill_locations_to_mcp` split. A schema not in scope is a no-op.
- README updated for the new usage.

## Testing

`uv run ruff check`, `ruff format --check`, `ty check src`, and `uv run
pytest` all pass (the
pre-existing `test_e2e_user_agent` / `test_claude_smart_routing_v2`
failures also fail on the base).
Added tests for `remove_skills_locations_command` (per-client removal,
agent scoping, a
not-in-scope no-op, and the schema-less connection kept when the last
schema is removed) and for the
CLI dispatch (`--mcp --location`, agent scope, the non-interactive
no-`--location` error, a malformed
location, and `--path` / `--skills` rejection).

## Stack

Part of gh stack #576, on top of #588 (`skills-mcp-add-picker`).

This pull request and its description were written by Isaac.

---

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>

Co-authored-by: Isaac <no-reply@databricks.com>
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.

2 participants