Commit 2948293
feat: add MCP elicitation for interactive DBT_HOST configuration (#728)
## Summary
Add MCP elicitation support so users can configure `DBT_HOST`
interactively when it's not set, instead of getting an error.
## What Changed
- New `elicitation.py` with reusable elicitation infrastructure
(`get_elicitation_session`, `elicit_or_raise`) that any future
elicitation can build on
- First consumer: `ElicitingCredentialsProvider` wraps
`CredentialsProvider` to prompt for `DBT_HOST` when missing, then feeds
it into the existing OAuth flow
- Elicited host persists to `~/.dbt/mcp.yml` via
`DbtPlatformContext.dbt_host` — reuses the existing context file and
`override()` merge logic (no separate config file)
- `config.py`/`settings.py`/`server.py`: wire the wrapper, stop
auto-disabling platform features, remove conditional guards on tool
registration
## Why
Users currently need to edit JSON config files to set `DBT_HOST` before
the server works. For non-technical users, this is a barrier. With
elicitation, the server prompts for the host interactively on first use,
persists it, and never asks again.
Clients that don't support elicitation (e.g., Claude Desktop) get the
original error message — no regression.
## Related Issues
Closes #488
### Testing
### MCP INSPECTOR:
<img width="1847" height="885" alt="image"
src="https://github.com/user-attachments/assets/383299a8-6f38-40a0-be70-8f48e82576ba"
/>
<img width="1847" height="885" alt="image"
src="https://github.com/user-attachments/assets/a7346cb9-8663-46da-bc09-85deb32263d2"
/>
<img width="1847" height="885" alt="image"
src="https://github.com/user-attachments/assets/4fbfe937-e928-4cba-9425-a237abe3c573"
/>
### CC
<img width="1331" height="211" alt="image"
src="https://github.com/user-attachments/assets/d87c72fd-874f-436d-983a-486e4f71b76a"
/>
<img width="1331" height="258" alt="image"
src="https://github.com/user-attachments/assets/bca12012-f756-494f-9d24-1a4c00aa5580"
/>
<img width="1331" height="258" alt="image"
src="https://github.com/user-attachments/assets/dd6ce39a-3372-4c50-a38a-fd31a4d4c54a"
/>
## 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 ->
dbt-labs/docs.getdbt.com#9001
- [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
## Additional Notes
- Tested with MCP Inspector (elicitation form works), Claude Code
(elicitation works inline), and Claude Desktop (graceful degradation —
`elicitation=None` in capabilities)
- Only `DBT_HOST` is elicited; `DBT_PROJECT_DIR` and `DBT_PATH` remain
env-var-only for CLI users
- Elicited host persists to `~/.dbt/mcp.yml` as `dbt_host` field on
`DbtPlatformContext`; env vars always take precedence
- `host_prefix` is also restored from persisted context on restart for
multi-cell account URL construction
---------
Co-authored-by: Jairus Martinez <114552516+jairus-m@users.noreply.github.com>1 parent 5226ab8 commit 2948293
12 files changed
Lines changed: 1097 additions & 198 deletions
File tree
- .changes/unreleased
- src/dbt_mcp
- config
- errors
- mcp
- oauth
- tests
- mocks
- unit
- config
- mcp
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
91 | | - | |
| 91 | + | |
| 92 | + | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
94 | 95 | | |
95 | | - | |
96 | | - | |
97 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| |||
124 | 127 | | |
125 | 128 | | |
126 | 129 | | |
| 130 | + | |
127 | 131 | | |
128 | | - | |
| 132 | + | |
129 | 133 | | |
130 | | - | |
| 134 | + | |
131 | 135 | | |
132 | 136 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
| 149 | + | |
| 150 | + | |
144 | 151 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
153 | 161 | | |
| 162 | + | |
154 | 163 | | |
155 | 164 | | |
156 | 165 | | |
| |||
171 | 180 | | |
172 | 181 | | |
173 | 182 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | 183 | | |
189 | 184 | | |
190 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
187 | | - | |
| 188 | + | |
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
| |||
231 | 232 | | |
232 | 233 | | |
233 | 234 | | |
234 | | - | |
| 235 | + | |
235 | 236 | | |
236 | 237 | | |
237 | 238 | | |
| |||
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
251 | 262 | | |
252 | 263 | | |
253 | | - | |
| 264 | + | |
254 | 265 | | |
255 | 266 | | |
256 | 267 | | |
257 | | - | |
258 | 268 | | |
259 | 269 | | |
260 | 270 | | |
| |||
277 | 287 | | |
278 | 288 | | |
279 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
280 | 293 | | |
281 | 294 | | |
282 | 295 | | |
| |||
0 commit comments