Back to Blog
How to Use DuckDB MCP for Data Analysis
Run in-process analytical SQL queries on CSV, Parquet, and JSON files using DuckDB MCP — perfect for local data analysis without a database server.
duckdbdata-analysissqlparquetclaude-code
What is the DuckDB MCP?
DuckDB is an in-process analytical database that runs directly on your machine without a server. It can query CSV, Parquet, JSON, and Arrow files at high speed using familiar SQL. The DuckDB MCP connects Claude Code to a local DuckDB instance, turning it into a powerful data analyst that can explore local datasets, profile data quality, and answer analytical questions on the fly.
Installation
mcpizy install duckdb
No external server is required. The MCP spins up an in-memory DuckDB instance or connects to a persistent .duckdb file you specify.
Key Capabilities
- Query flat files directly — run SQL on CSV, Parquet, and JSON files without importing them first.
- Columnar analytics — perform fast aggregations, window functions, and joins on large local datasets.
- Profile data quality — detect nulls, outliers, and distribution skew with SQL.
- Export results — write query results to new CSV or Parquet files.
- Read remote files — query S3 and HTTP-hosted Parquet files directly via httpfs.
Example Usage
Analyze a large CSV export from your CRM without loading it into a database:
SELECT
country,
COUNT(*) AS customers,
AVG(ltv) AS avg_ltv
FROM read_csv_auto('customers_export.csv')
GROUP BY country
ORDER BY avg_ltv DESC;
Tips and Best Practices
- Use Parquet format for large datasets — it compresses better and queries much faster than CSV.
- DuckDB can query multiple files with glob patterns — e.g.,
read_parquet('logs/*.parquet'). - Combine with ClickHouse MCP for production-scale analytics; use DuckDB for local exploration before loading.
- Use
SUMMARIZE tablenamefor instant column statistics — a great first step for any new dataset.
Found this useful? Share it.