Skip to content

Pass --profile to databricks CLI listing commands (fixes MCP discovery with CLI v1.0.0)#62

Open
bkvarda wants to merge 1 commit into
databricks:mainfrom
bkvarda:fix/databricks-cli-profile
Open

Pass --profile to databricks CLI listing commands (fixes MCP discovery with CLI v1.0.0)#62
bkvarda wants to merge 1 commit into
databricks:mainfrom
bkvarda:fix/databricks-cli-profile

Conversation

@bkvarda
Copy link
Copy Markdown

@bkvarda bkvarda commented May 21, 2026

Problem

ucode configure mcp silently skips external connections, Genie spaces, and Databricks apps with "Skipped" warnings, leaving the MCP picker empty or showing only "Databricks SQL". This is the root cause of the discovery side of #58.

Root cause: Databricks CLI v1.0.0 (release notes) changed OAuth token storage from ~/.databricks/token-cache.json to the OS-native keychain (Keychain on macOS, Credential Manager on Windows). Previously, passing DATABRICKS_HOST as an env var was sufficient for the CLI to look up the cached token by host URL. With v1.0.0, tokens are keyed by profile name in the keychain — DATABRICKS_HOST alone returns:

Error: default auth: cannot configure default credentials

get_databricks_token and ensure_databricks_auth already handled this correctly by calling find_profile_name_for_host and passing --profile. The three listing functions used for MCP discovery missed the same pattern.

Fix

list_databricks_connections, list_genie_spaces, and list_databricks_apps now call find_profile_name_for_host and append --profile <name> when a match is found, matching the pattern already used by get_databricks_token and ensure_databricks_auth.

Detecting the error and warning was considered but rejected — it requires fragile string-matching on CLI error output that can change between versions. Always passing --profile is simpler and correct across all CLI versions.

Related

Test plan

  • uv run pytest — all 566 tests pass
  • Manual: ucode configure mcp on a workspace with CLI v1.0.0 installed now discovers external connections, Genie spaces, and Databricks apps
  • Manual: verified against external connections in a Databricks workspace - MCP server now shows in ~/.config/goose/config.yaml

CLI v1.0.0 no longer resolves credentials from DATABRICKS_HOST alone —
it requires an explicit --profile flag. list_databricks_connections,
list_genie_spaces, and list_databricks_apps now call
find_profile_name_for_host and append --profile when a match is found,
matching the same pattern already used in get_databricks_token.

Without this fix, ucode configure mcp silently skips external
connections, Genie spaces, and Databricks apps with "Skipped" warnings.

Co-authored-by: Isaac
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