DuckDB / MotherDuck Local MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
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 MCP** | **Local MCP** (this repo) |
|---|---|---|
| **Hosting** | Hosted by MotherDuck | Runs locally/self-hosted |
| **Setup** | Zero-setup | Requires local installation |
| **Access** | Read-write supported | Read-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)
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
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
See Command Line Parameters for more options, Securing for Production for deployment guidance, and Troubleshooting if you encounter issues.
Client Setup
| Client | Config Location | One-Click Install |
|--------|-----------------|-------------------|
| **Claude Desktop** | Settings → Developer → Edit Config | .mcpb (MCP Bundle) |
| **Claude Code** | Use CLI commands below | - |
| **Codex CLI** | Use CLI commands below or ~/.codex/config.toml | - |
| **Gemini CLI** | Use CLI commands below or ~/.gemini/settings.json | - |
| **Cursor** | Settings → MCP → Add new global MCP server | |
| **VS Code** | Ctrl+Shift+P → "Preferences: Open User Settings (JSON)" | |
| **Kiro** | ~/.kiro/settings/mcp.json (global) or .kiro/settings/mcp.json (project) | |
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):**
**Local DuckDB (Read-Only):**
**MotherDuck (Read-Write):**
Codex CLI commands
**In-Memory DuckDB (Dev Mode):**
**Local DuckDB (Read-Only):**
**MotherDuck (Read-Write):**
Gemini CLI commands
**In-Memory DuckDB (Dev Mode):**
**Local DuckDB (Read-Only):**
**MotherDuck (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):**
**MotherDuck (Read-Write):**
Tools
| Tool | Description | Required Inputs | Optional Inputs |
|------|-------------|-----------------|-----------------|
| execute_query | Execute SQL query (DuckDB dialect) | sql | - |
| list_databases | List all databases (useful for MotherDuck or multiple attached DBs) | - | - |