mcp-server-motherduck 0.4.0__tar.gz → 0.4.2__tar.gz
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.
- mcp_server_motherduck-0.4.2/.idea/.gitignore +8 -0
- mcp_server_motherduck-0.4.2/.idea/mcp-server-motherduck.iml +9 -0
- mcp_server_motherduck-0.4.2/.idea/misc.xml +6 -0
- mcp_server_motherduck-0.4.2/.idea/modules.xml +8 -0
- mcp_server_motherduck-0.4.2/.idea/vcs.xml +6 -0
- mcp_server_motherduck-0.4.2/.idea/workspace.xml +60 -0
- mcp_server_motherduck-0.4.2/PKG-INFO +334 -0
- mcp_server_motherduck-0.4.2/README.md +321 -0
- {mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/pyproject.toml +2 -2
- {mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/src/mcp_server_motherduck/__init__.py +6 -0
- {mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/src/mcp_server_motherduck/server.py +11 -4
- {mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/uv.lock +37 -37
- mcp_server_motherduck-0.4.0/PKG-INFO +0 -150
- mcp_server_motherduck-0.4.0/README.md +0 -137
- {mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/.github/workflows/python-publish.yml +0 -0
- {mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/.gitignore +0 -0
- {mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/LICENSE +0 -0
- {mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/makefile +0 -0
- {mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/src/mcp_server_motherduck/prompt.py +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
6
|
+
<orderEntry type="inheritedJdk" />
|
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
+
</component>
|
|
9
|
+
</module>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" project-jdk-name="Python 3.11" project-jdk-type="Python SDK">
|
|
4
|
+
<output url="file://$PROJECT_DIR$/out" />
|
|
5
|
+
</component>
|
|
6
|
+
</project>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/mcp-server-motherduck.iml" filepath="$PROJECT_DIR$/.idea/mcp-server-motherduck.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="AutoImportSettings">
|
|
4
|
+
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ChangeListManager">
|
|
7
|
+
<list default="true" id="8bdee1d4-886c-4093-b4cf-95b120034c9e" name="Changes" comment="" />
|
|
8
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
9
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
11
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="Git.Settings">
|
|
14
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
15
|
+
</component>
|
|
16
|
+
<component name="MarkdownSettingsMigration">
|
|
17
|
+
<option name="stateVersion" value="1" />
|
|
18
|
+
</component>
|
|
19
|
+
<component name="ProjectColorInfo"><![CDATA[{
|
|
20
|
+
"associatedIndex": 3
|
|
21
|
+
}]]></component>
|
|
22
|
+
<component name="ProjectId" id="2vcb2orYlzlw5ZHOvoXgpTtCdVi" />
|
|
23
|
+
<component name="ProjectViewState">
|
|
24
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
25
|
+
<option name="showLibraryContents" value="true" />
|
|
26
|
+
</component>
|
|
27
|
+
<component name="PropertiesComponent"><![CDATA[{
|
|
28
|
+
"keyToString": {
|
|
29
|
+
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
|
30
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
31
|
+
"WebServerToolWindowFactoryState": "false",
|
|
32
|
+
"git-widget-placeholder": "till/add__saas__mode",
|
|
33
|
+
"last_opened_file_path": "/Users/doehmen/Documents/motherduck/mcp-server-motherduck",
|
|
34
|
+
"node.js.detected.package.eslint": "true",
|
|
35
|
+
"node.js.detected.package.tslint": "true",
|
|
36
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
37
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
38
|
+
"nodejs_package_manager_path": "npm",
|
|
39
|
+
"project.structure.last.edited": "Project",
|
|
40
|
+
"project.structure.proportion": "0.0",
|
|
41
|
+
"project.structure.side.proportion": "0.0",
|
|
42
|
+
"vue.rearranger.settings.migration": "true"
|
|
43
|
+
}
|
|
44
|
+
}]]></component>
|
|
45
|
+
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
46
|
+
<component name="TaskManager">
|
|
47
|
+
<task active="true" id="Default" summary="Default task">
|
|
48
|
+
<changelist id="8bdee1d4-886c-4093-b4cf-95b120034c9e" name="Changes" comment="" />
|
|
49
|
+
<created>1744447105618</created>
|
|
50
|
+
<option name="number" value="Default" />
|
|
51
|
+
<option name="presentableId" value="Default" />
|
|
52
|
+
<updated>1744447105618</updated>
|
|
53
|
+
<workItem from="1744447107447" duration="7470000" />
|
|
54
|
+
</task>
|
|
55
|
+
<servers />
|
|
56
|
+
</component>
|
|
57
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
58
|
+
<option name="version" value="3" />
|
|
59
|
+
</component>
|
|
60
|
+
</project>
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-server-motherduck
|
|
3
|
+
Version: 0.4.2
|
|
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: duckdb==1.2.2
|
|
9
|
+
Requires-Dist: mcp>=1.3.0
|
|
10
|
+
Requires-Dist: pandas>=2.0.0
|
|
11
|
+
Requires-Dist: tabulate>=0.9.0
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# MotherDuck's DuckDB MCP Server
|
|
15
|
+
|
|
16
|
+
An MCP server implementation that interacts with DuckDB and MotherDuck databases, providing SQL analytics capabilities to AI Assistants and IDEs.
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- **Hybrid execution**: query data from local DuckDB or/and cloud-based MotherDuck databases
|
|
21
|
+
- **Cloud storage integration**: access data stored in Amazon S3 or other cloud storage thanks to MotherDuck's integrations
|
|
22
|
+
- **Data sharing**: create and share databases
|
|
23
|
+
- **SQL analytics**: use DuckDB's SQL dialect to query any size of data directly from your AI Assistant or IDE
|
|
24
|
+
- **Serverless architecture**: run analytics without needing to configure instances or clusters
|
|
25
|
+
|
|
26
|
+
## Components
|
|
27
|
+
|
|
28
|
+
### Prompts
|
|
29
|
+
|
|
30
|
+
The server provides one prompt:
|
|
31
|
+
|
|
32
|
+
- `duckdb-motherduck-initial-prompt`: A prompt to initialize a connection to DuckDB or MotherDuck and start working with it
|
|
33
|
+
|
|
34
|
+
### Tools
|
|
35
|
+
|
|
36
|
+
The server offers one tool:
|
|
37
|
+
|
|
38
|
+
- `query`: Execute a SQL query on the DuckDB or MotherDuck database
|
|
39
|
+
- **Inputs**:
|
|
40
|
+
- `query` (string, required): The SQL query to execute
|
|
41
|
+
|
|
42
|
+
All interactions with both DuckDB and MotherDuck are done through writing SQL queries.
|
|
43
|
+
|
|
44
|
+
## Getting Started
|
|
45
|
+
|
|
46
|
+
### General Prerequisites
|
|
47
|
+
- `uv` installed, you can install it using `pip install uv` or `brew install uv`
|
|
48
|
+
|
|
49
|
+
If you plan to use the MCP with Claude Desktop or any other MCP comptabile client, the client need to be installed.
|
|
50
|
+
|
|
51
|
+
### Prerequisites for DuckDB
|
|
52
|
+
|
|
53
|
+
- No prerequisites. The MCP server can create an in-memory database on-the-fly
|
|
54
|
+
- Or connect to an existing local DuckDB database file , or one stored on remote object storage (e.g., AWS S3).
|
|
55
|
+
|
|
56
|
+
See [Connect to local DuckDB](#connect-to-local-duckdb).
|
|
57
|
+
|
|
58
|
+
### Prerequisites for MotherDuck
|
|
59
|
+
|
|
60
|
+
- Sign up for a [MotherDuck account](https://app.motherduck.com/?auth_flow=signup)
|
|
61
|
+
- Generate an access token via the [MotherDuck UI](https://app.motherduck.com/settings/tokens?auth_flow=signup)
|
|
62
|
+
- Store the token securely for use in the configuration
|
|
63
|
+
|
|
64
|
+
### Usage with Cursor
|
|
65
|
+
|
|
66
|
+
1. Install Cursor from [cursor.com/downloads](https://www.cursor.com/downloads) if you haven't already
|
|
67
|
+
|
|
68
|
+
2. Open Cursor:
|
|
69
|
+
|
|
70
|
+
- To set it up globally for the first time, go to Settings->MCP and click on "+ Add new global MCP server".
|
|
71
|
+
- This will open a `mcp.json` file to which you add the following configuration:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"mcp-server-motherduck": {
|
|
77
|
+
"command": "uvx",
|
|
78
|
+
"args": [
|
|
79
|
+
"mcp-server-motherduck",
|
|
80
|
+
"--db-path",
|
|
81
|
+
"md:",
|
|
82
|
+
"--motherduck-token",
|
|
83
|
+
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Usage with VS Code
|
|
91
|
+
|
|
92
|
+
[](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) [](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)
|
|
93
|
+
1. For the quickest installation, click one of the "Install with UV" buttons at the top of this README.
|
|
94
|
+
|
|
95
|
+
### Manual Installation
|
|
96
|
+
|
|
97
|
+
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)`.
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcp": {
|
|
102
|
+
"inputs": [
|
|
103
|
+
{
|
|
104
|
+
"type": "promptString",
|
|
105
|
+
"id": "motherduck_token",
|
|
106
|
+
"description": "MotherDuck Token",
|
|
107
|
+
"password": true
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"servers": {
|
|
111
|
+
"motherduck": {
|
|
112
|
+
"command": "uvx",
|
|
113
|
+
"args": [
|
|
114
|
+
"mcp-server-motherduck",
|
|
115
|
+
"--db-path",
|
|
116
|
+
"md:",
|
|
117
|
+
"--motherduck-token",
|
|
118
|
+
"${input:motherduck_token}"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
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.
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"inputs": [
|
|
131
|
+
{
|
|
132
|
+
"type": "promptString",
|
|
133
|
+
"id": "motherduck_token",
|
|
134
|
+
"description": "MotherDuck Token",
|
|
135
|
+
"password": true
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"servers": {
|
|
139
|
+
"motherduck": {
|
|
140
|
+
"command": "uvx",
|
|
141
|
+
"args": [
|
|
142
|
+
"mcp-server-motherduck",
|
|
143
|
+
"--db-path",
|
|
144
|
+
"md:",
|
|
145
|
+
"--motherduck-token",
|
|
146
|
+
"${input:motherduck_token}"
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Usage with Claude Desktop
|
|
154
|
+
|
|
155
|
+
1. Install Claude Desktop from [claude.ai/download](https://claude.ai/download) if you haven't already
|
|
156
|
+
|
|
157
|
+
2. Open the Claude Desktop configuration file:
|
|
158
|
+
|
|
159
|
+
- 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.
|
|
160
|
+
- Add the following configuration to your `claude_desktop_config.json`:
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"mcpServers": {
|
|
165
|
+
"mcp-server-motherduck": {
|
|
166
|
+
"command": "uvx",
|
|
167
|
+
"args": [
|
|
168
|
+
"mcp-server-motherduck",
|
|
169
|
+
"--db-path",
|
|
170
|
+
"md:",
|
|
171
|
+
"--motherduck-token",
|
|
172
|
+
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Important Notes**:
|
|
180
|
+
|
|
181
|
+
- Replace `YOUR_MOTHERDUCK_TOKEN_HERE` with your actual MotherDuck token
|
|
182
|
+
- Replace `YOUR_HOME_FOLDER_PATH` with the path to your home directory (needed by DuckDB for file operations). For example, on macOS, it would be `/Users/your_username`
|
|
183
|
+
- The `HOME` environment variable is required for DuckDB to function properly.
|
|
184
|
+
|
|
185
|
+
## Securing your MCP Server when querying MotherDuck
|
|
186
|
+
|
|
187
|
+
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.
|
|
188
|
+
|
|
189
|
+
**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*.
|
|
190
|
+
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.
|
|
191
|
+
|
|
192
|
+
**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).
|
|
193
|
+
|
|
194
|
+
**Secure Configuration**
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"mcpServers": {
|
|
198
|
+
"mcp-server-motherduck": {
|
|
199
|
+
"command": "uvx",
|
|
200
|
+
"args": [
|
|
201
|
+
"mcp-server-motherduck",
|
|
202
|
+
"--db-path",
|
|
203
|
+
"md:",
|
|
204
|
+
"--motherduck-token",
|
|
205
|
+
"<YOUR_READ_SCALING_TOKEN_HERE>",
|
|
206
|
+
"--saas-mode"
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Connect to local DuckDB
|
|
214
|
+
|
|
215
|
+
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.
|
|
216
|
+
|
|
217
|
+
In-memory database:
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"mcpServers": {
|
|
221
|
+
"mcp-server-motherduck": {
|
|
222
|
+
"command": "uvx",
|
|
223
|
+
"args": [
|
|
224
|
+
"mcp-server-motherduck",
|
|
225
|
+
"--db-path",
|
|
226
|
+
":memory:"
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Local DuckDB file:
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"mcpServers": {
|
|
237
|
+
"mcp-server-motherduck": {
|
|
238
|
+
"command": "uvx",
|
|
239
|
+
"args": [
|
|
240
|
+
"mcp-server-motherduck",
|
|
241
|
+
"--db-path",
|
|
242
|
+
"/path/to/your/local.db"
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Example Queries
|
|
250
|
+
|
|
251
|
+
Once configured, you can e.g. ask Claude to run queries like:
|
|
252
|
+
|
|
253
|
+
- "Create a new database and table in MotherDuck"
|
|
254
|
+
- "Query data from my local CSV file"
|
|
255
|
+
- "Join data from my local DuckDB database with a table in MotherDuck"
|
|
256
|
+
- "Analyze data stored in Amazon S3"
|
|
257
|
+
|
|
258
|
+
## Testing
|
|
259
|
+
|
|
260
|
+
The server is designed to be run by tools like Claude Desktop and Cursor, but you can start it manually for testing purposes. When testing the server manually, you can specify which database to connect to using the `--db-path` parameter:
|
|
261
|
+
|
|
262
|
+
1. **Default MotherDuck database**:
|
|
263
|
+
|
|
264
|
+
- To connect to the default MotherDuck database, you will need to pass the auth token using the `--motherduck-token` parameter.
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
2. **Specific MotherDuck database**:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
uvx mcp-server-motherduck --db-path md:your_database_name --motherduck-token <your_motherduck_token>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
3. **Local DuckDB database**:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
uvx mcp-server-motherduck --db-path /path/to/your/local.db
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
4. **In-memory database**:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
uvx mcp-server-motherduck --db-path :memory:
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
If you don't specify a database path but have set the `motherduck_token` environment variable, the server will automatically connect to the default MotherDuck database (`md:`).
|
|
289
|
+
|
|
290
|
+
## Running in SSE mode
|
|
291
|
+
|
|
292
|
+
The server could also be running SSE mode using `supergateway` by running the following command:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
npx -y supergateway --stdio "uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
And you can point your clients such as Claude Desktop, Cursor to this endpoint.
|
|
299
|
+
|
|
300
|
+
## Development configuration
|
|
301
|
+
|
|
302
|
+
To run the server from a local development environment, use the following configuration:
|
|
303
|
+
|
|
304
|
+
```json
|
|
305
|
+
{
|
|
306
|
+
"mcpServers": {
|
|
307
|
+
"mcp-server-motherduck": {
|
|
308
|
+
"command": "uv",
|
|
309
|
+
"args": [
|
|
310
|
+
"--directory",
|
|
311
|
+
"/path/to/your/local/mcp-server-motherduck",
|
|
312
|
+
"run",
|
|
313
|
+
"mcp-server-motherduck",
|
|
314
|
+
"--db-path",
|
|
315
|
+
"md:",
|
|
316
|
+
"--motherduck-token",
|
|
317
|
+
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## Troubleshooting
|
|
325
|
+
|
|
326
|
+
- If you encounter connection issues, verify your MotherDuck token is correct
|
|
327
|
+
- For local file access problems, ensure the `--home-dir` parameter is set correctly
|
|
328
|
+
- Check that the `uvx` command is available in your PATH
|
|
329
|
+
- 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`)
|
|
330
|
+
- In version previous for v0.4.0 we used environment variables, now we use parameters
|
|
331
|
+
|
|
332
|
+
## License
|
|
333
|
+
|
|
334
|
+
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.
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
# MotherDuck's DuckDB MCP Server
|
|
2
|
+
|
|
3
|
+
An MCP server implementation that interacts with DuckDB and MotherDuck databases, providing SQL analytics capabilities to AI Assistants and IDEs.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Hybrid execution**: query data from local DuckDB or/and cloud-based MotherDuck databases
|
|
8
|
+
- **Cloud storage integration**: access data stored in Amazon S3 or other cloud storage thanks to MotherDuck's integrations
|
|
9
|
+
- **Data sharing**: create and share databases
|
|
10
|
+
- **SQL analytics**: use DuckDB's SQL dialect to query any size of data directly from your AI Assistant or IDE
|
|
11
|
+
- **Serverless architecture**: run analytics without needing to configure instances or clusters
|
|
12
|
+
|
|
13
|
+
## Components
|
|
14
|
+
|
|
15
|
+
### Prompts
|
|
16
|
+
|
|
17
|
+
The server provides one prompt:
|
|
18
|
+
|
|
19
|
+
- `duckdb-motherduck-initial-prompt`: A prompt to initialize a connection to DuckDB or MotherDuck and start working with it
|
|
20
|
+
|
|
21
|
+
### Tools
|
|
22
|
+
|
|
23
|
+
The server offers one tool:
|
|
24
|
+
|
|
25
|
+
- `query`: Execute a SQL query on the DuckDB or MotherDuck database
|
|
26
|
+
- **Inputs**:
|
|
27
|
+
- `query` (string, required): The SQL query to execute
|
|
28
|
+
|
|
29
|
+
All interactions with both DuckDB and MotherDuck are done through writing SQL queries.
|
|
30
|
+
|
|
31
|
+
## Getting Started
|
|
32
|
+
|
|
33
|
+
### General Prerequisites
|
|
34
|
+
- `uv` installed, you can install it using `pip install uv` or `brew install uv`
|
|
35
|
+
|
|
36
|
+
If you plan to use the MCP with Claude Desktop or any other MCP comptabile client, the client need to be installed.
|
|
37
|
+
|
|
38
|
+
### Prerequisites for DuckDB
|
|
39
|
+
|
|
40
|
+
- No prerequisites. The MCP server can create an in-memory database on-the-fly
|
|
41
|
+
- Or connect to an existing local DuckDB database file , or one stored on remote object storage (e.g., AWS S3).
|
|
42
|
+
|
|
43
|
+
See [Connect to local DuckDB](#connect-to-local-duckdb).
|
|
44
|
+
|
|
45
|
+
### Prerequisites for MotherDuck
|
|
46
|
+
|
|
47
|
+
- Sign up for a [MotherDuck account](https://app.motherduck.com/?auth_flow=signup)
|
|
48
|
+
- Generate an access token via the [MotherDuck UI](https://app.motherduck.com/settings/tokens?auth_flow=signup)
|
|
49
|
+
- Store the token securely for use in the configuration
|
|
50
|
+
|
|
51
|
+
### Usage with Cursor
|
|
52
|
+
|
|
53
|
+
1. Install Cursor from [cursor.com/downloads](https://www.cursor.com/downloads) if you haven't already
|
|
54
|
+
|
|
55
|
+
2. Open Cursor:
|
|
56
|
+
|
|
57
|
+
- To set it up globally for the first time, go to Settings->MCP and click on "+ Add new global MCP server".
|
|
58
|
+
- This will open a `mcp.json` file to which you add the following configuration:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"mcp-server-motherduck": {
|
|
64
|
+
"command": "uvx",
|
|
65
|
+
"args": [
|
|
66
|
+
"mcp-server-motherduck",
|
|
67
|
+
"--db-path",
|
|
68
|
+
"md:",
|
|
69
|
+
"--motherduck-token",
|
|
70
|
+
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Usage with VS Code
|
|
78
|
+
|
|
79
|
+
[](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) [](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)
|
|
80
|
+
1. For the quickest installation, click one of the "Install with UV" buttons at the top of this README.
|
|
81
|
+
|
|
82
|
+
### Manual Installation
|
|
83
|
+
|
|
84
|
+
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)`.
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"mcp": {
|
|
89
|
+
"inputs": [
|
|
90
|
+
{
|
|
91
|
+
"type": "promptString",
|
|
92
|
+
"id": "motherduck_token",
|
|
93
|
+
"description": "MotherDuck Token",
|
|
94
|
+
"password": true
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"servers": {
|
|
98
|
+
"motherduck": {
|
|
99
|
+
"command": "uvx",
|
|
100
|
+
"args": [
|
|
101
|
+
"mcp-server-motherduck",
|
|
102
|
+
"--db-path",
|
|
103
|
+
"md:",
|
|
104
|
+
"--motherduck-token",
|
|
105
|
+
"${input:motherduck_token}"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
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.
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"inputs": [
|
|
118
|
+
{
|
|
119
|
+
"type": "promptString",
|
|
120
|
+
"id": "motherduck_token",
|
|
121
|
+
"description": "MotherDuck Token",
|
|
122
|
+
"password": true
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"servers": {
|
|
126
|
+
"motherduck": {
|
|
127
|
+
"command": "uvx",
|
|
128
|
+
"args": [
|
|
129
|
+
"mcp-server-motherduck",
|
|
130
|
+
"--db-path",
|
|
131
|
+
"md:",
|
|
132
|
+
"--motherduck-token",
|
|
133
|
+
"${input:motherduck_token}"
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Usage with Claude Desktop
|
|
141
|
+
|
|
142
|
+
1. Install Claude Desktop from [claude.ai/download](https://claude.ai/download) if you haven't already
|
|
143
|
+
|
|
144
|
+
2. Open the Claude Desktop configuration file:
|
|
145
|
+
|
|
146
|
+
- 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.
|
|
147
|
+
- Add the following configuration to your `claude_desktop_config.json`:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"mcpServers": {
|
|
152
|
+
"mcp-server-motherduck": {
|
|
153
|
+
"command": "uvx",
|
|
154
|
+
"args": [
|
|
155
|
+
"mcp-server-motherduck",
|
|
156
|
+
"--db-path",
|
|
157
|
+
"md:",
|
|
158
|
+
"--motherduck-token",
|
|
159
|
+
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Important Notes**:
|
|
167
|
+
|
|
168
|
+
- Replace `YOUR_MOTHERDUCK_TOKEN_HERE` with your actual MotherDuck token
|
|
169
|
+
- Replace `YOUR_HOME_FOLDER_PATH` with the path to your home directory (needed by DuckDB for file operations). For example, on macOS, it would be `/Users/your_username`
|
|
170
|
+
- The `HOME` environment variable is required for DuckDB to function properly.
|
|
171
|
+
|
|
172
|
+
## Securing your MCP Server when querying MotherDuck
|
|
173
|
+
|
|
174
|
+
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.
|
|
175
|
+
|
|
176
|
+
**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*.
|
|
177
|
+
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.
|
|
178
|
+
|
|
179
|
+
**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).
|
|
180
|
+
|
|
181
|
+
**Secure Configuration**
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"mcpServers": {
|
|
185
|
+
"mcp-server-motherduck": {
|
|
186
|
+
"command": "uvx",
|
|
187
|
+
"args": [
|
|
188
|
+
"mcp-server-motherduck",
|
|
189
|
+
"--db-path",
|
|
190
|
+
"md:",
|
|
191
|
+
"--motherduck-token",
|
|
192
|
+
"<YOUR_READ_SCALING_TOKEN_HERE>",
|
|
193
|
+
"--saas-mode"
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Connect to local DuckDB
|
|
201
|
+
|
|
202
|
+
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.
|
|
203
|
+
|
|
204
|
+
In-memory database:
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"mcpServers": {
|
|
208
|
+
"mcp-server-motherduck": {
|
|
209
|
+
"command": "uvx",
|
|
210
|
+
"args": [
|
|
211
|
+
"mcp-server-motherduck",
|
|
212
|
+
"--db-path",
|
|
213
|
+
":memory:"
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Local DuckDB file:
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"mcpServers": {
|
|
224
|
+
"mcp-server-motherduck": {
|
|
225
|
+
"command": "uvx",
|
|
226
|
+
"args": [
|
|
227
|
+
"mcp-server-motherduck",
|
|
228
|
+
"--db-path",
|
|
229
|
+
"/path/to/your/local.db"
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Example Queries
|
|
237
|
+
|
|
238
|
+
Once configured, you can e.g. ask Claude to run queries like:
|
|
239
|
+
|
|
240
|
+
- "Create a new database and table in MotherDuck"
|
|
241
|
+
- "Query data from my local CSV file"
|
|
242
|
+
- "Join data from my local DuckDB database with a table in MotherDuck"
|
|
243
|
+
- "Analyze data stored in Amazon S3"
|
|
244
|
+
|
|
245
|
+
## Testing
|
|
246
|
+
|
|
247
|
+
The server is designed to be run by tools like Claude Desktop and Cursor, but you can start it manually for testing purposes. When testing the server manually, you can specify which database to connect to using the `--db-path` parameter:
|
|
248
|
+
|
|
249
|
+
1. **Default MotherDuck database**:
|
|
250
|
+
|
|
251
|
+
- To connect to the default MotherDuck database, you will need to pass the auth token using the `--motherduck-token` parameter.
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
2. **Specific MotherDuck database**:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
uvx mcp-server-motherduck --db-path md:your_database_name --motherduck-token <your_motherduck_token>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
3. **Local DuckDB database**:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
uvx mcp-server-motherduck --db-path /path/to/your/local.db
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
4. **In-memory database**:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
uvx mcp-server-motherduck --db-path :memory:
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
If you don't specify a database path but have set the `motherduck_token` environment variable, the server will automatically connect to the default MotherDuck database (`md:`).
|
|
276
|
+
|
|
277
|
+
## Running in SSE mode
|
|
278
|
+
|
|
279
|
+
The server could also be running SSE mode using `supergateway` by running the following command:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
npx -y supergateway --stdio "uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>"
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
And you can point your clients such as Claude Desktop, Cursor to this endpoint.
|
|
286
|
+
|
|
287
|
+
## Development configuration
|
|
288
|
+
|
|
289
|
+
To run the server from a local development environment, use the following configuration:
|
|
290
|
+
|
|
291
|
+
```json
|
|
292
|
+
{
|
|
293
|
+
"mcpServers": {
|
|
294
|
+
"mcp-server-motherduck": {
|
|
295
|
+
"command": "uv",
|
|
296
|
+
"args": [
|
|
297
|
+
"--directory",
|
|
298
|
+
"/path/to/your/local/mcp-server-motherduck",
|
|
299
|
+
"run",
|
|
300
|
+
"mcp-server-motherduck",
|
|
301
|
+
"--db-path",
|
|
302
|
+
"md:",
|
|
303
|
+
"--motherduck-token",
|
|
304
|
+
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Troubleshooting
|
|
312
|
+
|
|
313
|
+
- If you encounter connection issues, verify your MotherDuck token is correct
|
|
314
|
+
- For local file access problems, ensure the `--home-dir` parameter is set correctly
|
|
315
|
+
- Check that the `uvx` command is available in your PATH
|
|
316
|
+
- 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`)
|
|
317
|
+
- In version previous for v0.4.0 we used environment variables, now we use parameters
|
|
318
|
+
|
|
319
|
+
## License
|
|
320
|
+
|
|
321
|
+
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.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mcp-server-motherduck"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.2"
|
|
4
4
|
description = "A MCP server for MotherDuck and local DuckDB"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
7
|
dependencies = [
|
|
8
8
|
"mcp>=1.3.0",
|
|
9
|
-
"duckdb
|
|
9
|
+
"duckdb==1.2.2",
|
|
10
10
|
"pandas>=2.0.0",
|
|
11
11
|
"tabulate>=0.9.0",
|
|
12
12
|
]
|
{mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/src/mcp_server_motherduck/__init__.py
RENAMED
|
@@ -26,6 +26,11 @@ def main():
|
|
|
26
26
|
default=None,
|
|
27
27
|
help="(Default: env var `HOME`) Home directory for DuckDB",
|
|
28
28
|
)
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"--saas-mode",
|
|
31
|
+
action="store_true",
|
|
32
|
+
help="Flag for connecting to MotherDuck in SaaS mode",
|
|
33
|
+
)
|
|
29
34
|
# This is experimental and will change in the future
|
|
30
35
|
parser.add_argument(
|
|
31
36
|
"--result-format",
|
|
@@ -45,6 +50,7 @@ def main():
|
|
|
45
50
|
motherduck_token=args.motherduck_token,
|
|
46
51
|
result_format=args.result_format,
|
|
47
52
|
home_dir=args.home_dir,
|
|
53
|
+
saas_mode=args.saas_mode,
|
|
48
54
|
)
|
|
49
55
|
)
|
|
50
56
|
|
{mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/src/mcp_server_motherduck/server.py
RENAMED
|
@@ -12,7 +12,7 @@ from mcp.server.models import InitializationOptions
|
|
|
12
12
|
from .prompt import PROMPT_TEMPLATE
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
SERVER_VERSION = "0.4.
|
|
15
|
+
SERVER_VERSION = "0.4.2"
|
|
16
16
|
|
|
17
17
|
logger = logging.getLogger("mcp_server_motherduck")
|
|
18
18
|
|
|
@@ -24,9 +24,10 @@ class DatabaseClient:
|
|
|
24
24
|
motherduck_token: str | None = None,
|
|
25
25
|
result_format: Literal["markdown", "duckbox", "text"] = "markdown",
|
|
26
26
|
home_dir: str | None = None,
|
|
27
|
+
saas_mode: bool = False,
|
|
27
28
|
):
|
|
28
29
|
self.db_path, self.db_type = self._resolve_db_path_type(
|
|
29
|
-
db_path, motherduck_token
|
|
30
|
+
db_path, motherduck_token, saas_mode
|
|
30
31
|
)
|
|
31
32
|
logger.info(f"Database client initialized in `{self.db_type}` mode")
|
|
32
33
|
|
|
@@ -52,14 +53,18 @@ class DatabaseClient:
|
|
|
52
53
|
return conn
|
|
53
54
|
|
|
54
55
|
def _resolve_db_path_type(
|
|
55
|
-
self, db_path: str, motherduck_token: str | None = None
|
|
56
|
+
self, db_path: str, motherduck_token: str | None = None, saas_mode: bool = False
|
|
56
57
|
) -> tuple[str, Literal["duckdb", "motherduck"]]:
|
|
57
58
|
"""Resolve and validate the database path"""
|
|
58
59
|
# Handle MotherDuck paths
|
|
59
60
|
if db_path.startswith("md:"):
|
|
60
61
|
if motherduck_token:
|
|
61
62
|
logger.info("Using MotherDuck token to connect to database `md:`")
|
|
62
|
-
|
|
63
|
+
if saas_mode:
|
|
64
|
+
logger.info("Connecting to MotherDuck in SaaS mode")
|
|
65
|
+
return f"{db_path}?motherduck_token={motherduck_token}&saas_mode=true", "motherduck"
|
|
66
|
+
else:
|
|
67
|
+
return f"{db_path}?motherduck_token={motherduck_token}", "motherduck"
|
|
63
68
|
elif os.getenv("motherduck_token"):
|
|
64
69
|
logger.info(
|
|
65
70
|
"Using MotherDuck token from env to connect to database `md:`"
|
|
@@ -112,6 +117,7 @@ async def main(
|
|
|
112
117
|
motherduck_token: str | None = None,
|
|
113
118
|
result_format: Literal["markdown", "duckbox", "text"] = "markdown",
|
|
114
119
|
home_dir: str | None = None,
|
|
120
|
+
saas_mode: bool = False,
|
|
115
121
|
):
|
|
116
122
|
logger.info("Starting MotherDuck MCP Server")
|
|
117
123
|
server = Server("mcp-server-motherduck")
|
|
@@ -120,6 +126,7 @@ async def main(
|
|
|
120
126
|
result_format=result_format,
|
|
121
127
|
motherduck_token=motherduck_token,
|
|
122
128
|
home_dir=home_dir,
|
|
129
|
+
saas_mode=saas_mode,
|
|
123
130
|
)
|
|
124
131
|
|
|
125
132
|
logger.info("Registering handlers")
|
|
@@ -44,7 +44,7 @@ name = "click"
|
|
|
44
44
|
version = "8.1.8"
|
|
45
45
|
source = { registry = "https://pypi.org/simple" }
|
|
46
46
|
dependencies = [
|
|
47
|
-
{ name = "colorama", marker = "
|
|
47
|
+
{ name = "colorama", marker = "platform_system == 'Windows'" },
|
|
48
48
|
]
|
|
49
49
|
sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593 }
|
|
50
50
|
wheels = [
|
|
@@ -62,42 +62,42 @@ wheels = [
|
|
|
62
62
|
|
|
63
63
|
[[package]]
|
|
64
64
|
name = "duckdb"
|
|
65
|
-
version = "1.2.
|
|
65
|
+
version = "1.2.2"
|
|
66
66
|
source = { registry = "https://pypi.org/simple" }
|
|
67
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
67
|
+
sdist = { url = "https://files.pythonhosted.org/packages/28/b8/0f86278684fb7a1fac7c0c869fc6d68ed005cdc91c963eb4373e0551bc0a/duckdb-1.2.2.tar.gz", hash = "sha256:1e53555dece49201df08645dbfa4510c86440339889667702f936b7d28d39e43", size = 11595514 }
|
|
68
68
|
wheels = [
|
|
69
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
70
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
71
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
72
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
73
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
74
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
75
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
76
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
77
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
78
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
79
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
80
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
81
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
82
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
83
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
84
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
85
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
86
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
87
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
88
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
89
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
90
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
91
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
92
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
93
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
94
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
95
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
96
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
97
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
98
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
99
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
100
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
69
|
+
{ url = "https://files.pythonhosted.org/packages/cc/47/d17eecc8bf23519f4385a7ad361482e5791f6b94995a50839f130c469626/duckdb-1.2.2-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:6e5e6c333b550903ff11919ed1154c60c9b9d935db51afdb263babe523a8a69e", size = 15255351 },
|
|
70
|
+
{ url = "https://files.pythonhosted.org/packages/bd/d1/317397198e0481339c469441762ce4e563f612479c2be70ddba3c1493bf2/duckdb-1.2.2-cp310-cp310-macosx_12_0_universal2.whl", hash = "sha256:c1fcbc579de8e4fa7e34242fd6f419c1a39520073b1fe0c29ed6e60ed5553f38", size = 31925074 },
|
|
71
|
+
{ url = "https://files.pythonhosted.org/packages/3d/e2/9f8cfa9d8a8d1370ae2b5cf0c6a34e6adc51be533771fd75b5ff84fb2441/duckdb-1.2.2-cp310-cp310-macosx_12_0_x86_64.whl", hash = "sha256:690885060c4140922ffa2f6935291c6e74ddad0ca2cf33bff66474ce89312ab3", size = 16779904 },
|
|
72
|
+
{ url = "https://files.pythonhosted.org/packages/e6/47/3651b1ab62b6e8ce15a1ead5d81d4bc76b09912c2ae0b11aa0bbcbd0209d/duckdb-1.2.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8a382782980643f5ee827990b76f079b22f47786509061c0afac28afaa5b8bf5", size = 18726556 },
|
|
73
|
+
{ url = "https://files.pythonhosted.org/packages/6d/66/6b2a433d042a3a5109c1a62a4daaea40b908e7876756aed2837adaf0ca26/duckdb-1.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7c33345570ed8c50c9fe340c2767470115cc02d330f25384104cfad1f6e54f5", size = 20195269 },
|
|
74
|
+
{ url = "https://files.pythonhosted.org/packages/a3/38/1737151fba968c0e7221b68d11c80ed9ff63edf380d91058426b51f1b233/duckdb-1.2.2-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b744f8293ce649d802a9eabbf88e4930d672cf9de7d4fc9af5d14ceaeeec5805", size = 18737528 },
|
|
75
|
+
{ url = "https://files.pythonhosted.org/packages/b3/37/bfde2ea14353a297e7effe9e4688b4e60a3ec08a9bd67c404c64046e5d9e/duckdb-1.2.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c8680e81b0c77be9fc968c1dd4cd38395c34b18bb693cbfc7b7742c18221cc9b", size = 22254571 },
|
|
76
|
+
{ url = "https://files.pythonhosted.org/packages/f0/42/392736bfd62b5b5f0d9ea15b010c90a8c92c21fdfc4372e46160f3d8f680/duckdb-1.2.2-cp310-cp310-win_amd64.whl", hash = "sha256:fb41f2035a70378b3021f724bb08b047ca4aa475850a3744c442570054af3c52", size = 11366201 },
|
|
77
|
+
{ url = "https://files.pythonhosted.org/packages/c1/41/78c63937a4f7a5de7d128203c567303d4813c1109b7d17e6b3959f0882e1/duckdb-1.2.2-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:081110ffbc9d53c9740ef55482c93b97db2f8030d681d1658827d2e94f77da03", size = 15258298 },
|
|
78
|
+
{ url = "https://files.pythonhosted.org/packages/94/b2/91d983ecd67a1b87343e98395ffe7d77c996e1798c1bab339beed4680693/duckdb-1.2.2-cp311-cp311-macosx_12_0_universal2.whl", hash = "sha256:53a154dbc074604036a537784ce5d1468edf263745a4363ca06fdb922f0d0a99", size = 31933969 },
|
|
79
|
+
{ url = "https://files.pythonhosted.org/packages/ad/12/4737b682cbc1b4778ffb37e4f4cdb603676c50aec89d6c9781ec29d3e904/duckdb-1.2.2-cp311-cp311-macosx_12_0_x86_64.whl", hash = "sha256:0353f80882c066f7b14451852395b7a360f3d4846a10555c4268eb49144ea11c", size = 16784775 },
|
|
80
|
+
{ url = "https://files.pythonhosted.org/packages/71/be/dfb52b579a0b82aa92993aecc100bd951d0bd1850c6a8d47c68953a9de62/duckdb-1.2.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b134a5002757af1ae44a9ae26c2fe963ffa09eb47a62779ce0c5eeb44bfc2f28", size = 18731124 },
|
|
81
|
+
{ url = "https://files.pythonhosted.org/packages/ca/49/153dd6289a3d06e87c3199a5547ccc04c574d167d7f85c1a8196218bf040/duckdb-1.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd9c434127fd1575694e1cf19a393bed301f5d6e80b4bcdae80caa368a61a678", size = 20199712 },
|
|
82
|
+
{ url = "https://files.pythonhosted.org/packages/97/ce/f27a7b735a8abb04e2c1efcc05178e25e455539c74d70f76c2845bae8473/duckdb-1.2.2-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:890f58855d127c25bc3a53f4c24b27e79391c4468c4fcc99bc10d87b5d4bd1c4", size = 18739966 },
|
|
83
|
+
{ url = "https://files.pythonhosted.org/packages/d8/f2/a8066267eb5fcd1f535776efde29b6d0fa678d978a7de73f47bc59cc940d/duckdb-1.2.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9a5002305cdd4e76c94b61b50abc5e3f4e32c9cb81116960bb4b74acbbc9c6c8", size = 22255946 },
|
|
84
|
+
{ url = "https://files.pythonhosted.org/packages/df/74/8a05ef00c554882d8300c2c261e8f7e7ead74e2b3ff66059599ff2646cf4/duckdb-1.2.2-cp311-cp311-win_amd64.whl", hash = "sha256:cdb9999c6a109aa31196cdd22fc58a810a3d35d08181a25d1bf963988e89f0a5", size = 11368173 },
|
|
85
|
+
{ url = "https://files.pythonhosted.org/packages/77/25/549f68e55e1b455bd2daf2e5fc912000a3139fe0395111b3d49b23a2cec1/duckdb-1.2.2-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:f745379f44ad302560688855baaed9739c03b37a331338eda6a4ac655e4eb42f", size = 15271882 },
|
|
86
|
+
{ url = "https://files.pythonhosted.org/packages/f6/84/13de7bf9056dcc7a346125d9a9f0f26f76c633db6b54052738f78f828538/duckdb-1.2.2-cp312-cp312-macosx_12_0_universal2.whl", hash = "sha256:087713fc5958cae5eb59097856b3deaae0def021660c8f2052ec83fa8345174a", size = 31964873 },
|
|
87
|
+
{ url = "https://files.pythonhosted.org/packages/0f/53/c8d2d56a801b7843ea87f8533a3634e6b38f06910098a266f8a096bd4c61/duckdb-1.2.2-cp312-cp312-macosx_12_0_x86_64.whl", hash = "sha256:a1f96395319c447a31b9477881bd84b4cb8323d6f86f21ceaef355d22dd90623", size = 16800653 },
|
|
88
|
+
{ url = "https://files.pythonhosted.org/packages/bb/36/e25791d879fb93b92a56bf481ce11949ab19109103ae2ba12d64e49355d9/duckdb-1.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6aba3bc0acf4f8d52b94f7746c3b0007b78b517676d482dc516d63f48f967baf", size = 18735524 },
|
|
89
|
+
{ url = "https://files.pythonhosted.org/packages/d7/46/4745aa10a1e460f4c8b473eddaffe2c783ac5280e1e5929dd84bd1a1acde/duckdb-1.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e5c1556775a9ebaa49b5c8d64718f155ac3e05b34a49e9c99443cf105e8b0371", size = 20210314 },
|
|
90
|
+
{ url = "https://files.pythonhosted.org/packages/ff/0d/8563fc5ece36252e3d07dd3d29c7a0a034dcf62f14bed7cdc016d95adcbe/duckdb-1.2.2-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d625cc7d2faacfb2fc83ebbe001ae75dda175b3d8dce6a51a71c199ffac3627a", size = 18755134 },
|
|
91
|
+
{ url = "https://files.pythonhosted.org/packages/11/f1/b7ade7d980eee4fb3ad7469ccf23adb3668a9a28cf3989b24418392d3786/duckdb-1.2.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:73263f81545c5cb4360fbaf7b22a493e55ddf88fadbe639c43efb7bc8d7554c4", size = 22294397 },
|
|
92
|
+
{ url = "https://files.pythonhosted.org/packages/eb/c9/896e8ced7b408df81e015fe0c6497cda46c92d9dfc8bf84b6d13f5dad473/duckdb-1.2.2-cp312-cp312-win_amd64.whl", hash = "sha256:b1c0c4d737fd2ab9681e4e78b9f361e0a827916a730e84fa91e76dca451b14d5", size = 11370381 },
|
|
93
|
+
{ url = "https://files.pythonhosted.org/packages/41/31/5e2f68cbd000137f6ed52092ad83a8e9c09eca70c59e0b4c5eb679709997/duckdb-1.2.2-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:fb9a2c77236fae079185a990434cb9d8432902488ba990235c702fc2692d2dcd", size = 15272507 },
|
|
94
|
+
{ url = "https://files.pythonhosted.org/packages/d2/15/aa9078fc897e744e077c0c1510e34db4c809de1d51ddb5cb62e1f9c61312/duckdb-1.2.2-cp313-cp313-macosx_12_0_universal2.whl", hash = "sha256:d8bb89e580cb9a3aaf42e4555bf265d3db9446abfb118e32150e1a5dfa4b5b15", size = 31965548 },
|
|
95
|
+
{ url = "https://files.pythonhosted.org/packages/9f/28/943773d44fd97055c59b58dde9182733661c2b6e3b3549f15dc26b2e139e/duckdb-1.2.2-cp313-cp313-macosx_12_0_x86_64.whl", hash = "sha256:88916d7f0532dc926bed84b50408c00dcbe6d2097d0de93c3ff647d8d57b4f83", size = 16800600 },
|
|
96
|
+
{ url = "https://files.pythonhosted.org/packages/39/51/2caf01e7791e490290798c8c155d4d702ed61d69e815915b42e72b3e7473/duckdb-1.2.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:30bece4f58a6c7bb0944a02dd1dc6de435a9daf8668fa31a9fe3a9923b20bd65", size = 18735886 },
|
|
97
|
+
{ url = "https://files.pythonhosted.org/packages/87/0c/48ae1d485725af3a452303af409a9022d751ecab260cb9ca2f8c9fb670bc/duckdb-1.2.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bd2c6373b8b54474724c2119f6939c4568c428e1d0be5bcb1f4e3d7f1b7c8bb", size = 20210481 },
|
|
98
|
+
{ url = "https://files.pythonhosted.org/packages/69/c7/95fcd7bde0f754ea6700208d36b845379cbd2b28779c0eff4dd4a7396369/duckdb-1.2.2-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:72f688a8b0df7030c5a28ca6072817c1f090979e08d28ee5912dee37c26a7d0c", size = 18756619 },
|
|
99
|
+
{ url = "https://files.pythonhosted.org/packages/ad/1b/c9eab9e84d4a70dd5f7e2a93dd6e9d7b4d868d3df755cd58b572d82d6c5d/duckdb-1.2.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:26e9c349f56f7c99341b5c79bbaff5ba12a5414af0261e79bf1a6a2693f152f6", size = 22294667 },
|
|
100
|
+
{ url = "https://files.pythonhosted.org/packages/3f/3d/ce68db53084746a4a62695a4cb064e44ce04123f8582bb3afbf6ee944e16/duckdb-1.2.2-cp313-cp313-win_amd64.whl", hash = "sha256:e1aec7102670e59d83512cf47d32a6c77a79df9df0294c5e4d16b6259851e2e9", size = 11370206 },
|
|
101
101
|
]
|
|
102
102
|
|
|
103
103
|
[[package]]
|
|
@@ -185,7 +185,7 @@ wheels = [
|
|
|
185
185
|
|
|
186
186
|
[[package]]
|
|
187
187
|
name = "mcp-server-motherduck"
|
|
188
|
-
version = "0.
|
|
188
|
+
version = "0.4.2"
|
|
189
189
|
source = { editable = "." }
|
|
190
190
|
dependencies = [
|
|
191
191
|
{ name = "duckdb" },
|
|
@@ -196,7 +196,7 @@ dependencies = [
|
|
|
196
196
|
|
|
197
197
|
[package.metadata]
|
|
198
198
|
requires-dist = [
|
|
199
|
-
{ name = "duckdb", specifier = "
|
|
199
|
+
{ name = "duckdb", specifier = "==1.2.2" },
|
|
200
200
|
{ name = "mcp", specifier = ">=1.3.0" },
|
|
201
201
|
{ name = "pandas", specifier = ">=2.0.0" },
|
|
202
202
|
{ name = "tabulate", specifier = ">=0.9.0" },
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: mcp-server-motherduck
|
|
3
|
-
Version: 0.4.0
|
|
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: duckdb>=1.2.1
|
|
9
|
-
Requires-Dist: mcp>=1.3.0
|
|
10
|
-
Requires-Dist: pandas>=2.0.0
|
|
11
|
-
Requires-Dist: tabulate>=0.9.0
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
|
|
14
|
-
# MotherDuck MCP Server
|
|
15
|
-
|
|
16
|
-
An MCP server implementation that integrates MotherDuck and local DuckDB, providing SQL analytics capabilities to Claude.
|
|
17
|
-
|
|
18
|
-
## Features
|
|
19
|
-
|
|
20
|
-
- **Hybrid execution**: query data from both cloud-based MotherDuck and local DuckDB
|
|
21
|
-
- **Cloud storage integration**: access data stored in Amazon S3 or other cloud storage thanks to MotherDuck's integrations
|
|
22
|
-
- **Data sharing**: create and share databases
|
|
23
|
-
- **SQL analytics**: use DuckDB's SQL dialect to query any size of data directly from Claude
|
|
24
|
-
- **Serverless architecture**: run analytics without needing to configure instances or clusters
|
|
25
|
-
|
|
26
|
-
## Components
|
|
27
|
-
|
|
28
|
-
### Prompts
|
|
29
|
-
|
|
30
|
-
The server provides one prompt:
|
|
31
|
-
|
|
32
|
-
- `duckdb-motherduck-initial-prompt`: A prompt to initialize a connection to DuckDB or MotherDuck and start working with it
|
|
33
|
-
|
|
34
|
-
### Tools
|
|
35
|
-
|
|
36
|
-
The server offers one tool:
|
|
37
|
-
|
|
38
|
-
- `query`: Execute a SQL query on the MotherDuck/DuckDB database
|
|
39
|
-
- **Inputs**:
|
|
40
|
-
- `query` (string, required): The SQL query to execute
|
|
41
|
-
|
|
42
|
-
All interactions with both DuckDB and MotherDuck are done through writing SQL queries.
|
|
43
|
-
|
|
44
|
-
## Getting Started
|
|
45
|
-
|
|
46
|
-
### Prerequisites
|
|
47
|
-
|
|
48
|
-
- A MotherDuck account (sign up at [motherduck.com](https://motherduck.com))
|
|
49
|
-
- A MotherDuck access token
|
|
50
|
-
- `uvx` installed, you can install it using `pip install uvx` or `brew install uvx`
|
|
51
|
-
|
|
52
|
-
If you plan to use MotherDuck MCP with Claude Desktop, you will also need Claude Desktop installed.
|
|
53
|
-
|
|
54
|
-
### Setting up your MotherDuck token
|
|
55
|
-
|
|
56
|
-
1. Sign up for a [MotherDuck account](https://app.motherduck.com/?auth_flow=signup)
|
|
57
|
-
2. Generate an access token via the [MotherDuck UI](https://app.motherduck.com/settings/tokens?auth_flow=signup)
|
|
58
|
-
3. Store the token securely for use in the configuration
|
|
59
|
-
|
|
60
|
-
### Usage with Claude Desktop
|
|
61
|
-
|
|
62
|
-
1. Install Claude Desktop from [claude.ai/download](https://claude.ai/download) if you haven't already
|
|
63
|
-
|
|
64
|
-
2. Open the Claude Desktop configuration file:
|
|
65
|
-
|
|
66
|
-
- 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.
|
|
67
|
-
- Add the following configuration to your `claude_desktop_config.json`:
|
|
68
|
-
|
|
69
|
-
```json
|
|
70
|
-
"mcpServers": {
|
|
71
|
-
"mcp-server-motherduck": {
|
|
72
|
-
"command": "uvx",
|
|
73
|
-
"args": [
|
|
74
|
-
"mcp-server-motherduck",
|
|
75
|
-
"--db-path",
|
|
76
|
-
"md:",
|
|
77
|
-
"--motherduck-token",
|
|
78
|
-
"<YOUR_MOTHERDUCK_TOKEN_HERE>",
|
|
79
|
-
],
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
**Important Notes**:
|
|
85
|
-
|
|
86
|
-
- Replace `YOUR_MOTHERDUCK_TOKEN_HERE` with your actual MotherDuck token
|
|
87
|
-
- Replace `YOUR_HOME_FOLDER_PATH` with the path to your home directory (needed by DuckDB for file operations). For example, on macOS, it would be `/Users/your_username`
|
|
88
|
-
- The `HOME` environment variable is required for DuckDB to function properly.
|
|
89
|
-
|
|
90
|
-
## Example Queries
|
|
91
|
-
|
|
92
|
-
Once configured, you can ask Claude to run queries like:
|
|
93
|
-
|
|
94
|
-
- "Create a new database and table in MotherDuck"
|
|
95
|
-
- "Query data from my local CSV file"
|
|
96
|
-
- "Join data from my local DuckDB database with a table in MotherDuck"
|
|
97
|
-
- "Analyze data stored in Amazon S3"
|
|
98
|
-
|
|
99
|
-
## Testing
|
|
100
|
-
|
|
101
|
-
The server is designed to be run by tools like Claude Desktop and Cursor, but you can start it manually for testing purposes. When testing the server manually, you can specify which database to connect to using the `--db-path` parameter:
|
|
102
|
-
|
|
103
|
-
1. **Default MotherDuck database**:
|
|
104
|
-
|
|
105
|
-
- To connect to the default MotherDuck database, you will need to pass the auth token using the `--motherduck-token` parameter.
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
2. **Specific MotherDuck database**:
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
uvx mcp-server-motherduck --db-path md:your_database_name --motherduck-token <your_motherduck_token>
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
3. **Local DuckDB database**:
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
uvx mcp-server-motherduck --db-path /path/to/your/local.db
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
4. **In-memory database**:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
uvx mcp-server-motherduck --db-path :memory:
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
If you don't specify a database path but have set the `motherduck_token` environment variable, the server will automatically connect to the default MotherDuck database (`md:`).
|
|
130
|
-
|
|
131
|
-
## Running in SSE mode
|
|
132
|
-
|
|
133
|
-
The server could also be run ing SSE mode using `supergateway` by running the following command:
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
npx -y supergateway --stdio "uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>"
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
And you can point your clients such as Claude Desktop, Cursor to this endpoint.
|
|
140
|
-
|
|
141
|
-
## Troubleshooting
|
|
142
|
-
|
|
143
|
-
- If you encounter connection issues, verify your MotherDuck token is correct
|
|
144
|
-
- For local file access problems, ensure the `--home-dir` parameter is set correctly
|
|
145
|
-
- Check that the `uvx` command is available in your PATH
|
|
146
|
-
- In version previous for v0.4.0 we used environment variables, now we use parameters
|
|
147
|
-
|
|
148
|
-
## License
|
|
149
|
-
|
|
150
|
-
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.
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# MotherDuck MCP Server
|
|
2
|
-
|
|
3
|
-
An MCP server implementation that integrates MotherDuck and local DuckDB, providing SQL analytics capabilities to Claude.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Hybrid execution**: query data from both cloud-based MotherDuck and local DuckDB
|
|
8
|
-
- **Cloud storage integration**: access data stored in Amazon S3 or other cloud storage thanks to MotherDuck's integrations
|
|
9
|
-
- **Data sharing**: create and share databases
|
|
10
|
-
- **SQL analytics**: use DuckDB's SQL dialect to query any size of data directly from Claude
|
|
11
|
-
- **Serverless architecture**: run analytics without needing to configure instances or clusters
|
|
12
|
-
|
|
13
|
-
## Components
|
|
14
|
-
|
|
15
|
-
### Prompts
|
|
16
|
-
|
|
17
|
-
The server provides one prompt:
|
|
18
|
-
|
|
19
|
-
- `duckdb-motherduck-initial-prompt`: A prompt to initialize a connection to DuckDB or MotherDuck and start working with it
|
|
20
|
-
|
|
21
|
-
### Tools
|
|
22
|
-
|
|
23
|
-
The server offers one tool:
|
|
24
|
-
|
|
25
|
-
- `query`: Execute a SQL query on the MotherDuck/DuckDB database
|
|
26
|
-
- **Inputs**:
|
|
27
|
-
- `query` (string, required): The SQL query to execute
|
|
28
|
-
|
|
29
|
-
All interactions with both DuckDB and MotherDuck are done through writing SQL queries.
|
|
30
|
-
|
|
31
|
-
## Getting Started
|
|
32
|
-
|
|
33
|
-
### Prerequisites
|
|
34
|
-
|
|
35
|
-
- A MotherDuck account (sign up at [motherduck.com](https://motherduck.com))
|
|
36
|
-
- A MotherDuck access token
|
|
37
|
-
- `uvx` installed, you can install it using `pip install uvx` or `brew install uvx`
|
|
38
|
-
|
|
39
|
-
If you plan to use MotherDuck MCP with Claude Desktop, you will also need Claude Desktop installed.
|
|
40
|
-
|
|
41
|
-
### Setting up your MotherDuck token
|
|
42
|
-
|
|
43
|
-
1. Sign up for a [MotherDuck account](https://app.motherduck.com/?auth_flow=signup)
|
|
44
|
-
2. Generate an access token via the [MotherDuck UI](https://app.motherduck.com/settings/tokens?auth_flow=signup)
|
|
45
|
-
3. Store the token securely for use in the configuration
|
|
46
|
-
|
|
47
|
-
### Usage with Claude Desktop
|
|
48
|
-
|
|
49
|
-
1. Install Claude Desktop from [claude.ai/download](https://claude.ai/download) if you haven't already
|
|
50
|
-
|
|
51
|
-
2. Open the Claude Desktop configuration file:
|
|
52
|
-
|
|
53
|
-
- 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.
|
|
54
|
-
- Add the following configuration to your `claude_desktop_config.json`:
|
|
55
|
-
|
|
56
|
-
```json
|
|
57
|
-
"mcpServers": {
|
|
58
|
-
"mcp-server-motherduck": {
|
|
59
|
-
"command": "uvx",
|
|
60
|
-
"args": [
|
|
61
|
-
"mcp-server-motherduck",
|
|
62
|
-
"--db-path",
|
|
63
|
-
"md:",
|
|
64
|
-
"--motherduck-token",
|
|
65
|
-
"<YOUR_MOTHERDUCK_TOKEN_HERE>",
|
|
66
|
-
],
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**Important Notes**:
|
|
72
|
-
|
|
73
|
-
- Replace `YOUR_MOTHERDUCK_TOKEN_HERE` with your actual MotherDuck token
|
|
74
|
-
- Replace `YOUR_HOME_FOLDER_PATH` with the path to your home directory (needed by DuckDB for file operations). For example, on macOS, it would be `/Users/your_username`
|
|
75
|
-
- The `HOME` environment variable is required for DuckDB to function properly.
|
|
76
|
-
|
|
77
|
-
## Example Queries
|
|
78
|
-
|
|
79
|
-
Once configured, you can ask Claude to run queries like:
|
|
80
|
-
|
|
81
|
-
- "Create a new database and table in MotherDuck"
|
|
82
|
-
- "Query data from my local CSV file"
|
|
83
|
-
- "Join data from my local DuckDB database with a table in MotherDuck"
|
|
84
|
-
- "Analyze data stored in Amazon S3"
|
|
85
|
-
|
|
86
|
-
## Testing
|
|
87
|
-
|
|
88
|
-
The server is designed to be run by tools like Claude Desktop and Cursor, but you can start it manually for testing purposes. When testing the server manually, you can specify which database to connect to using the `--db-path` parameter:
|
|
89
|
-
|
|
90
|
-
1. **Default MotherDuck database**:
|
|
91
|
-
|
|
92
|
-
- To connect to the default MotherDuck database, you will need to pass the auth token using the `--motherduck-token` parameter.
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
2. **Specific MotherDuck database**:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
uvx mcp-server-motherduck --db-path md:your_database_name --motherduck-token <your_motherduck_token>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
3. **Local DuckDB database**:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
uvx mcp-server-motherduck --db-path /path/to/your/local.db
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
4. **In-memory database**:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
uvx mcp-server-motherduck --db-path :memory:
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
If you don't specify a database path but have set the `motherduck_token` environment variable, the server will automatically connect to the default MotherDuck database (`md:`).
|
|
117
|
-
|
|
118
|
-
## Running in SSE mode
|
|
119
|
-
|
|
120
|
-
The server could also be run ing SSE mode using `supergateway` by running the following command:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
npx -y supergateway --stdio "uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>"
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
And you can point your clients such as Claude Desktop, Cursor to this endpoint.
|
|
127
|
-
|
|
128
|
-
## Troubleshooting
|
|
129
|
-
|
|
130
|
-
- If you encounter connection issues, verify your MotherDuck token is correct
|
|
131
|
-
- For local file access problems, ensure the `--home-dir` parameter is set correctly
|
|
132
|
-
- Check that the `uvx` command is available in your PATH
|
|
133
|
-
- In version previous for v0.4.0 we used environment variables, now we use parameters
|
|
134
|
-
|
|
135
|
-
## License
|
|
136
|
-
|
|
137
|
-
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.
|
{mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/.github/workflows/python-publish.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mcp_server_motherduck-0.4.0 → mcp_server_motherduck-0.4.2}/src/mcp_server_motherduck/prompt.py
RENAMED
|
File without changes
|