Mcp Server Motherduck

io.github.motherduckdb由 GitHub 帳號 motherduckdb 發布v1.1.0更新於 Oct 24, 2026

SQL analytics and data engineering for AI Assistants and IDEs

已驗證STDIO僅桌面資料庫資料與分析

概覽

AI 產生的概覽

本機 MCP 伺服器,將 AI 助理連接到 DuckDB 與 MotherDuck,讓它能執行分析型 SQL、瀏覽目錄並切換資料庫。

可以做什麼
對 DuckDB 或 MotherDuck 執行 SQL 查詢,啟用後可包含讀寫語句,結果以 JSON 回傳,預設受列數與字元數上限限制。瀏覽資料庫目錄,列出資料庫、資料表與檢視表,以及某個資料表或檢視表的欄位。在啟用切換旗標時,將目前資料庫連線切換到其他本機檔案、S3 路徑或 MotherDuck 資料庫。可跨本機與遠端資料庫查詢,並透過本機檔案系統匯入或匯出資料。
適用情境
當助理需要用 DuckDB 的 SQL 引擎分析資料、處理本機 DuckDB 檔案、記憶體資料庫或 MotherDuck,或在 IDE 與聊天用戶端中執行資料工程查詢時使用。這是本機版本;另有託管的 MotherDuck 遠端伺服器可免安裝使用。
執行需求
以 Python 套件形式透過 uvx 在本機執行,需先安裝 uv。以參數指定資料庫路徑:記憶體、絕對路徑的本機檔案、s3:// 位址或 MotherDuck 的 md:。MotherDuck 需要權杖,可透過 motherduck_token 或 MOTHERDUCK_TOKEN 變數或權杖參數提供;S3 存取需要 AWS_ACCESS_KEY_ID、AWS_SECRET_ACCESS_KEY,可選 AWS_SESSION_TOKEN、AWS_DEFAULT_REGION 與 AWS_ENDPOINT。DuckDB 使用 HOME 存放擴充套件與設定。
安裝前請注意
寫入預設關閉,需以讀寫旗標開啟;記憶體開發設定被描述為沒有防護措施,具備讀寫權限並可在執行時切換到任意資料庫。README 警告,開放給第三方存取時僅唯讀模式並不足夠,因為它仍允許存取本機檔案系統與變更 DuckDB 設定。MotherDuck 權杖與 AWS 憑證屬於機密,透過環境變數或參數傳入。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mcp Server Motherduck,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[MotherDuck / DuckDB Local MCP Server]

DuckDB / MotherDuck Local MCP Server

SQL analytics and data engineering for AI Assistants and IDEs.


Connect AI assistants to your data using DuckDB's powerful analytical SQL engine. Supports connecting to local DuckDB files, in-memory databases, S3-hosted databases, and MotherDuck. Allows executing SQL read- and write-queries, browsing database catalogs, and switching between different database connections on-the-fly.

Looking for a fully-managed remote MCP server for MotherDuck? → Go to the MotherDuck Remote MCP docs

Remote vs Local MCP

Remote MCPLocal MCP (this repo)
HostingHosted by MotherDuckRuns locally/self-hosted
SetupZero-setupRequires local installation
AccessRead-write supportedRead-write supported
Local filesystem-Query across local and remote databases, ingest data from / export data to local filesystem

Quick Start

Prerequisites: Install uv via pip install uv or brew install uv

Connecting to In-Memory DuckDB (Dev Mode)

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

Full flexibility with no guardrails — read-write access and the ability to switch to any database (local files, S3, or MotherDuck) at runtime.

Connecting to a Local DuckDB File in Read-Only Mode

json
{  "mcpServers": {    "DuckDB (read-only)": {      "command": "uvx",      "args": ["mcp-server-motherduck", "--db-path", "/absolute/path/to/your.duckdb"]    }  }}

Connects to a specific DuckDB file in read-only mode. Won't hold on to the file lock, so convenient to use alongside a write connection to the same DuckDB file. You can also connect to remote DuckDB files on S3 using s3://bucket/path.duckdb — see Environment Variables for S3 authentication. If you're considering third-party access to the MCP, see Securing for Production.

