MotherDuck Connector Protocol Server

1.0.4 · active · verified Thu Apr 16

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.

Common errors

Warnings

Install

Imports

Quickstart

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.

import os

# Set environment variables for MotherDuck (or DUCKDB_PATH for local DuckDB)
# For local DuckDB: os.environ['DUCKDB_PATH'] = '/path/to/my_local.duckdb'
# For MotherDuck: os.environ['MD_TOKEN'] = os.environ.get('MD_TOKEN', 'YOUR_MOTHERDUCK_TOKEN')

print("To run the MCP server:")
print("1. Ensure mcp-server-motherduck and uvicorn are installed: pip install mcp-server-motherduck uvicorn[standard]")
print("2. Run the server from your terminal:")
print("   uvicorn mcp_server_motherduck.main:app --host 0.0.0.0 --port 8000")
print("\nOnce running, you can connect using the DuckDB CLI:")
print("   duckdb 'md:http://localhost:8000/'")
print("   -- or if using a local DuckDB file --")
print("   duckdb 'md:http://localhost:8000/?duckdb_path=/path/to/my_local.duckdb'")

view raw JSON →