Skip to content

[Bug]: Repeated browser auth prompts with externalbrowser on macOS when running via uvx #747

@jennaallen

Description

@jennaallen

What happened?

When using the dbt MCP server with Snowflake externalbrowser authentication on macOS, every dbt CLI command triggers a separate browser SSO authentication window. A single dbt build on one model with 2 tests results in 3 browser popups, making the MCP server unusable for real workflows.

Two issues combine to create this problem:

  1. uvx creates ephemeral virtualenvs with unique Python binary paths per session. Each session spawns a new path like ~/.cache/uv/archive-v0/<random-hash>/bin/python. macOS Keychain grants access per binary path, so the Snowflake connector's cached SSO token (stored via the keyring library) is never readable by the next session's Python binary. Even clicking "Always Allow" on the Keychain popup doesn't persist because the binary path changes.

  2. Each dbt CLI tool spawns a new subprocess. Since dbt-mcp runs each command via subprocess.Popen, every build/run/test/show call creates a new dbt process that opens a new Snowflake connection. Within a single session where Keychain access fails, this means a browser auth popup per query rather than per session.

PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring eliminates Keychain popups but still triggers browser SSO per query (no cached token)

Steps to Reproduce

  1. Configure dbt MCP server via uvx dbt-mcp@latest (the default recommended setup)
  2. Configure Snowflake with authenticator: externalbrowser in profiles.yml
  3. Run any dbt CLI tool through the MCP server (e.g., dbt build on a model with tests)
  4. Observe a separate browser SSO window for each query (1 for the model + 1 per test)

Deployment

Local MCP server

Environment

  • dbt-mcp v1.15.0 (installed via uvx dbt-mcp@latest)
  • macOS
  • Snowflake authenticator: externalbrowser
  • allow_id_token = true at the Snowflake account level
  • snowflake-connector-python[secure-local-storage] installed
  • Claude Code (MCP client)

Relevant log output

Could not retrieve ID_TOKEN from secure storage : Can't get password from keychain: (-128, 'Keychain Access Denied')
Initiating login request with your identity provider. Press CTRL+C to abort and try again...
Going to open: https://[redacted]/sso/saml?SAMLRequest=...
Could not store id_token to keyring, Can't store password on keychain: (-25244, 'Unknown Error')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions