Skip to content

Extract OAuth credentials from settings module#656

Draft
DevonFulcher wants to merge 5 commits intomainfrom
devonfulcher/oauth-extract-credentials
Draft

Extract OAuth credentials from settings module#656
DevonFulcher wants to merge 5 commits intomainfrom
devonfulcher/oauth-extract-credentials

Conversation

@DevonFulcher
Copy link
Collaborator

@DevonFulcher DevonFulcher commented Mar 16, 2026

Why

settings.py has grown into a large file mixing configuration (settings classes, validators) with authentication orchestration (OAuth flow, token refresh, credential resolution). This makes the module harder to navigate and creates a tight coupling between unrelated concerns.

What

  • Created src/dbt_mcp/config/credentials.py containing all auth orchestration logic:
    • AuthenticationMethod enum
    • CredentialsProvider class (with updated OAuth URL construction via _build_dbt_platform_url and base_host property from the base branch)
    • get_dbt_platform_context, get_dbt_profiles_path
    • Internal helpers: _find_available_port, _is_context_complete, _is_token_valid, _try_refresh_token
    • OAUTH_REDIRECT_STARTING_PORT constant
  • Slimmed down settings.py to focus on configuration classes, validators, and host prefix utilities (HostPrefixResult, parse_host_prefix, _build_dbt_platform_url)
  • Updated all importers to use dbt_mcp.config.credentials directly (no re-exports)
  • Updated test patch targets to point at dbt_mcp.config.credentials where the functions now live
  • Used from __future__ import annotations and TYPE_CHECKING in credentials.py to avoid circular imports with DbtMcpSettings

Notes

  • Rebased onto the latest base branch which added _build_dbt_platform_url, HostPrefixResult, parse_host_prefix, base_host property, and the dbt_token warning in the OAuth fallback path. Those changes are incorporated into the extraction.
  • The old get_dbt_host function (replaced by _build_dbt_platform_url + base_host in the base branch) is no longer present.

Drafted by Claude Opus 4.6 under the direction of @DevonFulcher

@DevonFulcher DevonFulcher changed the base branch from main to devonfulcher/oauth-consolidate-refresh March 16, 2026 21:55
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DevonFulcher DevonFulcher force-pushed the devonfulcher/oauth-consolidate-refresh branch from dcd67f6 to 01a30e9 Compare March 17, 2026 16:46
DevonFulcher and others added 3 commits March 17, 2026 13:13
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ntials directly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DevonFulcher DevonFulcher force-pushed the devonfulcher/oauth-extract-credentials branch from e17fac9 to 4833fa8 Compare March 17, 2026 18:18
@DevonFulcher DevonFulcher deployed to integration March 17, 2026 18:18 — with GitHub Actions Active
@DevonFulcher DevonFulcher changed the base branch from devonfulcher/oauth-consolidate-refresh to main March 17, 2026 18:32
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