DuckDB / MotherDuck Local MCP Server
Lets your AI agent run SQL on DuckDB files, in-memory data, S3 databases and MotherDuck, and browse tables.
538 stars on GitHubby MotherDuckLicense MITUpdated 24 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add motherduck -- uvx mcp-server-motherduck --transport stdio --port 8000 --host 127.0.0.1 --db-path :memory: --max-rows 1024 --max-chars 50000 --query-timeout -1
What to fill in
| Name | What it is | Required |
|---|---|---|
motherduck_token | Access token for MotherDuck connections (alternative to --motherduck-token) | No |
MOTHERDUCK_TOKEN | Access token for MotherDuck connections (alternative to --motherduck-token) | No |
HOME | Used by DuckDB for extensions and config. Override with --home-dir if not set. | No |
AWS_ACCESS_KEY_ID | AWS access key for S3 database connections | No |
AWS_SECRET_ACCESS_KEY | AWS secret access key for S3 database connections | No |
AWS_SESSION_TOKEN | AWS session token for temporary credentials | No |
AWS_DEFAULT_REGION | AWS region for S3 database connections | No |
AWS_ENDPOINT | AWS endpoint for S3 database connections | No |
Ready! Now test it
Restart the app and paste one of these requests in the chat:
List all tables in my DuckDB file and show the columns of the biggest one
Run a query that counts orders by month
What it is
This server connects your AI agent to DuckDB, an analytics SQL engine, and to MotherDuck, its cloud service. The agent can run read or write queries, list databases, tables and columns, and switch between connections. It runs on your own computer, so it can also work with local files.
What it can do
execute_query: run SQL in the DuckDB dialectlist_databases: list attached databaseslist_tables: list tables and viewslist_columns: list columns of a table or viewswitch_database_connection: change database (needs--allow-switch-databases)
When to use
- βΊWhen you want to analyse a local DuckDB file by asking questions in plain words
- βΊWhen you need to query a MotherDuck or S3-hosted database from your AI agent
- βΊWhen you want a scratch in-memory database to try out SQL and data work
What you need
uv tool (for uvx). A MotherDuck token only if you connect to MotherDuck, and AWS keys only for S3 databases.Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
dlt-connectorHelps your agent load data from SaaS tools such as HubSpot or Stripe into a local DuckDB file, ready for Wren SQL analysis.sql-proHelps your agent write faster SQL queries, design database tables and find out why a database query is slow.digoalLets your agent answer PostgreSQL, PolarDB and DuckDB questions using a local copy of the digoal blog as reference, with a practical, scenario-first style.Frequently asked questions
Is it free and open source?
The server is a public project from MotherDuck. MotherDuck itself is a service that needs an account and a token; local DuckDB needs neither.
Is it read-only by default?
Yes. Write access needs the --read-write flag.
Is read-only mode enough to protect my data?
Not for third-party access. The readme says it still allows local filesystem access and settings changes, and recommends MotherDuck Remote MCP for production.
How many rows come back?
By default 1024 rows and 50,000 characters, which you can change with --max-rows and --max-chars.
Is there a hosted version?
Yes. MotherDuck offers a separate remote MCP server with no local setup.
Can I use Docker?
Yes. The readme shows a Docker build that serves the MCP endpoint over HTTP on port 8000.
If it does not work
- βΊIf you see
spawn uvx ENOENT, give the full path touvx(find it withwhich uvx) - βΊIf the file is locked, keep
--ephemeral-connectionson (the default) and do not connect in read-write mode - βΊFor MotherDuck, check that the
motherduck_tokenenvironment variable is set
5 new skills a week. 1 minute to read.