This is a sample implementation of the MotherDuck Connector Protocol (MCP) server that allows DuckDB clients to connect to MotherDuck or local DuckDB instances via a lightweight HTTP server. It's built on FastAPI. The current version is 1.0.4, and its release cadence is tied to updates in the MCP specification or the underlying DuckDB/MotherDuck APIs, serving primarily as a reference and bridge.
pip install mcp-server-motherduckVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to run the MCP server using `uvicorn` and how to connect to it using the DuckDB CLI. You must have `uvicorn[standard]` installed alongside `mcp-server-motherduck`. Remember to configure MotherDuck via `MD_TOKEN` or a local DuckDB path via `DUCKDB_PATH` environment variables.
Set `MD_TOKEN='your_token'` or `DUCKDB_PATH='/path/to/your/db.duckdb'` in your environment before starting the server, or pass them explicitly if embedding.
Understand that the main interaction is running the `uvicorn` command, not importing and calling functions directly for typical data operations. For direct Python interaction with DuckDB/MotherDuck, use the `duckdb` or `motherduckdb` libraries.
Specify a different port when running `uvicorn`, e.g., `uvicorn mcp_server_motherduck.main:app --host 0.0.0.0 --port 8001`.
Review the source code and consider implementing robust error handling, authentication, and scaling strategies if deploying in a critical production environment.