How to Set Up DuckDB MCP Server for AI-Powered SQL Analytics

Connect AI assistants like Cursor and Claude to DuckDB and MotherDuck databases in minutes. This guide walks API developers and data teams through installing, configuring, and securing DuckDB MCP Server for seamless conversational SQL analytics.

Ashley Goolam

Ashley Goolam

30 January 2026

How to Set Up DuckDB MCP Server for AI-Powered SQL Analytics

Apidog for Enterprise

On-Premises Deploy

SSO & RBAC

SOC 2 Compliant

Explore Apidog Enterprise

Supercharge your data analytics workflow by connecting AI assistants and IDEs directly to DuckDB and MotherDuck databases—no manual SQL required. Discover how the DuckDB MCP Server lets you run natural language queries, automate data exploration, and boost productivity with tools like Cursor, Claude Desktop, and VS Code.

💡 Looking for a robust API testing platform that also generates beautiful API documentation? Need an all-in-one workspace for your developer team’s productivity? Try Apidog—it replaces Postman at a much more affordable price while streamlining your API workflow.

button

What is DuckDB MCP Server? The Bridge Between AI and SQL

The DuckDB MCP Server is a Model Context Protocol (MCP) server that enables direct, conversational SQL queries from AI tools to DuckDB and MotherDuck databases. This means you can ask your AI client questions like “Show me the top customers,” and instantly get results—no manual SQL or context switching.

Key Features:

DuckDB MCP Server is rapidly becoming a favorite among data analysts and developers for AI-driven analytics.


Why Use DuckDB MCP Server for Data Analytics?

If you’re an API developer, data engineer, or technical lead, DuckDB MCP Server unlocks several advantages:

For example, generating sales trend reports becomes as simple as typing a question—no more manual queries or tedious data wrangling.


Step-by-Step: Setting Up DuckDB MCP Server

Follow this guide to install and configure DuckDB MCP Server for both cloud (MotherDuck) and local (DuckDB) use cases.

1. Install Prerequisites

Ensure you have:


2. Choose Your Data Source

Option 1: MotherDuck Cloud (S3 & Cloud Storage)

Option 2: Local DuckDB (On Your Device)

install duckdb

view csv data
show tables


3. Start the DuckDB MCP Server

For MotherDuck Cloud:

uvx mcp-server-motherduck --db-path md: --motherduck-token <YOUR_MOTHERDUCK_TOKEN>

Or for a specific database:

uvx mcp-server-motherduck --db-path md:your_database_name --motherduck-token <YOUR_MOTHERDUCK_TOKEN>

For Local DuckDB Files:

uvx mcp-server-motherduck --db-path /path/to/your/local.db

For In-Memory DB:

uvx mcp-server-motherduck --db-path :memory:

4. Connect DuckDB MCP Server to Your AI Tool

Cursor (Cloud & Local)

Cloud Example:

{
  "mcpServers": {
    "mcp-server-motherduck": {
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        "md:",
        "--motherduck-token",
        "<YOUR_MOTHERDUCK_TOKEN_HERE>"
      ]
    }
  }
}

Local Example:

{
  "mcpServers": {
    "mcp-server-motherduck": {
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        "/path/to/your/local.db"
      ]
    }
  }
}

configure mcp server in cursor


Claude Desktop

Cloud Example:

{
  "mcpServers": {
    "mcp-server-motherduck": {
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        "md:",
        "--motherduck-token",
        "<YOUR_MOTHERDUCK_TOKEN_HERE>"
      ],
      "env": {
        "HOME": "<YOUR_HOME_DIRECTORY>"
      }
    }
  }
}

Local Example:

{
  "mcpServers": {
    "mcp-server-motherduck": {
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        "/path/to/your/local.db"
      ],
      "env": {
        "HOME": "<YOUR_HOME_DIRECTORY>"
      }
    }
  }
}

Replace <YOUR_HOME_DIRECTORY> as needed and restart Claude.


VS Code

Cloud Example:

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "motherduck_token",
        "description": "MotherDuck Token",
        "password": true
      }
    ],
    "servers": {
      "motherduck": {
        "command": "uvx",
        "args": [
          "mcp-server-motherduck",
          "--db-path",
          "md:",
          "--motherduck-token",
          "${input:motherduck_token}"
        ]
      }
    }
  }
}

Local Example:

{
  "mcp": {
    "servers": {
      "motherduck": {
        "command": "uvx",
        "args": [
          "mcp-server-motherduck",
          "--db-path",
          "/path/to/your/local.db"
        ]
      }
    }
  }
}

Save and reload VS Code.


5. Query Your Database Using AI

Now, simply prompt your AI tool:

Results appear instantly inside your AI client.


6. Example: Data Exploration with DuckDB MCP Server

For a database containing matches and players tables, try these prompts:

list tables
get insights
deep dive into data


7. Best Practices: Securing Your DuckDB MCP Server

For collaborative environments or production:

{
  "mcpServers": {
    "mcp-server-motherduck": {
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        "md:",
        "--motherduck-token",
        "<YOUR_READ_SCALING_TOKEN>",
        "--saas-mode"
      ]
    }
  }
}

Troubleshooting Common DuckDB MCP Server Issues

For more help, see motherduck.com/docs or github.com/motherduckdb/mcp-server-motherduck.


Customizing and Extending DuckDB MCP Server

Take your setup further:


Why DuckDB MCP Server Changes How Developers Work

DuckDB MCP Server transforms the way technical teams interact with data—bridging natural language, AI, and SQL for rapid, accessible analytics. Its hybrid support for local and cloud data, serverless approach, and AI integrations set it apart from the traditional DuckDB CLI. While token management and permissions require attention, the time savings and productivity boost are immense.

💡 Want to improve your API workflow even further? Apidog provides seamless API documentation and team collaboration, helping you ship faster than ever—see how it compares to Postman.

button

Explore more

Generate API Tests With GPT-6 Luna: What a Full OpenAPI Spec Actually Costs

Generate API Tests With GPT-6 Luna: What a Full OpenAPI Spec Actually Costs

A full test-generation pass over a 42-endpoint OpenAPI spec costs about $0.29 on GPT-6 Luna at $0.10/$0.50, or under $0.10 with prompt caching. The per-spec arithmetic, the request shape, the latency to budget for, and the two failure modes.

23 September 2026

What Is GPT-6 Sol? Model ID, Pricing, 872K Context, and Benchmarks

What Is GPT-6 Sol? Model ID, Pricing, 872K Context, and Benchmarks

GPT-6 Sol explained: model ID gpt-6-sol, $2/$10 pricing, 872K context, AutomationBench 33.2% at $0.27 per task, DeepSWE 68.8%, and why it is a new model, not the GPT-5.6 Sol tier.

23 September 2026

What Is Claude Opus 5.5?

What Is Claude Opus 5.5?

Claude Opus 5.5 explained: model id claude-opus-5-5, $4/$20 pricing, 1M context, 128k max output, the eight benchmark scores Anthropic published, and 18+ hour tasks.

23 September 2026

Practice API Design-first in Apidog

Discover an easier way to build and use APIs

How to Set Up DuckDB MCP Server for AI-Powered SQL Analytics