Enables direct SQL queries on various data sources including CSV, Parquet, JSON, and cloud storage like S3, allowing for sophisticated data analysis with DuckDB's analytical database capabilities.
Provides ability to query and analyze SQLite databases through DuckDB's interface, extending analytical capabilities to SQLite data sources.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@DuckDB MCP Servershow me the top 5 customers by total purchase amount from sales.csv"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
DuckDB MCP Server
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?
Related MCP server: MCP Database 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
Tool | Description |
| Execute any SQL query. Results capped at 10 000 rows. |
| Describe the columns and types of a file or table. |
| Row count, numeric stats (min/max/avg/median), date ranges, top categorical values. |
| Suggest chart types and ready-to-run SQL queries based on column types. |
| Create or reset a session for cross-call context tracking. |
Resources
Three built-in XML documentation resources are always available to the assistant:
Resource URI | Content |
| DuckDB SQL extensions (GROUP BY ALL, SELECT * EXCLUDE/REPLACE, FROM-first syntax, β¦) |
| Loading CSV, Parquet, JSON, and S3/GCS data; glob patterns; multi-file reads |
| Chart patterns and query templates for time series, bar, scatter, and heatmap |
Requirements
Python 3.10+
An MCP-compatible client
Installation
pip install duckdb-mcp-serverFrom 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]Flag | Required | Description |
| Yes | Path to the DuckDB file. Created automatically if it does not exist. |
| No | Open the database read-only. Errors if the file does not exist. |
| No | AWS region. Defaults to |
| No | AWS profile name. Defaults to |
| No | Read |
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
Environment variables (
--creds-from-env):AWS_ACCESS_KEY_ID+AWS_SECRET_ACCESS_KEYNamed profile (
--s3-profile): reads~/.aws/credentialsCredential 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]"
pytestLicense
Contributions are welcome! Please feel free to submit a Pull Request. MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.