gigamori/mcp-run-sql-connectorx

๐Ÿ—„๏ธ Databases๐ŸŸข Verified Active
0 Views
0 Installs

๐Ÿ โ˜๏ธ ๐Ÿ  ๐ŸŽ ๐ŸชŸ ๐Ÿง - An MCP server that executes SQL via ConnectorX and streams the result to a CSV or Parquet file. Supports PostgreSQL, MariaDB, BigQuery, RedShift, MS SQL Server, etc.

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "gigamori-mcp-run-sql-connectorx": {
      "command": "npx",
      "args": [
        "-y",
        "gigamori-mcp-run-sql-connectorx"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

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: csv or parquet
  • 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 RecordBatch chunks
  • 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

For the complete and up-to-date list of supported databases and connection-token (conn) formats, see the official docs:

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> (default 0): when > 0, enable CSV per-line token counting using tiktoken(o200k_base); the value is a warning threshold

Further reading

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_size is 100 000 rows.
  • 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.writer writes (including header row when present, delimiters, quotes, and newlines), UTF-8
    • Streaming approach: tokenized with tiktoken(o200k_base) per written CSV line

Call output

The tool returns a single text message.

  • On success:
    • Parquet: OK
    • CSV:
      • If --csv-token-threshold = 0: OK
      • If --csv-token-threshold > 0: OK N tokens (or OK N tokens. Too many tokens may impair processing. Handle appropriately when N >= 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.

ArgumentTypeRequiredDescription
sql_filestringyesPath to a file that contains the SQL text to execute
output_pathstringyesDestination file for the query result
output_formatenumyesOne of "csv" or "parquet"
batch_sizeintnoRecordBatch size (default 100000)

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.

Related MCP Servers

modelcontextprotocol/server-postgresVerified

๐Ÿ“‡ ๐Ÿ  - PostgreSQL database integration with schema inspection and query capabilities

๐Ÿ—„๏ธ Databases1 views
Aiven-Open/mcp-aiven

๐Ÿ โ˜๏ธ ๐ŸŽ–๏ธ - Navigate your Aiven projects and interact with the PostgreSQLยฎ, Apache Kafkaยฎ, ClickHouseยฎ and OpenSearchยฎ services

๐Ÿ—„๏ธ Databases0 views
alexanderzuev/supabase-mcp-server

Supabase MCP Server with support for SQL query execution and database exploration tools

๐Ÿ—„๏ธ Databases0 views
aliyun/alibabacloud-tablestore-mcp-server

โ˜• ๐Ÿ โ˜๏ธ - MCP service for Tablestore, features include adding documents, semantic search for documents based on vectors and scalars, RAG-friendly, and serverless.

๐Ÿ—„๏ธ Databases0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Active

Recent health check succeeded.

Last checked: 7/29/2026, 12:28:53 PM

Unclaimed listing (imported or pending owner verification). Claim it โ†’
โ˜… Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.