mcpField
D
DuckDB MCP Server

DuckDB MCP Server

Local
github.com/mustafahasankhanDatabases19Updated 33w ago

About DuckDB MCP Server

DuckDB MCP Server is an MCP server that lets AI assistants run plain SQL against DuckDB, covering local files, S3 buckets and in-memory data. It suits users who want AI-assisted data analysis without writing SQL by hand. It offers read-only mode and configurable AWS credentials.

Key features

  1. 01Run SQL against local CSV, Parquet and JSON files
  2. 02Query or cache S3 and GCS bucket data
  3. 03Analyze schemas, row counts and column statistics
  4. 04Suggest chart types and query templates
  5. 05Built-in DuckDB SQL reference resources

Use cases

  1. 01Letting an AI assistant summarize a local sales file
  2. 02Caching Parquet data from S3 as local tables for querying
  3. 03Giving an assistant read-only access to a shared database

MCP support

This project is an MCP server that exposes the query, analyze_schema, analyze_data, suggest_visualizations and create_session tools, plus three documentation resources, to MCP clients such as Claude Desktop, Cursor and VS Code.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

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.

DuckDB Server MCP server

🌟 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

pip install duckdb-mcp-server

From source:

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):

{
  "mcpServers": {
    "duckdb": {
      "command": "duckdb-mcp-server",
      "args": ["--db-path", "~/claude-duckdb/data.db"]
    }
  }
}
With S3 access
{
  "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:

{
  "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."

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."

-- 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

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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.