Skip to content

Commit eb9b646

Browse files
authored
Fix dev env retrieval (#748)
## Summary This PR fixes the retrieval of development environments to align with the actual return types of the dbt admin API. ## Checklist - [x] I have performed a self-review of my code - [x] I have made corresponding changes to the documentation (in https://github.com/dbt-labs/docs.getdbt.com) if required -- Mention it here - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes
1 parent d52c041 commit eb9b646

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Bug Fix
2+
body: Fix dev env retrieval
3+
time: 2026-05-01T14:50:42.714358-05:00

src/dbt_mcp/dbt_admin/client.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ def resolve_environments(
8282
"""Resolve prod and dev environments from a list of environment responses.
8383
8484
Returns a tuple of (prod_environment, dev_environment).
85-
86-
Auto-detects prod based on deployment_type == "production".
87-
Dev environment is auto-detected based on deployment_type == "development".
8885
"""
8986
prod_environment: DbtPlatformEnvironment | None = None
9087
dev_environment: DbtPlatformEnvironment | None = None
@@ -102,14 +99,11 @@ def resolve_environments(
10299
break
103100

104101
for environment in environments:
105-
if (
106-
environment.deployment_type
107-
and environment.deployment_type.lower() == "development"
108-
):
102+
if environment.type and environment.type.lower() == "development":
109103
dev_environment = DbtPlatformEnvironment(
110104
id=environment.id,
111105
name=environment.name,
112-
deployment_type=environment.deployment_type,
106+
deployment_type=None,
113107
)
114108
break
115109

src/dbt_mcp/oauth/dbt_platform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class DbtPlatformEnvironmentResponse(BaseModel):
4646
class DbtPlatformEnvironment(BaseModel):
4747
id: int
4848
name: str
49-
deployment_type: str
49+
deployment_type: str | None
5050

5151

5252
class SelectedProjectsRequest(BaseModel):

0 commit comments

Comments
 (0)