Connecting to MotherDuck in Read-Write Mode

json
{  "mcpServers": {    "MotherDuck (local, r/w)": {      "command": "uvx",      "args": ["mcp-server-motherduck", "--db-path", "md:", "--read-write"],      "env": {        "motherduck_token": "<YOUR_MOTHERDUCK_TOKEN>"      }    }  }}

See Command Line Parameters for more options, Securing for Production for deployment guidance, and Troubleshooting if you encounter issues.

Client Setup

ClientConfig LocationOne-Click Install
Claude DesktopSettings → Developer → Edit Config.mcpb (MCP Bundle)
Claude CodeUse CLI commands below-
Codex CLIUse CLI commands below or ~/.codex/config.toml-
Gemini CLIUse CLI commands below or ~/.gemini/settings.json-
CursorSettings → MCP → Add new global MCP server[Install in Cursor]
VS CodeCtrl+Shift+P → "Preferences: Open User Settings (JSON)"[Install with UV in VS Code]
Kiro~/.kiro/settings/mcp.json (global) or .kiro/settings/mcp.json (project)[Add to Kiro]

Any MCP-compatible client can use this server. Add the JSON configuration from Quick Start to your client's MCP config file. Consult your client's documentation for the config file location.

Claude Code CLI commands

In-Memory DuckDB (Dev Mode):

bash
claude mcp add --scope user duckdb --transport stdio -- uvx mcp-server-motherduck --db-path :memory: --read-write --allow-switch-databases

Local DuckDB (Read-Only):

bash
claude mcp add --scope user duckdb --transport stdio -- uvx mcp-server-motherduck --db-path /absolute/path/to/db.duckdb

MotherDuck (Read-Write):

bash
claude mcp add --scope user motherduck --transport stdio --env motherduck_token=YOUR_TOKEN -- uvx mcp-server-motherduck --db-path md: --read-write
Codex CLI commands

In-Memory DuckDB (Dev Mode):

bash
codex mcp add duckdb -- uvx mcp-server-motherduck --db-path :memory: --read-write --allow-switch-databases

Local DuckDB (Read-Only):

bash
codex mcp add duckdb -- uvx mcp-server-motherduck --db-path /absolute/path/to/db.duckdb

MotherDuck (Read-Write):

bash
codex mcp add motherduck --env motherduck_token=YOUR_TOKEN -- uvx mcp-server-motherduck --db-path md: --read-write
Gemini CLI commands

In-Memory DuckDB (Dev Mode):

bash
gemini mcp add -s user duckdb uvx mcp-server-motherduck --db-path :memory: --read-write --allow-switch-databases

Local DuckDB (Read-Only):

bash
gemini mcp add -s user duckdb uvx mcp-server-motherduck --db-path /absolute/path/to/db.duckdb

MotherDuck (Read-Write):

bash
gemini mcp add -s user -e motherduck_token=YOUR_TOKEN motherduck uvx mcp-server-motherduck --db-path md: --read-write
Kiro manual JSON config

Add the following to your Kiro MCP config file (~/.kiro/settings/mcp.json for global, or .kiro/settings/mcp.json for project-scoped). See the Kiro MCP documentation for more details.

In-Memory DuckDB (Dev Mode):

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

MotherDuck (Read-Write):

json
{  "mcpServers": {    "MotherDuck (local, r/w)": {      "command": "uvx",      "args": ["mcp-server-motherduck", "--db-path", "md:", "--read-write"],      "env": {        "motherduck_token": "<YOUR_MOTHERDUCK_TOKEN>"      }    }  }}

Tools

ToolDescriptionRequired InputsOptional Inputs
execute_queryExecute SQL query (DuckDB dialect)sql-
list_databasesList all databases (useful for MotherDuck or multiple attached DBs)--
list_tablesList tables and views-database, schema
list_columnsList columns of a table/viewtabledatabase, schema
switch_database_connection*Switch to different databasepathcreate_if_not_exists

*Requires --allow-switch-databases flag

