SuperAPIAI Directory

mcp-server-motherduck

github.com · AI developer platforms

Query and analyze data with MotherDuck and local DuckDB

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

Purpose

mcp-server-motherduck is a local MCP (Model Context Protocol) server used to provide SQL analytics and data engineering capabilities for AI assistants and IDEs. It connects DuckDB's analytical SQL engine and the MotherDuck service to MCP-compatible clients, enabling AI assistants to directly query and analyze data.

Main Capabilities

  • Connect to multiple data sources: local DuckDB files, in-memory databases, DuckDB files hosted on S3 (s3://bucket/path.duckdb), and MotherDuck.
  • Execute SQL read and write queries.
  • Browse database catalogs.
  • Switch instantly between different database connections (requires the --allow-switch-databases flag).
  • All tools return JSON; results are limited by default to 1024 rows / 50,000 characters, configurable via --max-rows and --max-chars.

Usage

Prerequisite: install uv via pip install uv or brew install uv.

Three typical connection modes are supported:

  1. In-memory DuckDB (development mode): fully flexible, no safeguards, with read and write access, and the ability to switch to any database at runtime (local file, S3, or MotherDuck).
  2. Local DuckDB file (read-only mode): connect to a specific DuckDB file in read-only mode, without holding a file lock, making it easy to use alongside a write connection to the same file; you can also connect to a remote DuckDB file on S3 via s3://bucket/path.duckdb (see environment variables for S3 authentication).
  3. MotherDuck (read-write mode).

Any MCP-compatible client can use this server. Add the JSON configuration from the Quick Start to the client's MCP configuration file; consult the corresponding client documentation for the configuration file location. For example, Kiro's MCP configuration file is located at ~/.kiro/settings/mcp.json (global) or .kiro/settings/mcp.json (project-level).

You can also use Streamable HTTP to build andrun the server on port 8000 (using in-memory DuckDB by default), with the MCP endpoint at http://localhost:8000/mcp;通过传递 token and override the command to connect to MotherDuck. CLI flags and environment variables also apply.

For more options such as running from source, command-line arguments, and environment variables, see the project documentation.

Use Cases

  • Provide SQL analytics and data engineering support for AI assistants and IDEs.
  • Connect to local DuckDB files, in-memory databases, S3 databases, or MotherDuck for data queries.
  • Analytical workflows that require browsing database catalogs or switching between multiple database connections.

Limitations and Security Considerations

  • When exposing a self-hosted MCP server to third parties, using read-only mode alone is not sufficient—it still allows access to the local file system, changes to DuckDB settings, and other potentially sensitive operations.
  • In production environments involving third-party access, the official recommendation is to use MotherDuck Remote MCP (zero configuration, read-write support, hosted by MotherDuck).
  • Self-hosted MotherDuck MCP: you can fork this repository and customize it as needed; use a service account with a read-scaling token, and enable SaaS mode to restrict local file access.
  • Self-hosted DuckDB MCP: use --init-sql to apply security settings; see the Securing DuckDB guide.
  • Troubleshooting: if spawn uvx ENOENT occurs, specify the full path to uvx (run which uvx to find it); if File locked occurs, ensure --ephemeral-connections is enabled (true by default) and that you are not connecting in read-write mode.

Other Information

  • License: MIT (see the LICENSE file).
  • MCP name: io.github.motherduckdb/mcp-server-motherduck.
  • Release process: run the Release New Version GitHub Action, enter a version number in MAJOR.MINOR.PATCH format, and the workflow will update the version, publish to PyPI/MCP registry, and create a GitHub release containing the MCPB package.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools