mcp-server-motherduck

by @motherduckdb

Motherduck MCP Server

Run analytical SQL across local DuckDB files, in-memory databases, S3-hosted datasets, and MotherDuck workspaces from Claude, Cursor, VS Code, Codex, or Gemini CLI. Built in Python and run via `uvx` over `stdio` or Docker Streamable HTTP, it handles catalog browsing and live connection switching.

Databases545pythonMIT

Server facts

mcp-server-motherduck

GitHub stars

545

Last commit

Nov 14, 2026

Runtime

python

License

MIT

Tech

Runtime
python
Transports
stdiostreamable-http
Remote access
No
Authentication
Optional MotherDuck token (motherduck_token) for md:; AWS env vars for S3

Activity

GitHub stars
545
Last commit
Data as of

Tags

  • ai
  • duckdb
  • motherduck

Overview

Data engineers and analysts searching for a local `motherduck mcp` setup can connect AI assistants directly to DuckDB's analytical engine without migrating files to a hosted warehouse. Maintained by `motherduckdb` under the MIT license, this Python server launches through `uvx mcp-server-motherduck` over `stdio` or inside Docker over Streamable HTTP on port 8000 (`/mcp`). It targets in-memory DuckDB (`:memory:`), local `.duckdb` files, `s3://` buckets authenticated with standard AWS environment variables, and MotherDuck cloud instances (`md:`) using a `motherduck_token` or `MOTHERDUCK_TOKEN` credential. Official client instructions cover Claude Desktop (including an `.mcpb` bundle), Claude Code, Codex CLI, Gemini CLI, Cursor, VS Code, and Kiro.

Out of the box, the server exposes catalog and SQL tools—`execute_query`, `list_databases`, `list_tables`, `list_columns`, and opt-in `switch_database_connection`—returning JSON capped by default at 1024 rows and 50000 characters (`--max-rows`, `--max-chars`). Local file connections default to read-only mode with `--ephemeral-connections` enabled so concurrent writers avoid file locks, while `--read-write` and `--allow-switch-databases` unlock full data-engineering workflows. For untrusted third-party deployments, the maintainers note that read-only mode alone still permits local filesystem access and advise pairing self-hosted MotherDuck setups with `--motherduck-saas-mode` and read-scaling service-account tokens, hardening standalone DuckDB with `--init-sql`, or choosing MotherDuck's hosted Remote MCP service.

Install & configure

Requirements

  • Python `uv` package runner (`pip install uv` or `brew install uv`) for local `uvx` execution, or Docker for Streamable HTTP
  • MotherDuck access token (`motherduck_token` / `MOTHERDUCK_TOKEN`) when connecting to `md:` cloud databases
  • Standard AWS credentials (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, optional `AWS_SESSION_TOKEN`) for `s3://` DuckDB files
Documented launch / install command
claude mcp add --scope user duckdb --transport stdio -- uvx mcp-server-motherduck --db-path :memory: --read-write --allow-switch-databases

Launch over `stdio` with `uvx mcp-server-motherduck --db-path :memory: --read-write --allow-switch-databases` (or point `--db-path` to a local `.duckdb` file or `md:`). For Streamable HTTP in Docker, run the built container on port 8000 exposing `http://localhost:8000/mcp`.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Desktop configuration
{
  "mcpServers": {
    "DuckDB (in-memory, r/w)": {
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        ":memory:",
        "--read-write",
        "--allow-switch-databases"
      ]
    }
  }
}

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

Cursor configuration
{
  "mcpServers": {
    "DuckDB (in-memory, r/w)": {
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        ":memory:",
        "--read-write",
        "--allow-switch-databases"
      ]
    }
  }
}

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "DuckDB (in-memory, r/w)": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        ":memory:",
        "--read-write",
        "--allow-switch-databases"
      ]
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

Windsurf configuration
{
  "mcpServers": {
    "DuckDB (in-memory, r/w)": {
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        ":memory:",
        "--read-write",
        "--allow-switch-databases"
      ]
    }
  }
}

Read the Windsurf setup guide

Config file · Project scope: .mcp.json at the repository root

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Code configuration
{
  "mcpServers": {
    "DuckDB (in-memory, r/w)": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        ":memory:",
        "--read-write",
        "--allow-switch-databases"
      ]
    }
  }
}

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Tools

Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.

ToolWhat it does
execute_queryExecute a SQL query using the DuckDB dialect against the active database connection and return JSON results.
list_databasesList all available databases across MotherDuck or attached DuckDB catalogs.
list_tablesList tables and views with optional database and schema filters.
list_columnsInspect column names and metadata for a specified table or view.
switch_database_connectionSwitch the active database path at runtime (requires passing `--allow-switch-databases`).

Use cases

  • Query local `.duckdb` analytics files from Claude Desktop or Cursor in read-only mode without locking out concurrent pipeline writers.
  • Run cross-environment SQL joins that read local filesystem data alongside cloud MotherDuck tables or S3-hosted DuckDB databases.
  • Explore unfamiliar schemas with `list_databases`, `list_tables`, and `list_columns` before generating DuckDB SQL in Claude Code or Codex CLI.
  • Deploy a containerized Streamable HTTP SQL endpoint on port 8000 backed by `--motherduck-saas-mode` and read-scaling service-account tokens.

Strengths

  • Official MIT-licensed implementation from MotherDuck covering in-memory DuckDB, local files, S3 URLs, and MotherDuck cloud workspaces.
  • Ephemeral read-only connections by default prevent file-lock collisions when inspecting active local DuckDB files.
  • Built-in guardrails (`--max-rows`, `--max-chars`, `--query-timeout`, `--init-sql`, `--motherduck-saas-mode`) protect context windows and sessions.
  • Supports both local `stdio` (`uvx`) and containerized Streamable HTTP (`--transport http`) with documented commands for Claude, Cursor, VS Code, Codex, Gemini CLI, and Kiro.

Limitations

  • Read-only mode alone does not sandbox local filesystem access or DuckDB settings; multi-tenant deployments require SaaS mode, `--init-sql`, or MotherDuck Remote MCP.
  • Requires installing `uv` locally (and specifying the full `uvx` binary path if clients hit `spawn uvx ENOENT`).
  • Runtime database switching is disabled unless `--allow-switch-databases` is explicitly passed.

mcp-server-motherduck setup notes

  • mcp-server-motherduck's example uses stdio, while its catalog transports are stdio / streamable-http; use the example's connection type.

Frequently asked questions

Install `uv` and register `uvx mcp-server-motherduck` over `stdio` in your MCP client configuration. In Claude Code, run `claude mcp add --scope user motherduck --transport stdio --env motherduck_token=YOUR_TOKEN -- uvx mcp-server-motherduck --db-path md: --read-write`. Claude Desktop users can either edit `mcpServers` JSON or install the `.mcpb` release bundle.

Related MCP servers