You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add meta field passthrough for MCP Apps support (#624)
## Summary
- Adds `meta: dict[str, Any] | None = None` to `GenericToolDefinition`,
the `@dbt_mcp_tool` decorator, and `register_tools()` passthrough to
`FastMCP.add_tool()`
- This is infrastructure-only — no new tools or features. All existing
tools are unaffected (`meta` defaults to `None`)
- Enables future MCP App tools to declare associated UIs via
`meta={"ui": {"resourceUri": "ui://..."}}`
- Adds `CLAUDE.md` with project architecture overview for AI-assisted
development
- Adds "Adding Tools" and "Adding an MCP App tool" sections to
`CONTRIBUTING.md`
- Adds 7 new unit tests for meta passthrough through the full pipeline
- Updates `MockFastMCP` in test conftest to capture `tool_kwargs` for
future test assertions
## Test plan
- [x] All 386 unit tests pass (`uv run pytest tests/
--ignore=tests/integration -x -q`)
- [x] New tests cover: decorator, `adapt_context()`,
`to_fastmcp_internal_tool()`, and `generic_register_tools()` for both
`meta=value` and `meta=None`
- [ ] Verify no behavioral changes to existing tools in a client (e.g.,
Claude, Cursor)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+92-26Lines changed: 92 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ With [task](https://taskfile.dev/) installed, simply run `task` to see the list
5
5
## Setup
6
6
7
7
1. Clone the repository:
8
+
8
9
```shell
9
10
git clone https://github.com/dbt-labs/dbt-mcp.git
10
11
cd dbt-mcp
@@ -17,10 +18,12 @@ cd dbt-mcp
17
18
4. Run `task install`
18
19
19
20
5. Configure environment variables:
20
-
```shell
21
-
cp .env.example .env
22
-
```
23
-
Then edit `.env` with your specific environment variables (see [our docs](https://docs.getdbt.com/docs/dbt-ai/setup-local-mcp) to determine the values).
21
+
22
+
```shell
23
+
cp .env.example .env
24
+
```
25
+
26
+
Then edit `.env` with your specific environment variables (see [our docs](https://docs.getdbt.com/docs/dbt-ai/setup-local-mcp) to determine the values).
24
27
25
28
6. Run `task client` to chat with dbt MCP in your terminal.
26
29
@@ -85,6 +88,63 @@ Or, if you would like to test with Oauth, use a configuration like this:
85
88
86
89
For improved debugging, you can set the `DBT_MCP_SERVER_FILE_LOGGING=true` environment variable to log to a `./dbt-mcp.log` file.
87
90
91
+
## Adding Tools
92
+
93
+
Tools are defined using the `@dbt_mcp_tool` decorator and registered with the MCP server via `register_tools()`.
94
+
95
+
### Steps to add a new tool
96
+
97
+
1.**Add a `ToolName` entry** in `src/dbt_mcp/tools/tool_names.py`
98
+
2.**Map it to a toolset** in `src/dbt_mcp/tools/toolsets.py` (e.g., `DISCOVERY`, `SEMANTIC_LAYER`, `SQL`)
99
+
3.**Write a prompt file** in `src/dbt_mcp/prompts/<category>/` describing the tool
100
+
4.**Define the tool function** in the appropriate `tools.py` module:
5.**Add it to the tool list** (e.g., `DISCOVERY_TOOLS`) in the same module
113
+
6. The registration function (e.g., `register_discovery_tools`) handles context binding and registration
114
+
115
+
### Adding a tool with interactive UI (MCP Apps)
116
+
117
+
MCP Apps are tools that have an associated interactive UI rendered by the host (e.g., Claude, VS Code). They build on top of regular tools with two additions:
118
+
119
+
1.**Use `structured_output` and `meta`** to link the tool to a UI resource:
3.**Build a frontend** in `packages/` using `@modelcontextprotocol/ext-apps`. The app receives tool results via the `ontoolresult` callback and must be bundled as a single HTML file (e.g., using `vite-plugin-singlefile`) or reference external resources via CSP `resourceDomains`.
145
+
146
+
The `ui://` URI convention is `ui://<server-name>/<resource-name>`. The `meta` field is passed through the full tool registration pipeline (`@dbt_mcp_tool` → `GenericToolDefinition` → `adapt_context` → `register_tools` → `FastMCP.add_tool`).
147
+
88
148
## Signed Commits
89
149
90
150
Before committing changes, ensure that you have set up [signed commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits).
@@ -99,19 +159,22 @@ Every PR requires a changelog entry. [Install changie](https://changie.dev/) and
99
159
The dbt-mcp server runs with `stdio` transport by default which does not allow for Python debugger support. For debugging with breakpoints, use `streamable-http` transport.
100
160
101
161
### Option 1: MCP Inspector Only (No Breakpoints)
162
+
102
163
1. Run `task inspector` - this starts both the server and inspector automatically
103
164
2. Open MCP Inspector UI
104
165
3. Use "STDIO" Transport Type to connect
105
166
4. Test tools interactively in the inspector UI (uses `stdio` transport, no debugger support)
106
167
107
168
### Option 2: VS Code Debugger with Breakpoints (Recommended for Debugging)
169
+
108
170
1. Set breakpoints in your code
109
171
2. Press `F5` or select "debug dbt-mcp" from the Run menu
110
172
3. Open MCP Inspector UI via `npx @modelcontextprotocol/inspector`
111
173
4. Connect to `http://localhost:8000/mcp/v1` using "Streamable HTTP" transport and "Via Proxy" connection type
112
174
5. Call tools from Inspector - your breakpoints will trigger
113
175
114
176
### Option 3: Manual Debugging with `task dev`
177
+
115
178
1. Run `task dev` - this starts the server with `streamable-http` transport on `http://localhost:8000`
116
179
2. Set breakpoints in your code
117
180
3. Attach your debugger manually (see [debugpy documentation](https://github.com/microsoft/debugpy#debugpy) for examples)
@@ -128,29 +191,32 @@ If you encounter any problems, you can try running `task run` to see errors in y
128
191
Only people in the `CODEOWNERS` file should trigger a new release with these steps:
129
192
130
193
1. Consider these guidelines when choosing a version number:
131
-
- Major
132
-
- Removing a tool or toolset without replacement, or in a way that would result in agents behaving much differently.
133
-
- Changing the behavior of existing environment variables or configurations
134
-
- Minor
135
-
- Changes to config system related to the function signature of the register functions (e.g. `register_discovery_tools`)
136
-
- Adding optional parameters to a tool function signature
137
-
- Adding a new tool or toolset
138
-
- Removing or adding non-optional parameters from tool function signatures
139
-
- Renaming a tool
140
-
- Removing a tool which overlaps or provides similar functionality as other tool(s)
141
-
- Patch
142
-
- Bug and security fixes - only major security and bug fixes will be back-ported to prior minor and major versions
143
-
- Dependency updates which don’t change behavior
144
-
- Minor enhancements
145
-
- Editing a tool or parameter description prompt
146
-
- Adding an allowed environment variable with the `DBT_MCP_` prefix
194
+
195
+
- Major
196
+
- Removing a tool or toolset without replacement, or in a way that would result in agents behaving much differently.
197
+
- Changing the behavior of existing environment variables or configurations
198
+
- Minor
199
+
- Changes to config system related to the function signature of the register functions (e.g. `register_discovery_tools`)
200
+
- Adding optional parameters to a tool function signature
201
+
- Adding a new tool or toolset
202
+
- Removing or adding non-optional parameters from tool function signatures
203
+
- Renaming a tool
204
+
- Removing a tool which overlaps or provides similar functionality as other tool(s)
205
+
- Patch
206
+
- Bug and security fixes - only major security and bug fixes will be back-ported to prior minor and major versions
207
+
- Dependency updates which don’t change behavior
208
+
- Minor enhancements
209
+
- Editing a tool or parameter description prompt
210
+
- Adding an allowed environment variable with the `DBT_MCP_` prefix
211
+
147
212
2. Trigger the [Create release PR Action](https://github.com/dbt-labs/dbt-mcp/actions/workflows/create-release-pr.yml).
148
-
- If the release is NOT a pre-release, select `auto` (default) to automatically determine the version bump based on changelog entries, or manually pick patch, minor or major if needed
149
-
- If the release is a pre-release, set the bump and the pre-release suffix. We support alpha.N, beta.N and rc.N.
150
-
- use alpha for early releases of experimental features that specific people might want to test. Significant changes can be expected between alpha and the official release.
151
-
- use beta for releases that are mostly stable but still in development. It can be used to gather feedback from a group of peopleon how a specific feature should work.
152
-
- use rc for releases that are mostly stable and already feature complete. Only bugfixes and minor changes are expected between rc and the official release.
153
-
- Picking the prerelease suffix will depend on whether the last release was the stable release or a pre-release:
213
+
214
+
- If the release is NOT a pre-release, select `auto` (default) to automatically determine the version bump based on changelog entries, or manually pick patch, minor or major if needed
215
+
- If the release is a pre-release, set the bump and the pre-release suffix. We support alpha.N, beta.N and rc.N.
216
+
- use alpha for early releases of experimental features that specific people might want to test. Significant changes can be expected between alpha and the official release.
217
+
- use beta for releases that are mostly stable but still in development. It can be used to gather feedback from a group of peopleon how a specific feature should work.
218
+
- use rc for releases that are mostly stable and already feature complete. Only bugfixes and minor changes are expected between rc and the official release.
219
+
- Picking the prerelease suffix will depend on whether the last release was the stable release or a pre-release:
154
220
155
221
| Last Stable | Last Pre-release | Bump | Pre-release Suffix | Resulting Version |
0 commit comments