Query CSV files with SQL via MCP. Fast, local, zero-config, read-only, sandboxable with --root.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
The analytical CSV query engine for AI agents.
Run SQL analytics β GROUP BY, aggregates, joins, time-series β on CSV files in place: no database, no import, no ingest. csvql ships as an MCP server, so an LLM can query a gigabyte file for a few hundred tokens instead of pasting it (impossible) into context. A single static binary written in Zig. Your data never leaves your machine.
A database is something you load your data into. csvql is a query you run on the data where it already lives.
Read-only and on-prem by design. csvql only runs SELECT β it has no INSERT/UPDATE/DELETE/DROP and physically cannot modify your data. It makes zero network calls, needs no cloud, and runs fully air-gapped. Our next north star: the safe way to give AI agents query access to corporate data β run csvql next to the data on your own servers (read-only, nothing leaves the box) instead of shipping files out to an LLM.
Pasting a 417 MB CSV into an LLM costs 230 million tokens β it fits no context window. Over MCP, the agent queries the file in place and gets back only the answer:
| Question an agent asks | Tokens used |
|---|---|
| "How many trips per cab type?" | 43 |
| "Which year was busiest?" | 49 |
| "Average fare by passenger count?" | 123 |
Same answers, ~1,000β500,000Γ fewer tokens β flat, regardless of file size. One command wires it into Claude: csvql install. Measure it yourself: bench/bench_tokens.py.
Website Β· Quick Start Β· Installation Β· Performance Β· SQL Reference Β· Docs
csvql auto-detects SQL or simple mode from your input:
| Flag | Short | Description |
|---|---|---|
--no-header | Suppress header row in output | |
--no-input-header | Treat the first row as data; auto-name columns c1..cN | |
-o, --output <file> | Write results to a file instead of stdout | |
--delimiter <char> | -d | Field delimiter (default ,). Use \t for TSV |
--json | Output as a JSON array ([{...}, ...]) | |
--jsonl | Output as JSONL / NDJSON (one JSON object per line) | |
--threads <N> | Worker threads for parallel execution; 0 uses automatic detection | |
--strict | Error on a WHERE numeric comparison against a non-numeric value instead of silently skipping that row (see CORRECTNESS.md) | |
--version | -v | Show version |
--help | -h | Show help |
--mcp | Start as an MCP server (stdio JSON-RPC transport) | |
--root <dir> | Confine file access to a directory (repeatable via commas) | |
--audit <file> | Append a JSONL audit record per query (timestamp, SQL) |
Or in two steps if you plan to install multiple tools from this tap:
melihbirim/csvqlis the tap (the formula repository), and the trailing/csvqlis the formula name inside it.
Download from GitHub Releases:
Requires Zig 0.13.0+ (tested with 0.15.2):
2M rows, 56 MB CSV, Apple M2 Pro β aggregates on the raw CSV (best-of-5):
| Query | csvql | DuckDB | Speedup |
|---|---|---|---|
SELECT COUNT(*) scalar | 0.012s | 0.136s | 11.3x |
COUNT(*) GROUP BY | 0.020s | 0.146s | 7.3x |
JOIN SELECT * (2M Γ 6) | 0.088s | 7.832s | 89x |
NYC Taxi, 20M rows, 8 GB CSV β raw CSV, no ingest, both engines: ~3.2x faster, ~6x less memory, and 0 bytes of extra storage (DuckDB's fast path needs a 2.1 GB native store first). At this scale csvql reads raw CSV about as fast as cat β the read itself is the bound, not parsing.
Full breakdown (LIKE, multi-table JOIN, subqueries, memory/storage, methodology): BENCHMARKS.md. Reproduce any number yourself: bench/bench_all.sh.
SELECT/FROM/WHERE/GROUP BY/HAVING/ORDER BY/LIMIT/OFFSET, JOIN, subquery IN/NOT IN, LIKE/ILIKE/BETWEEN/IS NULL/AND/OR/NOT, aggregates (COUNT/SUM/AVG/MIN/MAX/VARIANCE/STDDEV/MEDIAN/GROUP_CONCAT), CASE WHEN, and scalar functions (UPPER/LOWER/TRIM/CONCAT/SUBSTR/REPLACE/SPLIT_PART/ROUND/CAST/COALESCE/STRFTIME/DATEDIFF/DATEADD/and more).
Full syntax table, runnable examples for every feature, known differences from DuckDB, and current limitations: SQL_REFERENCE.md.
Positional "simple mode" is also available for quick one-off filters without writing SQL: csvql data.csv "name,salary" "age>30" 10 "salary:desc" β see SIMPLE_QUERY_LANGUAGE.md.
csvql ships as a Model Context Protocol server, letting AI assistants (Claude, Copilot, etc.) query your CSV files directly.
A 1 MB CSV costs ~560,000 tokens to paste into an LLM β it doesn't even fit a 200K-token context window. Pasting a real dataset is impossible past a few hundred KB, and expensive long before that. With csvql --mcp the agent queries the file instead and gets back only the rows it asked for:
| CSV size | Paste into context | Query via csvql --mcp | Savings |
|---|---|---|---|
| 1 MB | 559K tokens β (overflows) | ~540 tokens | 1,000x |
| 10 MB | 5.6M tokens β | ~550 tokens | 10,000x |
| 100 MB | 55M tokens β | ~565 tokens | 98,000x |
| 417 MB | 230M tokens β | ~560 tokens | ~410,000x |
The query cost is flat β it's the SQL plus a few result rows, independent of file size β so a 417 MB file costs the same ~560 tokens as a 1 MB one. Five real questions, answered against DuckDB's NYC-taxi data; token counts via tiktoken (exact cl100k). Reproduce: bench/bench_tokens.py. Your data never leaves your machine.
| Tool | Description |
|---|---|
csv_query(sql) | Execute any supported SQL query, returns results as JSON |
csv_schema(file) | Column names and sample rows for a CSV file |
csv_list(directory?) | List CSV files in a directory |
csv_query accepts the full SQL dialect supported by csvql. You can ask your AI assistant things like:
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/csvql)<a href="https://allmcps.com/mcp/csvql"><img src="https://allmcps.com/api/badge/csvql?style=directory" alt="Csvql on AllMCPs" /></a>