run-sql-connectorx
Executes SQL queries against Amazon Redshift and streams results to CSV or Parquet via ConnectorX.
Executes SQL queries against Google BigQuery and streams results to CSV or Parquet via ConnectorX.
Executes SQL queries against MariaDB and streams results to CSV or Parquet via ConnectorX.
Executes SQL queries against MySQL and streams results to CSV or Parquet via ConnectorX.
Executes SQL queries against PostgreSQL and streams results to CSV or Parquet via ConnectorX.
Executes SQL queries against SQLite and streams results to CSV or Parquet via ConnectorX.
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., "@run-sql-connectorxRun sales.sql and save as parquet"
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.
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:
csvorparquetCSV: 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 failureOn 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
RecordBatchchunksToken-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
For the complete and up-to-date list of supported databases and connection-token (conn) formats, see the official docs:
ConnectorX repository: https://github.com/sfu-db/connector-x/
Database connection tokens: https://github.com/sfu-db/connector-x/tree/main/docs/databases
Getting Started
uvx run-sql-connectorx \
--conn "<connection_token>" \
--csv-token-threshold 500000<connection_token> is the connection token (conn) used by ConnectorX—SQLite, PostgreSQL, BigQuery, and more.
CLI options
--conn <connection_token>(required): ConnectorX connection token (conn)--csv-token-threshold <int>(default0): when> 0, enable CSV per-line token counting usingtiktoken(o200k_base); the value is a warning threshold
Further reading
ConnectorX repository: https://github.com/sfu-db/connector-x/
Connection-token formats for each database: https://github.com/sfu-db/connector-x/tree/main/docs/databases
Running from mcp.json
To launch the server from an MCP-aware client such as Cursor, add the following snippet to
.cursor/mcp.json at the project root:
{
"mcpServers": {
"run-sql-connectorx": {
"command": "uvx",
"args": [
"--from", "git+https://github.com/gigamori/mcp-run-sql-connectorx",
"run-sql-connectorx",
"--conn", "<connection_token>"
]
}
}
}Behaviour and Limits
Streaming: Results are streamed from ConnectorX in RecordBatch chunks; the default
batch_sizeis100 000rows.Empty result:
CSV – an empty file is created
Parquet – an empty table is written
Error handling: the output file is removed on any exception.
CSV token counting (when
--csv-token-threshold > 0):Counted text: exactly what
csv.writerwrites (including header row when present, delimiters, quotes, and newlines), UTF-8Streaming approach: tokenized with
tiktoken(o200k_base)per written CSV line
Call output
The tool returns a single text message.
On success:
Parquet:
OKCSV:
If
--csv-token-threshold = 0:OKIf
--csv-token-threshold > 0:OK N tokens(orOK N tokens. Too many tokens may impair processing. Handle appropriatelywhenN >= threshold)Empty result with counting enabled:
OK 0 tokens
On failure:
Error: <message>(any partial output file is deleted)
MCP Tool Specification
The server exposes a single MCP tool run_sql.
Argument | Type | Required | Description |
| string | yes | Path to a file that contains the SQL text to execute |
| string | yes | Destination file for the query result |
| enum | yes | One of |
| int | no | RecordBatch size (default |
Example Call
{
"tool": "run_sql",
"arguments": {
"sql_file": "sql/queries/sales.sql",
"output_path": "output/sales.parquet",
"output_format": "parquet",
"batch_size": 200000
}
}License
Distributed under the MIT License. See LICENSE for details.
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/gigamori/mcp-run-sql-connectorx'
If you have feedback or need assistance with the MCP directory API, please join our Discord server