All tools return JSON. Results are limited to 1024 rows / 50,000 chars by default (configurable via --max-rows, --max-chars).

Securing for Production

When giving third parties access to a self-hosted MCP server, read-only mode alone is not sufficient — it still allows access to the local filesystem, changing DuckDB settings, and other potentially sensitive operations.

For production deployments with third-party access, we recommend MotherDuck Remote MCP — zero-setup, read-write capable, and hosted by MotherDuck.

Self-hosting MotherDuck MCP: Fork this repo and customize as needed. Use a service account with read-scaling tokens and enable SaaS mode to restrict local file access.

Self-hosting DuckDB MCP: Use --init-sql to apply security settings. See the Securing DuckDB guide for available options.

Docker

Build and run the server with Streamable HTTP on port 8000 (defaults to an in-memory DuckDB):

bash
docker build -t mcp-server-motherduck .docker run --rm -p 8000:8000 mcp-server-motherduck

Connect to MotherDuck by passing a token and overriding the command:

bash
docker run --rm -p 8000:8000 \  -e motherduck_token="$MOTHERDUCK_TOKEN" \  mcp-server-motherduck --transport http --db-path md:

The MCP endpoint is available at http://localhost:8000/mcp. CLI flags and env vars from below still apply.

Command Line Parameters

ParameterDefaultDescription
--db-path:memory:Database path: local file (absolute), md: (MotherDuck), or s3:// URL
--motherduck-tokenmotherduck_token env varMotherDuck access token
--read-writeFalseEnable write access
--motherduck-saas-modeFalseMotherDuck SaaS mode (restricts local access)
--allow-switch-databasesFalseEnable switch_database_connection tool
--max-rows1024Max rows returned
--max-chars50000Max characters returned
--query-timeout-1Query timeout in seconds (-1 = disabled)
--init-sqlNoneSQL to execute on startup
--motherduck-connection-parameterssession_hint=mcp&
dbinstance_inactivity_ttl=0s
Additional MotherDuck connection string parameters (key=value pairs separated by &)
--ephemeral-connectionsTrueUse temporary connections for read-only local files
--transportstdioTransport type: stdio or http
--stateless-httpFalseFor protocol compatibility only (e.g. with AWS Bedrock AgentCore Runtime). Server still maintains global state via the shared DatabaseClient.
--port8000Port for HTTP transport
--host127.0.0.1Host for HTTP transport

Environment Variables

VariableDescription
motherduck_token or MOTHERDUCK_TOKENMotherDuck access token (alternative to --motherduck-token)
HOMEUsed by DuckDB for extensions and config. Override with --home-dir if not set.
AWS_ACCESS_KEY_IDAWS access key for S3 database connections
AWS_SECRET_ACCESS_KEYAWS secret key for S3 database connections
AWS_SESSION_TOKENAWS session token for temporary credentials (IAM roles, SSO, EC2 instance profiles)
AWS_DEFAULT_REGIONAWS region for S3 connections
AWS_ENDPOINTAWS endpoint for S3 connections

Troubleshooting

  • spawn uvx ENOENT: Specify full path to uvx (run which uvx to find it)
  • File locked: Make sure --ephemeral-connections is turned on (default: true) and that you're not connected in read-write mode

Resources

Development

To run from source:

json
{  "mcpServers": {    "Local DuckDB (Dev)": {      "command": "uv",      "args": ["--directory", "/path/to/mcp-server-motherduck", "run", "mcp-server-motherduck", "--db-path", "md:"],      "env": {        "motherduck_token": "<YOUR_MOTHERDUCK_TOKEN>"      }    }  }}

Release Process

  1. Run the Release New Version GitHub Action
  2. Enter version in MAJOR.MINOR.PATCH format
  3. The workflow bumps version, publishes to PyPI/MCP registry, and creates the GitHub release with MCPB package

License

MIT License - see LICENSE file.

mcp-name: io.github.motherduckdb/mcp-server-motherduck

來源:README.md,提交 41acb58

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

2
  1. v1.1.0最新Oct 7, 2026
  2. v1.0.8Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分