Skip to content

MCP follow-ups: status count via shared enumerator + async-only proxy auth - #810

Open
sunishsheth2009 wants to merge 7 commits into
databricks:mainfrom
sunishsheth2009:mcp-status-single-enumerator
Open

sunishsheth2009 wants to merge 7 commits into
databricks:mainfrom
sunishsheth2009:mcp-status-single-enumerator

Conversation

@sunishsheth2009

@sunishsheth2009 sunishsheth2009 commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #654 (uses configured_mcp_servers_by_name). Merge order: #654 → this. #557 is already merged, so once #654 lands this rebases cleanly to main. Two independent follow-up cleanups from the #557/#654 review, one commit each.

Follow-ups split out of #557/#654 to keep those focused (per reviewer request). No behavior change; both are DRY/dead-code cleanups.

1. ug status: count MCP servers via the shared enumerator

ug status re-implemented the "which MCP servers are configured" enumeration inline (merged mcp_servers + managed_mcp_servers, deduped by name, separately read the Claude/Codex OS-managed files) — a parallel copy of configured_mcp_servers_by_name, the enumerator ug mcp list and ug mcp login already use. Routed the per-agent count through it, so all three commands read one source of truth and the count can't drift. Net −9 lines.

revert_mcp_configs was intentionally left alone: its narrower mcp_servers + managed_mcp_servers merge is the user-scope set it removes; OS-managed files are reverted separately by claude.revert_managed_settings() / codex.revert_managed_config().

2. ug mcp-proxy: async-only auth (drop the dead sync auth_flow)

The proxy only ever drives its httpx Auth from an AsyncClient, so the sync auth_flow never ran at runtime — it duplicated the async flow and existed only so the tests could drive it synchronously. Removed it; sync_auth_flow now raises a clear ProxyAuthError so a future sync client fails loudly instead of silently falling back to httpx's no-op default (which would skip the bearer). Tests drive async_auth_flow through one _drive helper (anyio.run), and test_sync_auth_flow_is_rejected covers the guard. (Resolves the "do we still need the sync one?" thread on #557.)

Testing

ruff + ty clean. test_mcp_proxy.py (36) green after the async-driver rewrite; TestStatus/TestStatusLiveModels (8) green for the status change. No production behavior change in either.

This pull request and its description were written by Isaac.

@sunishsheth2009
sunishsheth2009 force-pushed the mcp-status-single-enumerator branch 2 times, most recently from 911bc79 to c0529c2 Compare September 23, 2026 20:53
@sunishsheth2009 sunishsheth2009 changed the title ug status: count MCP servers via the shared enumerator (DRY follow-up) MCP follow-ups: status count via shared enumerator + async-only proxy auth Sep 23, 2026
@sunishsheth2009
sunishsheth2009 marked this pull request as ready for review September 23, 2026 22:22
sunishsheth2009 and others added 4 commits September 28, 2026 22:38
`ug mcp login` shows which of the connection-backed AI Gateway MCP services the
coding agents are configured to use are already signed in vs. still need a
per-user connection sign-in, and runs the sign-in for the ones you pick
(interactive picker) or name with `--services` / scope with `--agents`.

Reuses databricks#679's building blocks: the developer + workspace-managed server
enumeration is extracted from `list_mcp_command` into a shared
`configured_mcp_servers_by_name` (behavior-preserving) that both `ug mcp list`
and `ug mcp login` call, and the status is rendered with the same rich Table +
`status_badge` styling from `ucode.ui`.

Per-service status comes from the existing Unity Catalog REST APIs (the ones the
`/mcp-service-login` page uses); sign-in is `databricks auth login --resource`
(RFC 8707, databricks/cli#6621), so it works for any connection-backed MCP
service, not just `system.ai.*`. The credential is per-user and shared across
agents, so signing in once unblocks the service for every agent.

Co-authored-by: Isaac <no-reply@databricks.com>
Rewrite the MCP Servers section in the plain, scannable style of the Skills section: a one-line
intro, a single command block with friendly comments (add / list / login / remove), and one
plain-language note that you only sign in once. Move the jargon (agent scoping, V2 typed
selectors, the mcp-proxy/token mechanics, CLI version requirement) into a collapsible
"Advanced options" block so business users aren't hit with it up front.

Co-authored-by: Isaac <no-reply@databricks.com>
Show non-technical users what the commands actually print — the one-line add confirmation,
the ug mcp list status table, and the one-time sign-in — right under the command block.

Co-authored-by: Isaac <no-reply@databricks.com>
…rvers

Keep the section to the essentials: intro, the command block, the one-time sign-in note, and
just the two actionable Advanced options (agent scoping, typed selectors). Removes the sample
add/list/login session and the mcp-proxy/CLI-version bullets.

Co-authored-by: Isaac <no-reply@databricks.com>
@sunishsheth2009
sunishsheth2009 force-pushed the mcp-status-single-enumerator branch from 311534e to 5eaa991 Compare September 28, 2026 22:49
sunishsheth2009 and others added 3 commits September 28, 2026 22:52
The formatter version in CI advanced since these files were first written, so
ruff-format-check flagged them. Reformat to match; no behavior change.

Co-authored-by: Isaac <no-reply@databricks.com>
…ntation)

`ug status` re-implemented the configured-MCP-server enumeration inline: it merged
mcp_servers + managed_mcp_servers, deduped by name, and separately read the Claude/Codex
OS-managed files — a parallel copy of `configured_mcp_servers_by_name`, the function
`ug mcp list` and `ug mcp login` already use. The two could silently drift (the code even
carried a comment asking a reader to keep them in agreement).

Route the per-agent MCP count through `configured_mcp_servers_by_name` so all three commands
read one enumerator. Net -9 lines and the count now matches `ug mcp list` by construction,
including servers delivered through an agent's OS-managed file. No behavior change; existing
TestStatus coverage (incl. managed-server + dedupe) stays green.

Co-authored-by: Isaac <no-reply@databricks.com>
The proxy only ever drives the httpx Auth from an AsyncClient, so the sync auth_flow was
never exercised at runtime — it duplicated the async flow and existed only for the tests to
drive synchronously. Remove it and override sync_auth_flow to raise a clear ProxyAuthError,
so a future sync client fails loudly instead of silently falling back to httpx's no-op default
flow (which would skip the bearer). Tests now drive async_auth_flow through one _drive helper
(anyio.run), and a new test_sync_auth_flow_is_rejected covers the guard.

Co-authored-by: Isaac <no-reply@databricks.com>
@sunishsheth2009
sunishsheth2009 force-pushed the mcp-status-single-enumerator branch from 5eaa991 to f052f80 Compare September 28, 2026 22:54
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