run-sql-connectorx
An MCP server that executes SQL via ConnectorX and streams the result to CSV or Parquet in
PyArrow RecordBatch chunks.
- Output formats:
csvorparquet - CSV: UTF-8, header row is always written
- Parquet: PyArrow defaults; schema mismatch across batches raises an error
- Return value: the string
"OK"on success, or"Error: <message>"on failure - On failure the partially written output file is deleted
- CSV token counting (optional): per-line token counting via
tiktoken(o200k_base) with a warning threshold
Why this library?
- Efficient streaming: handles large results in Arrow
RecordBatchchunks - Token-efficient for MCP: exchanges data via files instead of inline payloads
- Cross-database via ConnectorX: one tool works across many backends
- Robust I/O: CSV header handling, Parquet schema validation, safe cleanup on errors
Supported data sources (ConnectorX)
ConnectorX supports many databases. Common examples include:
- PostgreSQL
- MySQL / MariaDB
- SQLite
- Microsoft SQL Server
- Amazon Redshift
- Google BigQuery






