MotherDuck MCP Server
Published · Updated
At a glance
- Category
- Data & analytics
- GitHub repository
- motherduckdb/mcp-server-motherduck
- Watch out for
- Read-only mode does not stop DuckDB from reading other local files or changing settings; do not expose it to untrusted users.
Despite the name, this server is as much for DuckDB as for MotherDuck. It runs locally, is published as mcp-server-motherduck, and can connect to an in-memory DuckDB, a local .duckdb file, a database on S3, or MotherDuck's cloud service. The agent gets a small set of tools: run SQL, and browse databases, tables and columns.
That simplicity is what makes it good for data work. DuckDB reads CSV, Parquet and JSON files directly with SQL, so an in-memory session becomes a quick way to have an assistant explore a folder of exports: ask it what is in a Parquet file, have it join two CSVs, or summarise a log dump. With --allow-switch-databases it can attach and switch between databases during a session.
Read-only is the default when you point it at a file, and the README shows read-only and read-write setups side by side. One practical detail: a read-only connection does not hold DuckDB's file lock, so you can use it alongside an application that is writing to the same file. The README is also frank about security. For third-party access, read-only mode alone is not enough, because DuckDB SQL can still read local files and change settings. MotherDuck recommends its hosted Remote MCP for that case.
How it connects
Your AI app
An assistant or agent that supports MCP
MotherDuck MCP Server
Runs as
- Python (uv / pip)
- Docker
Gives the agent
- execute_query
- Catalog browsing
- Several targets
- Read-only by default for files
- Startup SQL
MotherDuck
Signs in with
- Token
What it can do
- execute_query
- Runs SQL in the DuckDB dialect, which includes reading CSV, Parquet and JSON files directly by path.
- Catalog browsing
- list_databases, list_tables and list_columns let the model see what exists before it writes a query.
- Several targets
- --db-path accepts :memory:, a local file, an S3 path or md: for MotherDuck, using a motherduck_token for authentication.
- Read-only by default for files
- File connections are read-only unless you pass --read-write, and read-only connections do not keep the file locked.
- Startup SQL
- --init-sql runs statements at startup, which is where you apply DuckDB security settings for a self-hosted deployment.
Setting it up
Install uv first. For a scratch in-memory session in Claude Code: claude mcp add --scope user duckdb --transport stdio -- uvx mcp-server-motherduck --db-path :memory: --read-write --allow-switch-databases. To query one file safely: uvx mcp-server-motherduck --db-path /absolute/path/to/your.duckdb, which opens it read-only. For MotherDuck, use --db-path md: and pass motherduck_token in the environment, adding --read-write only if the agent should change data. Codex uses the same arguments with codex mcp add. A Docker image is also documented.
claude mcp add motherduck -- uvx mcp-server-motherduckRuns the mcp-server-motherduck package from PyPI. Add any API keys, environment variables or extra arguments the setup notes above list. Combine several servers in the MCP config generator
Where each client keeps its MCP config file, and the JSON it expects (cheat sheet)
Where it helps
- Exploring a folder of CSV or Parquet exports with SQL, without loading them into a database first
- Answering ad hoc analytics questions against a local DuckDB file used by an application
- Querying shared MotherDuck databases from an AI assistant
- Drafting and testing transformation SQL before moving it into a pipeline
Limitations and things to watch
- Read-only mode does not stop DuckDB from reading other local files or changing settings; do not expose it to untrusted users.
- In-memory sessions lose everything when the server stops.
- Large query results land in the model's context; ask for aggregates or LIMIT clauses.
- For hosted, multi-user access MotherDuck points to its Remote MCP rather than this server.
Sources
Written from the project's own documentation, checked November 2026.
- github.com /motherduckdb/mcp-server-motherduck
- motherduck.com /docs/sql-reference/mcp
- pypi.org /project/mcp-server-motherduck
How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.