DuckDB MCP Server logo

DuckDB MCP Server

Community
mustafahasankhan

MCP (Model Context Protocol) server for DuckDB — auth and friendly SQL support out of the box

Publishermustafahasankhan
Repositoryduckdb-mcp-server
LanguagePython
Forks
3
Stars
18
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    DuckDB MCP Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    18 stars and 3 forks from the linked repository.

DuckDB MCP Server

PyPI - Version PyPI - Python Version PyPI - License

A Model Context Protocol (MCP) server that gives AI assistants full access to DuckDB — query local files, S3 buckets, and in-memory data using plain SQL.

🌟 What is DuckDB MCP Server?


What it does

This server exposes DuckDB to any MCP-compatible client (Claude Desktop, Cursor, VS Code, etc.). The assistant can:

  • Run arbitrary SQL against local CSV, Parquet, and JSON files
  • Query S3 / GCS buckets directly or cache them as local tables
  • Inspect schemas, compute statistics, and suggest visualizations
  • Use DuckDB's analytical SQL extensions (window functions, GROUP BY ALL, SELECT * EXCLUDE, etc.)

Tools

ToolDescription
queryExecute any SQL query. Results capped at 10 000 rows.
analyze_schemaDescribe the columns and types of a file or table.
analyze_dataRow count, numeric stats (min/max/avg/median), date ranges, top categorical values.
suggest_visualizationsSuggest chart types and ready-to-run SQL queries based on column types.
create_sessionCreate or reset a session for cross-call context tracking.

Resources

Three built-in XML documentation resources are always available to the assistant:

Resource URIContent
duckdb-ref://friendly-sqlDuckDB SQL extensions (GROUP BY ALL, SELECT * EXCLUDE/REPLACE, FROM-first syntax, …)
duckdb-ref://data-importLoading CSV, Parquet, JSON, and S3/GCS data; glob patterns; multi-file reads
duckdb-ref://visualizationChart patterns and query templates for time series, bar, scatter, and heatmap

Requirements

  • Python 3.10+
  • An MCP-compatible client

Installation

bash
pip install duckdb-mcp-server

From source:

bash
git clone https://github.com/mustafahasankhan/duckdb-mcp-server.git
cd duckdb-mcp-server
pip install -e .

Configuration

duckdb-mcp-server --db-path <path> [options]
FlagRequiredDescription
--db-pathYesPath to the DuckDB file. Created automatically if it does not exist.
--readonlyNoOpen the database read-only. Errors if the file does not exist.
--s3-regionNoAWS region. Defaults to AWS_DEFAULT_REGION env var, then us-east-1.
--s3-profileNoAWS profile name. Defaults to AWS_PROFILE env var, then default.
--creds-from-envNoRead AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY from environment.

Client setup

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

json
{
  "mcpServers": {
    "duckdb": {
      "command": "duckdb-mcp-server",
      "args": ["--db-path", "~/claude-duckdb/data.db"]
    }
  }
}

With S3 access

json
{
  "mcpServers": {
    "duckdb": {
      "command": "duckdb-mcp-server",
      "args": [
        "--db-path", "~/claude-duckdb/data.db",
        "--s3-region", "us-east-1",
        "--creds-from-env"
      ],
      "env": {
        "AWS_ACCESS_KEY_ID": "YOUR_KEY",
        "AWS_SECRET_ACCESS_KEY": "YOUR_SECRET"
      }
    }
  }
}

Read-only mode

Useful when the database is shared or managed separately:

json
{
  "mcpServers": {
    "duckdb": {
      "command": "duckdb-mcp-server",
      "args": ["--db-path", "/shared/analytics.db", "--readonly"]
    }
  }
}

Example conversations

Querying a local file

"Load sales.csv and show me the top 5 products by revenue."

sql
SELECT
    product_name,
    SUM(quantity * price) AS revenue
FROM read_csv('sales.csv')
GROUP BY ALL
ORDER BY revenue DESC
LIMIT 5;

Working with S3 data

"Cache this month's signups from S3 and show me a daily breakdown."

sql
-- Step 1: cache the remote data locally
CREATE TABLE signups AS
  SELECT * FROM read_parquet('s3://my-bucket/signups/2026-03/*.parquet',
                             union_by_name = true);

-- Step 2: query the cached table
SELECT
    date_trunc('day', signup_at) AS day,
    COUNT(*)                     AS signups
FROM signups
GROUP BY ALL
ORDER BY day DESC;

Statistical analysis

"Give me a statistical summary of the orders table."

The assistant calls analyze_data("orders") which returns row count, numeric stats per column, date ranges, and top categorical values — no SQL required from you.


AWS credential resolution order

  1. Environment variables (--creds-from-env): AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY
  2. Named profile (--s3-profile): reads ~/.aws/credentials
  3. Credential chain: environment → shared credentials file → instance profile (EC2/ECS)

Development

bash
git clone https://github.com/mustafahasankhan/duckdb-mcp-server.git
cd duckdb-mcp-server

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

pytest

License

Contributions are welcome! Please feel free to submit a Pull Request. MIT

Installation

TypingMind
{
  "mcpServers": {
    "duckdb-mcp-server": {
      "command": "duckdb-mcp-server",
      "args": [
        "--db-path",
        "{{config.DB_PATH}}",
        "{{config.EXTRA_ARGS}}"
      ],
      "env": {
        "DB_PATH": "<DB_PATH>"
      }
    }
  }
}

Use DuckDB MCP Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once DuckDB MCP Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add DuckDB MCP Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the DuckDB MCP Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "duckdb-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the DuckDB MCP Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the DuckDB MCP Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use DuckDB MCP Server to help me with this task?
DuckDB MCP Server
Sure. I read it.
Here is what I found using DuckDB MCP Server.

Frequently asked questions

What is the DuckDB MCP Server MCP server used for?

DuckDB MCP Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use DuckDB MCP Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use DuckDB MCP Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use DuckDB MCP Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With DuckDB MCP Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect DuckDB MCP Server MCP to TypingMind?

DuckDB MCP Server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does DuckDB MCP Server MCP provide in TypingMind?

DuckDB MCP Server exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use DuckDB MCP Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If DuckDB MCP Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