The MotherDuck's DuckDB MCP Server is an implementation that enables AI assistants and IDEs to interact with DuckDB and MotherDuck databases for SQL analytics. It allows you to query local or cloud-based databases, access data in cloud storage, and perform SQL analytics without complex infrastructure setup.
uv
package manager installed via pip install uv
or brew install uv
mcp.json
file:{
"mcpServers": {
"mcp-server-motherduck": {
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
"md:",
"--motherduck-token",
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
]
}
}
}
Add to your VS Code User Settings (JSON):
{
"mcp": {
"inputs": [
{
"type": "promptString",
"id": "motherduck_token",
"description": "MotherDuck Token",
"password": true
}
],
"servers": {
"motherduck": {
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
"md:",
"--motherduck-token",
"${input:motherduck_token}"
]
}
}
}
}
Alternatively, create a .vscode/mcp.json
file in your workspace with:
{
"inputs": [
{
"type": "promptString",
"id": "motherduck_token",
"description": "MotherDuck Token",
"password": true
}
],
"servers": {
"motherduck": {
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
"md:",
"--motherduck-token",
"${input:motherduck_token}"
]
}
}
}
{
"mcpServers": {
"mcp-server-motherduck": {
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
"md:",
"--motherduck-token",
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
]
}
}
}
claude mcp add mcp-server-motherduck uvx mcp-server-motherduck -- --db-path md: --motherduck-token <YOUR_MOTHERDUCK_TOKEN_HERE>
claude mcp add-json mcp-server-motherduck '{
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
"md:",
"--motherduck-token",
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
]
}'
Scoping Options:
--local
(default) for project-specific configuration--project
to share with your team via .mcp.json
--user
to make available across all projectsParameter | Type | Default | Description |
---|---|---|---|
--transport |
Choice | stdio |
Transport type: stdio , sse , or stream |
--port |
Integer | 8000 |
Port for sse/stream transport modes |
--db-path |
String | md: |
Path to DuckDB file or MotherDuck database |
--motherduck-token |
String | None |
MotherDuck access token |
--read-only |
Flag | False |
Connect in read-only mode |
--home-dir |
String | None |
Home directory for DuckDB |
--saas-mode |
Flag | False |
Connect in SaaS mode (restricted permissions) |
--json-response |
Flag | False |
Enable JSON responses for HTTP stream |
# Connect to local DuckDB file in read-only mode
uvx mcp-server-motherduck --transport stream --db-path /path/to/local.db --read-only
# Connect to MotherDuck with token
uvx mcp-server-motherduck --transport stream --db-path md: --motherduck-token YOUR_TOKEN
# Connect to MotherDuck in SaaS mode for enhanced security
uvx mcp-server-motherduck --transport stream --db-path md: --motherduck-token YOUR_TOKEN --saas-mode
For in-memory database:
{
"mcpServers": {
"mcp-server-motherduck": {
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
":memory:"
]
}
}
}
For local DuckDB file:
{
"mcpServers": {
"mcp-server-motherduck": {
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
"/path/to/your/local.db"
]
}
}
}
For local DuckDB file in read-only mode:
{
"mcpServers": {
"mcp-server-motherduck": {
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
"/path/to/your/local.db",
"--read-only"
]
}
}
}
For secure public deployment, use a read scaling token and SaaS mode:
{
"mcpServers": {
"mcp-server-motherduck": {
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
"md:",
"--motherduck-token",
"<YOUR_READ_SCALING_TOKEN_HERE>",
"--saas-mode"
]
}
}
}
uvx mcp-server-motherduck --transport sse --port 8000 --db-path md: --motherduck-token <your_motherduck_token>
npx -y supergateway --stdio "uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>"
--home-dir
is set correctly for local file access problemsuvx
is in your PATHspawn uvx ENOENT
errors, try using the full path to uvx
(output of which uvx
)To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mcp-server-motherduck" '{"command":"uvx","args":["mcp-server-motherduck","--db-path","md:","--motherduck-token","<YOUR_MOTHERDUCK_TOKEN_HERE>"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mcp-server-motherduck": {
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
"md:",
"--motherduck-token",
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mcp-server-motherduck": {
"command": "uvx",
"args": [
"mcp-server-motherduck",
"--db-path",
"md:",
"--motherduck-token",
"<YOUR_MOTHERDUCK_TOKEN_HERE>"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect