mcp-server-motherduck 0.6.4__py3-none-any.whl → 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,427 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: mcp-server-motherduck
3
- Version: 0.6.4
4
- Summary: A MCP server for MotherDuck and local DuckDB
5
- Author-email: tdoehmen <till@motherduck.com>
6
- License-File: LICENSE
7
- Requires-Python: >=3.10
8
- Requires-Dist: anyio>=4.8.0
9
- Requires-Dist: click>=8.1.8
10
- Requires-Dist: duckdb==1.3.1
11
- Requires-Dist: mcp>=1.9.4
12
- Requires-Dist: pytz>=2025.2
13
- Requires-Dist: starlette>=0.46.1
14
- Requires-Dist: tabulate>=0.9.0
15
- Requires-Dist: uvicorn>=0.34.0
16
- Description-Content-Type: text/markdown
17
-
18
- # MotherDuck's DuckDB MCP Server
19
-
20
- An MCP server implementation that interacts with DuckDB and MotherDuck databases, providing SQL analytics capabilities to AI Assistants and IDEs.
21
-
22
- [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](cursor://anysphere.cursor-deeplink/mcp/install?name=DuckDB&config=eyJjb21tYW5kIjoidXZ4IG1jcC1zZXJ2ZXItbW90aGVyZHVjayAtLWRiLXBhdGggOm1lbW9yeToiLCJlbnYiOnsibW90aGVyZHVja190b2tlbiI6IiJ9fQ%3D%3D)
23
-
24
- ## Resources
25
- - [Close the Loop: Faster Data Pipelines with MCP, DuckDB & AI (Blogpost)](https://motherduck.com/blog/faster-data-pipelines-with-mcp-duckdb-ai/)
26
- - [Faster Data Pipelines development with MCP and DuckDB (YouTube)](https://www.youtube.com/watch?v=yG1mv8ZRxcU)
27
-
28
- ## Features
29
-
30
- - **Hybrid execution**: query data from local DuckDB or/and cloud-based MotherDuck databases
31
- - **Cloud storage integration**: access data stored in Amazon S3 or other cloud storage thanks to MotherDuck's integrations
32
- - **Data sharing**: create and share databases
33
- - **SQL analytics**: use DuckDB's SQL dialect to query any size of data directly from your AI Assistant or IDE
34
- - **Serverless architecture**: run analytics without needing to configure instances or clusters
35
-
36
- ## Components
37
-
38
- ### Prompts
39
-
40
- The server provides one prompt:
41
-
42
- - `duckdb-motherduck-initial-prompt`: A prompt to initialize a connection to DuckDB or MotherDuck and start working with it
43
-
44
- ### Tools
45
-
46
- The server offers one tool:
47
-
48
- - `query`: Execute a SQL query on the DuckDB or MotherDuck database
49
- - **Inputs**:
50
- - `query` (string, required): The SQL query to execute
51
-
52
- All interactions with both DuckDB and MotherDuck are done through writing SQL queries.
53
-
54
- ## Command Line Parameters
55
-
56
- The MCP server supports the following parameters:
57
-
58
- | Parameter | Type | Default | Description |
59
- |-----------|------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
60
- | `--transport` | Choice | `stdio` | Transport type. Options: `stdio`, `sse`, `stream` |
61
- | `--port` | Integer | `8000` | Port to listen on for sse and stream transport mode |
62
- | `--db-path` | String | `md:` | Path to local DuckDB database file or MotherDuck database |
63
- | `--motherduck-token` | String | `None` | Access token to use for MotherDuck database connections (uses `motherduck_token` env var by default) |
64
- | `--read-only` | Flag | `False` | Flag for connecting to DuckDB or MotherDuck in read-only mode. For DuckDB it uses short-lived connections to enable concurrent access |
65
- | `--home-dir` | String | `None` | Home directory for DuckDB (uses `HOME` env var by default) |
66
- | `--saas-mode` | Flag | `False` | Flag for connecting to MotherDuck in [SaaS mode](https://motherduck.com/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/#authentication-using-saas-mode). (disables filesystem and write permissions for local DuckDB) |
67
- | `--json-response` | Flag | `False` | Enable JSON responses for HTTP stream. Only supported for `stream` transport |
68
-
69
- ### Quick Usage Examples
70
-
71
- ```bash
72
- # Connect to local DuckDB file in read-only mode with stream transport mode
73
- uvx mcp-server-motherduck --transport stream --db-path /path/to/local.db --read-only
74
-
75
- # Connect to MotherDuck with token with stream transport mode
76
- uvx mcp-server-motherduck --transport stream --db-path md: --motherduck-token YOUR_TOKEN
77
-
78
- # Connect to local DuckDB file in read-only mode with stream transport mode
79
- uvx mcp-server-motherduck --transport stream --db-path /path/to/local.db --read-only
80
-
81
- # Connect to MotherDuck in SaaS mode for enhanced security with stream transport mode
82
- uvx mcp-server-motherduck --transport stream --db-path md: --motherduck-token YOUR_TOKEN --saas-mode
83
- ```
84
-
85
- ## Getting Started
86
-
87
- ### General Prerequisites
88
-
89
- - `uv` installed, you can install it using `pip install uv` or `brew install uv`
90
-
91
- If you plan to use the MCP with Claude Desktop or any other MCP comptabile client, the client need to be installed.
92
-
93
- ### Prerequisites for DuckDB
94
-
95
- - No prerequisites. The MCP server can create an in-memory database on-the-fly
96
- - Or connect to an existing local DuckDB database file , or one stored on remote object storage (e.g., AWS S3).
97
-
98
- See [Connect to local DuckDB](#connect-to-local-duckdb).
99
-
100
- ### Prerequisites for MotherDuck
101
-
102
- - Sign up for a [MotherDuck account](https://app.motherduck.com/?auth_flow=signup)
103
- - Generate an access token via the [MotherDuck UI](https://app.motherduck.com/settings/tokens?auth_flow=signup)
104
- - Store the token securely for use in the configuration
105
-
106
- ### Usage with Cursor
107
-
108
- 1. Install Cursor from [cursor.com/downloads](https://www.cursor.com/downloads) if you haven't already
109
-
110
- 2. Open Cursor:
111
-
112
- - To set it up globally for the first time, go to Settings->MCP and click on "+ Add new global MCP server".
113
- - This will open a `mcp.json` file to which you add the following configuration:
114
-
115
- ```json
116
- {
117
- "mcpServers": {
118
- "mcp-server-motherduck": {
119
- "command": "uvx",
120
- "args": [
121
- "mcp-server-motherduck",
122
- "--db-path",
123
- "md:",
124
- "--motherduck-token",
125
- "<YOUR_MOTHERDUCK_TOKEN_HERE>"
126
- ]
127
- }
128
- }
129
- }
130
- ```
131
-
132
- ### Usage with VS Code
133
-
134
- [![Install with UV in VS Code](https://img.shields.io/badge/VS_Code-Install_with_UV-0098FF?style=plastic)](https://insiders.vscode.dev/redirect/mcp/install?name=mcp-server-motherduck&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22mcp-server-motherduck%22%2C%22--db-path%22%2C%22md%3A%22%2C%22--motherduck-token%22%2C%22%24%7Binput%3Amotherduck_token%7D%22%5D%7D&inputs=%5B%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22motherduck_token%22%2C%22description%22%3A%22MotherDuck+Token%22%2C%22password%22%3Atrue%7D%5D) [![Install with UV in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_with_UV-24bfa5?style=plastic&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=mcp-server-motherduck&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22mcp-server-motherduck%22%2C%22--db-path%22%2C%22md%3A%22%2C%22--motherduck-token%22%2C%22%24%7Binput%3Amotherduck_token%7D%22%5D%7D&inputs=%5B%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22motherduck_token%22%2C%22description%22%3A%22MotherDuck+Token%22%2C%22password%22%3Atrue%7D%5D&quality=insiders)
135
-
136
- For the quickest installation, click one of the "Install with UV" buttons at the top.
137
-
138
- #### Manual Installation
139
-
140
- Add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing `Ctrl + Shift + P` and typing `Preferences: Open User Settings (JSON)`.
141
-
142
- ```json
143
- {
144
- "mcp": {
145
- "inputs": [
146
- {
147
- "type": "promptString",
148
- "id": "motherduck_token",
149
- "description": "MotherDuck Token",
150
- "password": true
151
- }
152
- ],
153
- "servers": {
154
- "motherduck": {
155
- "command": "uvx",
156
- "args": [
157
- "mcp-server-motherduck",
158
- "--db-path",
159
- "md:",
160
- "--motherduck-token",
161
- "${input:motherduck_token}"
162
- ]
163
- }
164
- }
165
- }
166
- }
167
- ```
168
-
169
- Optionally, you can add it to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others.
170
-
171
- ```json
172
- {
173
- "inputs": [
174
- {
175
- "type": "promptString",
176
- "id": "motherduck_token",
177
- "description": "MotherDuck Token",
178
- "password": true
179
- }
180
- ],
181
- "servers": {
182
- "motherduck": {
183
- "command": "uvx",
184
- "args": [
185
- "mcp-server-motherduck",
186
- "--db-path",
187
- "md:",
188
- "--motherduck-token",
189
- "${input:motherduck_token}"
190
- ]
191
- }
192
- }
193
- }
194
- ```
195
-
196
- ### Usage with Claude Desktop
197
-
198
- 1. Install Claude Desktop from [claude.ai/download](https://claude.ai/download) if you haven't already
199
-
200
- 2. Open the Claude Desktop configuration file:
201
-
202
- - To quickly access it or create it the first time, open the Claude Desktop app, select Settings, and click on the "Developer" tab, finally click on the "Edit Config" button.
203
- - Add the following configuration to your `claude_desktop_config.json`:
204
-
205
- ```json
206
- {
207
- "mcpServers": {
208
- "mcp-server-motherduck": {
209
- "command": "uvx",
210
- "args": [
211
- "mcp-server-motherduck",
212
- "--db-path",
213
- "md:",
214
- "--motherduck-token",
215
- "<YOUR_MOTHERDUCK_TOKEN_HERE>"
216
- ]
217
- }
218
- }
219
- }
220
- ```
221
-
222
- **Important Notes**:
223
-
224
- - Replace `YOUR_MOTHERDUCK_TOKEN_HERE` with your actual MotherDuck token
225
-
226
- ### Usage with Claude Code
227
-
228
- Claude Code supports MCP servers through CLI commands or JSON configuration. Here are two ways to set it up:
229
-
230
- #### Option 1: Using CLI Commands
231
-
232
- Add the MotherDuck MCP server directly using the Claude Code CLI:
233
-
234
- ```bash
235
- claude mcp add mcp-server-motherduck uvx mcp-server-motherduck -- --db-path md: --motherduck-token <YOUR_MOTHERDUCK_TOKEN_HERE>
236
- ```
237
-
238
- #### Option 2: Using JSON Configuration
239
-
240
- Add the server using a JSON configuration:
241
-
242
- ```bash
243
- claude mcp add-json mcp-server-motherduck '{
244
- "command": "uvx",
245
- "args": [
246
- "mcp-server-motherduck",
247
- "--db-path",
248
- "md:",
249
- "--motherduck-token",
250
- "<YOUR_MOTHERDUCK_TOKEN_HERE>"
251
- ]
252
- }'
253
- ```
254
-
255
- **Scoping Options**:
256
- - Use `--local` (default) for project-specific configuration
257
- - Use `--project` to share the configuration with your team via `.mcp.json`
258
- - Use `--user` to make the server available across all your projects
259
-
260
- **Important Notes**:
261
- - Replace `YOUR_MOTHERDUCK_TOKEN_HERE` with your actual MotherDuck token
262
- - Claude Code also supports environment variable expansion, so you can use `${MOTHERDUCK_TOKEN}` if you've set the environment variable
263
-
264
- ## Securing your MCP Server when querying MotherDuck
265
-
266
- If the MCP server is exposed to third parties and should only have read access to data, we recommend using a read scaling token and running the MCP server in SaaS mode.
267
-
268
- **Read Scaling Tokens** are special access tokens that enable scalable read operations by allowing up to 4 concurrent read replicas, improving performance for multiple end users while *restricting write capabilities*.
269
- Refer to the [Read Scaling documentation](https://motherduck.com/docs/key-tasks/authenticating-and-connecting-to-motherduck/read-scaling/#creating-a-read-scaling-token) to learn how to create a read-scaling token.
270
-
271
- **SaaS Mode** in MotherDuck enhances security by restricting it's access to local files, databases, extensions, and configurations, making it ideal for third-party tools that require stricter environment protection. Learn more about it in the [SaaS Mode documentation](https://motherduck.com/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/#authentication-using-saas-mode).
272
-
273
- **Secure Configuration**
274
-
275
- ```json
276
- {
277
- "mcpServers": {
278
- "mcp-server-motherduck": {
279
- "command": "uvx",
280
- "args": [
281
- "mcp-server-motherduck",
282
- "--db-path",
283
- "md:",
284
- "--motherduck-token",
285
- "<YOUR_READ_SCALING_TOKEN_HERE>",
286
- "--saas-mode"
287
- ]
288
- }
289
- }
290
- }
291
- ```
292
-
293
- ## Connect to local DuckDB
294
-
295
- To connect to a local DuckDB, instead of using the MotherDuck token, specify the path to your local DuckDB database file or use `:memory:` for an in-memory database.
296
-
297
- In-memory database:
298
-
299
- ```json
300
- {
301
- "mcpServers": {
302
- "mcp-server-motherduck": {
303
- "command": "uvx",
304
- "args": [
305
- "mcp-server-motherduck",
306
- "--db-path",
307
- ":memory:"
308
- ]
309
- }
310
- }
311
- }
312
- ```
313
-
314
- Local DuckDB file:
315
-
316
- ```json
317
- {
318
- "mcpServers": {
319
- "mcp-server-motherduck": {
320
- "command": "uvx",
321
- "args": [
322
- "mcp-server-motherduck",
323
- "--db-path",
324
- "/path/to/your/local.db"
325
- ]
326
- }
327
- }
328
- }
329
- ```
330
-
331
- Local DuckDB file in [readonly mode](https://duckdb.org/docs/stable/connect/concurrency.html):
332
-
333
- ```json
334
- {
335
- "mcpServers": {
336
- "mcp-server-motherduck": {
337
- "command": "uvx",
338
- "args": [
339
- "mcp-server-motherduck",
340
- "--db-path",
341
- "/path/to/your/local.db",
342
- "--read-only"
343
- ]
344
- }
345
- }
346
- }
347
- ```
348
-
349
- **Note**: readonly mode for local file-backed DuckDB connections also makes use of
350
- short lived connections. Each time the query MCP tool is used a temporary,
351
- reaodnly connection is created + query is executed + connection is closed. This
352
- feature was motivated by a workflow where [DBT](https://www.getdbt.com) was for
353
- modeling data within duckdb and then an MCP client (Windsurf/Cline/Claude/Cursor)
354
- was used for exploring the database. The short lived connections allow each tool
355
- to run and then release their connection, allowing the next tool to connect.
356
-
357
- ## Example Queries
358
-
359
- Once configured, you can e.g. ask Claude to run queries like:
360
-
361
- - "Create a new database and table in MotherDuck"
362
- - "Query data from my local CSV file"
363
- - "Join data from my local DuckDB database with a table in MotherDuck"
364
- - "Analyze data stored in Amazon S3"
365
-
366
- ## Running in SSE mode
367
-
368
- The server can run in SSE mode in two ways:
369
-
370
- ### Direct SSE mode
371
-
372
- Run the server directly in SSE mode using the `--transport sse` flag:
373
-
374
- ```bash
375
- uvx mcp-server-motherduck --transport sse --port 8000 --db-path md: --motherduck-token <your_motherduck_token>
376
- ```
377
-
378
- This will start the server listening on the specified port (default 8000) and you can point your clients directly to this endpoint.
379
-
380
- ### Using supergateway
381
-
382
- Alternatively, you can run SSE mode using `supergateway`:
383
-
384
- ```bash
385
- npx -y supergateway --stdio "uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>"
386
- ```
387
-
388
- Both methods allow you to point your clients such as Claude Desktop, Cursor to the SSE endpoint.
389
-
390
- ## Development configuration
391
-
392
- To run the server from a local development environment, use the following configuration:
393
-
394
- ```json
395
- {
396
- "mcpServers": {
397
- "mcp-server-motherduck": {
398
- "command": "uv",
399
- "args": [
400
- "--directory",
401
- "/path/to/your/local/mcp-server-motherduck",
402
- "run",
403
- "mcp-server-motherduck",
404
- "--db-path",
405
- "md:",
406
- "--motherduck-token",
407
- "<YOUR_MOTHERDUCK_TOKEN_HERE>"
408
- ]
409
- }
410
- }
411
- }
412
- ```
413
-
414
- ## Troubleshooting
415
-
416
- - If you encounter connection issues, verify your MotherDuck token is correct
417
- - For local file access problems, ensure the `--home-dir` parameter is set correctly
418
- - Check that the `uvx` command is available in your PATH
419
- - If you encounter [`spawn uvx ENOENT`](https://github.com/motherduckdb/mcp-server-motherduck/issues/6) errors, try specifying the full path to `uvx` (output of `which uvx`)
420
- - In version previous for v0.4.0 we used environment variables, now we use parameters
421
-
422
- ## License
423
-
424
- This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
425
-
426
- ##
427
- mcp-name: io.github.motherduckdb/mcp-server-motherduck
@@ -1,10 +0,0 @@
1
- mcp_server_motherduck/__init__.py,sha256=vogjO-bwHYZFut85eeiVmRepamcWHk8bImri_kBKZMU,6026
2
- mcp_server_motherduck/configs.py,sha256=-9cNtMBsNn0OK-0pxRWxMoTy4VbfUdCMKQG_BPMmIu4,771
3
- mcp_server_motherduck/database.py,sha256=3qkeBIpf08WV6pz9rf52b_MipzaHALurFugMx-XARI8,4513
4
- mcp_server_motherduck/prompt.py,sha256=P7BrmhVXwDkPeSHQ3f25WMP6lpBpN2BxDzYPOQ3fxX8,56699
5
- mcp_server_motherduck/server.py,sha256=U1LM2oQ36gO_pAZuez9HV_u8YDWdER8tQIdDbiXfzx0,5232
6
- mcp_server_motherduck-0.6.4.dist-info/METADATA,sha256=McZsr6b8gFcH4ju85Ck2eC7-Z0cS06V_fOyecihfVIA,16831
7
- mcp_server_motherduck-0.6.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
- mcp_server_motherduck-0.6.4.dist-info/entry_points.txt,sha256=dRTgcvWJn40bz0PVuKPylK6w92cFN32lwunZOgo5j4s,69
9
- mcp_server_motherduck-0.6.4.dist-info/licenses/LICENSE,sha256=Tj68w9jCiceFKTvZ3jET-008NjhozcQMXpm-fyL9WUI,1067
10
- mcp_server_motherduck-0.6.4.dist-info/RECORD,,