Motherduck
FreeNot checkedEnables executing SQL queries on DuckDB databases locally or on MotherDuck cloud, with support for multiple databases, read-only mode, and Claude Desktop integr
About
Enables executing SQL queries on DuckDB databases locally or on MotherDuck cloud, with support for multiple databases, read-only mode, and Claude Desktop integration.
README
MotherDuck MCP Server - Detailed Installation Guide This guide explains the step-by-step manual installation of the MotherDuck MCP Server on Windows.
📋 Table of Contents Requirements
Manual Installation
Configuration Options
Claude Desktop Integration
Usage Examples
Troubleshooting
🔧 Requirements System Requirements Operating System: Windows 10/11 (Linux and macOS also supported)
Python: Version 3.10 or higher (tested with 3.12.7)
Git: To clone the repository
Claude Desktop: Used as the MCP client
Python Packages duckdb==1.3.0
mcp>=1.9.4
python-dotenv
Other dependencies will be installed automatically
🚀 Manual Installation Step 1: Clone the Repository bash Copy Edit
Create the project directory
mkdir D:\AOT cd D:\AOT
Clone the repository
git clone https://github.com/motherduckdb/mcp-server-motherduck.git
Enter the project directory
cd mcp-server-motherduck Step 2: Create Python Virtual Environment bash Copy Edit
Create virtual environment
python -m venv venv
Activate (choose depending on your terminal):
For PowerShell:
.\venv\Scripts\Activate.ps1
For Command Prompt:
venv\Scripts\activate.bat
For Git Bash:
source venv/Scripts/activate Note: If you get an execution policy error in PowerShell:
powershell Copy Edit Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Step 3: Install Dependencies bash Copy Edit
Upgrade pip
python -m pip install --upgrade pip
Install the project and dependencies
pip install -e .
If python-dotenv is missing, install manually
pip install python-dotenv Step 4: Test the Installation bash Copy Edit
View help menu
mcp-server-motherduck --help
Test with an in-memory database
mcp-server-motherduck --db-path :memory: Expected output:
pgsql
Copy
Edit
[motherduck] INFO - 🦆 MotherDuck MCP Server v0.6.0
[motherduck] INFO - Ready to execute SQL queries via DuckDB/MotherDuck
[motherduck] INFO - Database client initialized in duckdb mode
[motherduck] INFO - ✅ Successfully connected to duckdb database
Use Ctrl+C to stop the test.
⚙️ Configuration Options
- In-Memory Database (Recommended for testing) json Copy Edit { "mcpServers": { "motherduck-local": { "command": "D:\AOT\mcp-server-motherduck\venv\Scripts\mcp-server-motherduck.exe", "args": [ "--db-path", ":memory:" ] } } }
- Local DuckDB File json Copy Edit { "mcpServers": { "motherduck-local": { "command": "D:\AOT\mcp-server-motherduck\venv\Scripts\mcp-server-motherduck.exe", "args": [ "--db-path", "D:\mydata\database.db" ] } } }
- MotherDuck Cloud First, create an account on MotherDuck and obtain your token.
json Copy Edit { "mcpServers": { "motherduck-cloud": { "command": "D:\AOT\mcp-server-motherduck\venv\Scripts\mcp-server-motherduck.exe", "args": [ "--db-path", "md:", "--motherduck-token", "YOUR_MOTHERDUCK_TOKEN_HERE" ] } } } 4. Read-Only Mode (for security) json Copy Edit { "mcpServers": { "motherduck-readonly": { "command": "D:\AOT\mcp-server-motherduck\venv\Scripts\mcp-server-motherduck.exe", "args": [ "--db-path", "database.db", "--read-only" ] } } } 🔌 Claude Desktop Integration Locate the Config File Windows: %APPDATA%\Claude\claude_desktop_config.json
Alternative: Claude Desktop → Settings → Developer → Edit Config
Integration Steps Exit Claude Desktop
Add one of the configurations above into the config file
Save the file
Restart Claude Desktop
Open a new chat and see your server in the MCP menu
Multiple Server Configuration json Copy Edit { "mcpServers": { "motherduck-local": { "command": "D:\AOT\mcp-server-motherduck\venv\Scripts\mcp-server-motherduck.exe", "args": ["--db-path", ":memory:"] }, "motherduck-cloud": { "command": "D:\AOT\mcp-server-motherduck\venv\Scripts\mcp-server-motherduck.exe", "args": [ "--db-path", "md:", "--motherduck-token", "YOUR_TOKEN" ] }, "motherduck-filedb": { "command": "D:\AOT\mcp-server-motherduck\venv\Scripts\mcp-server-motherduck.exe", "args": ["--db-path", "D:\databases\mydata.db"] } } } 💡 Usage Examples Basic SQL Operations sql Copy Edit -- Create table CREATE TABLE users ( id INTEGER PRIMARY KEY, name VARCHAR(100), email VARCHAR(100), signup_date DATE );
-- Insert data INSERT INTO users VALUES (1, 'Ahmet Yılmaz', '[email protected]', '2024-01-15'), (2, 'Ayşe Demir', '[email protected]', '2024-02-20');
-- Query data SELECT * FROM users WHERE signup_date > '2024-01-01';
-- Aggregation SELECT COUNT(*) as total_users, DATE_TRUNC('month', signup_date) as month FROM users GROUP BY month; Load CSV File sql Copy Edit -- Load from CSV COPY sales FROM 'D:\data\sales.csv' (AUTO_DETECT TRUE);
-- Read Parquet file SELECT * FROM read_parquet('D:\data\big_data.parquet');
-- Read from S3 (MotherDuck Cloud) SELECT * FROM 's3://bucket-name/data/*.parquet'; Advanced Features sql Copy Edit -- Window functions SELECT name, sale_amount, ROW_NUMBER() OVER (ORDER BY sale_amount DESC) as rank FROM sales;
-- Using CTE WITH monthly_summary AS ( SELECT DATE_TRUNC('month', date) as month, SUM(amount) as total FROM sales GROUP BY 1 ) SELECT * FROM monthly_summary WHERE total > 10000; 🔍 Troubleshooting Problem: "No module named 'dotenv'" Solution:
bash Copy Edit pip uninstall python-dotenv -y pip install --force-reinstall python-dotenv Problem: "mcp-server-motherduck: command not found" Solution:
bash Copy Edit
Ensure venv is active
which python # Should point to venv directory
Alternative execution
python -m mcp_server_motherduck --db-path :memory: Problem: "Server Disconnected" in Claude Desktop Fixes:
Check for JSON syntax errors in the config file
Use double backslashes (\) in file paths
Ensure the venv path is correct
Restart Claude Desktop completely
Check logs under Developer → MCP Logs
Problem: PowerShell Execution Policy Solution:
powershell Copy Edit
Allow for current user
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Or temporary bypass
powershell -ExecutionPolicy Bypass -File ".\venv\Scripts\Activate.ps1" Problem: Invalid MotherDuck Token Fixes:
Make sure your token is valid
Enclose token in quotes
Generate a new token from MotherDuck Dashboard
📚 Additional Resources DuckDB Documentation
MotherDuck Documentation
MCP Protocol Specification
Project GitHub Page
🤝 Contributing Fork the project
Create a feature branch (git checkout -b feature/new-feature)
Commit your changes (git commit -am 'Added new feature')
Push the branch (git push origin feature/new-feature)
Open a Pull Request
📄 License This project is licensed under the MIT License. See the LICENSE file for details.
Install Motherduck in Claude Desktop, Claude Code & Cursor
unyly install motherduck-mcpInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add motherduck-mcp -- uvx mcp-server-motherduckFAQ
Is Motherduck MCP free?
Yes, Motherduck MCP is free — one-click install via Unyly at no cost.
Does Motherduck need an API key?
No, Motherduck runs without API keys or environment variables.
Is Motherduck hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Motherduck in Claude Desktop, Claude Code or Cursor?
Open Motherduck on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
wenb1n-dev/SmartDB_MCP
A universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
by wenb1n-devPostgres Server
This server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
by madhurprashPostgres
Query your database in natural language
by AnthropicPostgreSQL
Read-only database access with schema inspection.
by modelcontextprotocolCompare Motherduck with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All data MCPs
