duckdb_analytics_mcp
Provides read-only SQL analytics over local CSV, Parquet, and JSON datasets using DuckDB.
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_analytics_mcpshow revenue by region from sales_orders.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.
Repository: https://github.com/pypi-ahmad/duckdb-analytics-mcp
Project 3: Production-Grade MCP Server (DuckDB Analytics)
A simple but powerful, deployable MCP server built with the official Python MCP SDK.
This server exposes secure, read-only analytics tools over local CSV/Parquet/JSON datasets using DuckDB.
Server name:
duckdb_analytics_mcpMCP transports:
stdioandstreamable-httpRuntime: Python
3.12.10withuv
Why this project is resume-worthy
Implements a real MCP server (not toy tools) with production concerns: validation, pagination, security guardrails, CI, Docker, and typed code.
Uses a practical architecture: thin MCP layer + testable service layer.
Ships with evaluation fixtures (
evaluations/duckdb_analytics_eval.xml) and sample datasets for reproducible demos.
Related MCP server: Ditto MCP Server
What it can do
Tools
duckdb_analytics_health
Server health and dataset catalog status.
duckdb_analytics_list_datasets
Paginated dataset discovery with metadata.
duckdb_analytics_describe_dataset
Schema + row count + sample rows for a dataset.
duckdb_analytics_query_dataset
Read-only SQL query execution against a dataset using
sourcealias.Supports pagination and Markdown/JSON responses.
Resources
dataset://catalogdataset://schema/{dataset_name}
Security and production hardening
Read-only SQL guard (
SELECT/WITHonly).Blocks dangerous SQL keywords and SQL comments.
Single-statement enforcement (no multi-statement execution).
Query length, row limit, and timeout controls.
DuckDB extension auto-install/loading disabled.
Stdio-safe logging to
stderr(neverstdout).Optional bearer token auth using MCP auth primitives (
STATIC_BEARER_TOKEN+ auth URLs).
Project structure
.
├── src/duckdb_analytics_mcp/
│ ├── config.py
│ ├── security.py
│ ├── catalog.py
│ ├── service.py
│ ├── formatter.py
│ ├── server.py
│ └── cli.py
├── tests/
├── data/
├── evaluations/
├── Dockerfile
└── .github/workflows/ci.ymlSetup (uv + Python 3.12.10)
git clone https://github.com/pypi-ahmad/duckdb-analytics-mcp.git
cd duckdb-analytics-mcpuv python pin 3.12.10
uv sync --dev
cp .env.example .envRun
Streamable HTTP (remote deploy/default)
uv run duckdb-analytics-mcp run --transport streamable-httpDefault endpoint:
http://127.0.0.1:8000/mcp
If port 8000 is busy:
PORT=8015 uv run duckdb-analytics-mcp run --transport streamable-httpstdio (local MCP client integration)
uv run duckdb-analytics-mcp run --transport stdioDeployment readiness check
uv run duckdb-analytics-mcp doctorReal validation outputs (from latest run)
uv run duckdb-analytics-mcp doctor:
{
"health": {
"status": "ok",
"server": "duckdb_analytics_mcp",
"dataset_dir": "/home/ahmad/AI/Projects/duckdb-analytics-mcp/data",
"dataset_count": 2,
"checked_at": "2026-06-12T07:13:37.540625Z"
},
"dataset_preview_count": 2,
"dataset_total": 2
}Revenue query result (sales_orders.csv):
{
"dataset": "sales_orders.csv",
"total_count": 4,
"rows": [
{"region": "North", "revenue": 24646.93},
{"region": "West", "revenue": 23259.54},
{"region": "South", "revenue": 18548.94},
{"region": "East", "revenue": 14552.55}
]
}Testing and quality gates
uv run ruff check .
uv run mypy src
uv run pytestCurrent status:
ruff: passmypy: passpytest: pass (10 passed)
Docker
Build and run:
docker build -t duckdb-analytics-mcp:latest .
docker run --rm -p 8000:8000 \
-e HOST=0.0.0.0 \
-e PORT=8000 \
-e TRANSPORT=streamable-http \
duckdb-analytics-mcp:latestOr with Compose:
docker compose up --buildMCP client config example (stdio)
{
"mcpServers": {
"duckdb-analytics": {
"command": "uv",
"args": [
"run",
"--project",
"/home/ahmad/AI/Projects/duckdb-analytics-mcp",
"duckdb-analytics-mcp",
"run",
"--transport",
"stdio"
]
}
}
}Tradeoff (intentional)
The server is intentionally read-only and blocks write/admin SQL paths. This reduces blast radius for production MCP usage at the cost of not supporting ETL/DDL workflows.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pypi-ahmad/duckdb-analytics-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server