Skip to content

ug mcp login: per-service sign-in status + login for agents' MCP services - #654

Draft
sunishsheth2009 wants to merge 1 commit into
databricks:mainfrom
sunishsheth2009:mcp-login-command
Draft

sunishsheth2009 wants to merge 1 commit into
databricks:mainfrom
sunishsheth2009:mcp-login-command

Conversation

@sunishsheth2009

@sunishsheth2009 sunishsheth2009 commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Depends on databricks/cli#6621 (--resource) for the actual sign-in. #679 (ug mcp list) is now merged, so this branch is based on main and the diff is just the ug mcp login work.

What

Adds ug mcp login — a command to sign in to the connection-backed AI Gateway MCP services the coding agents are configured to use. Shows which are already signed in vs. 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.

Why

Non-native agents (codex, gemini, opencode) reach connection-backed MCP services (e.g. system.ai.github) via ug mcp-proxy, which vends tools only after a per-user connection login. Rather than block inside an agent-spawned proxy (fragile — agents strip BROWSER/env, hide the auth URL, hit MCP-startup timeouts), this is an explicit, decoupled login the user runs in their own shell. It also works for Claude/Cursor — the credential is per-user and shared across all agents, so signing in once unblocks the service everywhere.

Reuses #679's machinery

  • Extracts Add ug mcp list, help on bare ug mcp, and MCP counts in ug status #679's developer + workspace-managed server merge out of list_mcp_command into a shared configured_mcp_servers_by_name(state, agents) in mcp.py; both ug mcp list and ug mcp login now call it (behavior-preserving for list — a new TestConfiguredMcpServersByName covers it directly). So ug mcp login covers workspace-managed connection mcp-services too, matching what ug mcp list shows.
  • Renders status with the same rich Table + status_badge styling from ucode.ui that Add ug mcp list, help on bare ug mcp, and MCP counts in ug status #679's list uses (signed in / needs sign-in / no sign-in needed / unknown), plus the agents each service is on.
  • Sign-in status is intentionally not added to bare ug mcp list — that stays Databricks-login-free, whereas the credential-status API needs a token.

How it works (existing UC REST APIs — no unshipped deps)

  • GET /mcp-services/<full-name> → id + source_connection (name + securable_kind)
  • GET /connections/<conn>/user-credentials/<user>?dependent.mcp_service.id=<id>provisioning_info.state (ACTIVE = signed in; HTTP 404 = needs login)

Works for any connection-backed MCP service — not just system.ai.* (source connection resolved from the service's own config).

UX (symmetric with ug mcp add)

  • bare ug mcp login → status table + picker (needs-sign-in pre-checked)
  • --services system.ai.github[,github] → targeted, non-interactive
  • --agents claude,codex → scope to those agents' services

Sign-in is databricks auth login --resource <mcp-url> (databricks/cli#6621), with a clear "upgrade your CLI" error if --resource is missing.

Testing

tests/test_mcp_login.py — status classification, the --resource invocation incl. the old-CLI clear error, --services/--agents scoping, and workspace-managed inclusion; plus TestConfiguredMcpServersByName for the extracted shared helper. ruff + ty clean; the full mcp/login/cli suite (564) is green after the extraction. README documents the command.

This pull request and its description were written by Isaac.

`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>
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