QueryPilot logo

QueryPilot

Read-only MCP tools for validating, governing, and executing SQL across SQLAlchemy-compatible databases.

Install QueryPilot

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "querypilot": {
      "command": "uvx",
      "args": [
        "--from",
        "querypilot[mcp]",
        "querypilot"
      ],
      "env": {
        "QUERYPILOT_DATABASE_URL": "YOUR_VALUE_HERE",
        "OPENAI_API_KEY": "YOUR_VALUE_HERE",
        "ANTHROPIC_API_KEY": "YOUR_VALUE_HERE",
        "QUERYPILOT_PROXY_PASS": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Claude Code command
claude mcp add --env QUERYPILOT_DATABASE_URL=YOUR_VALUE_HERE --env OPENAI_API_KEY=YOUR_VALUE_HERE --env ANTHROPIC_API_KEY=YOUR_VALUE_HERE --env QUERYPILOT_PROXY_PASS=YOUR_VALUE_HERE --transport stdio querypilot -- uvx --from 'querypilot[mcp]' querypilot

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We hit an unexpected error while testing this listing automatically.

uvx --from querypilot[mcp] querypilot

Rate limit exceeded, please try again later - you have reached the maximum number of concurrent E2B sandboxes (20). If you need more, please visit 'https://e2b.dev/docs/billing'

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

The QueryPilot MCP server gives AI agents read-only, policy-checked tools for SQLAlchemy-compatible databases. It introspects live schemas, validates one-statement SELECT queries with sqlglot, applies access controls, and returns compact JSON with repair hints. Use it when an agent needs database answers without unrestricted SQL writes or incomplete schema context. An optional streamable HTTP mode and Postgres proxy extend the same controls to other clients.

Use cases

  • Expose governed database queries to an AI agent
  • Inspect live schemas before generating SQL
  • Block write statements and dangerous database functions
  • Return repair hints for invalid generated queries
  • Audit PostgreSQL statements from database clients

Key features

  • SELECT-only SQL validation
  • Schema discovery and search
  • Row filters and result masking
  • Read-only execution controls
  • Structured errors with SQL hints
  • Optional PostgreSQL proxy and audit log

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

13/13 checks healthy over the last 57d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 4d ago via OSV.dev · querypilot (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars3Stargazers on the source repository.
Last commit14d agoMost recent push to the default branch.
Install checkInconclusiveWe hit an unexpected error running the automated check.

How QueryPilot works

What QueryPilot MCP server does

The QueryPilot MCP server places a controlled SQL layer between an AI agent and a database. It supports SQLAlchemy database URLs and engines, including SQLite, PostgreSQL, DuckDB, MySQL/MariaDB, SQL Server, Snowflake, BigQuery, Redshift, Trino, Oracle, and Databricks when the corresponding driver extra is installed.

The server exposes schema discovery, SQL validation, query execution, and optional natural-language database questions. Queries are restricted to one statement and SELECT operations. Validation checks tables and columns against the connected schema, identifies some engine-specific dangerous functions, and can return suggestions for misspelled identifiers. Execution adds database-specific read-only protections, transaction rollback, row limits, and statement timeouts where supported.

Policies can control which tables and views are visible, filter rows, cap result sizes, and mask returned values. The Postgres proxy also records JSONL audit entries containing the client SQL, executed SQL, row count, user, and application. An evaluation harness is included for checking whether generated SQL is correct and remains correct over time.

How it works

On connection, QueryPilot infers the SQL dialect from the URL and inspects tables, views, keys, comments, and related schema information. Agents can first search or inspect that metadata, then validate generated SQL before execution. Validation errors are returned as structured results rather than exceptions, with hints that help an agent revise its query.

The MCP tool set includes list_tables, describe_table, search_schema, validate_sql, run_sql, and ask_database. The last tool requires a configured model generator. Results use compact JSON and include a truncation indicator when max_rows limits the response.

The QueryPilot MCP server can run through stdio or streamable HTTP. The same toolkit can also be exposed to OpenAI and Anthropic tool-calling APIs, LangChain, LlamaIndex, OpenAI Agents, the Claude Agent SDK, and integrations that consume typed functions. For PostgreSQL, the prototype proxy applies validation and policy enforcement to clients such as psql, database drivers, BI tools, and other database-facing MCP servers.

Setup and configuration

Install the package from PyPI with pip install querypilot. Running querypilot demo creates a small SQLite database and demonstrates a permitted query alongside a blocked write. For a real database, querypilot init --db <DATABASE_URL> creates querypilot.yaml with the connection, business hints, column descriptions, and access policy. Commands, the MCP server, and QueryPilot.from_config() can read this configuration.

Use querypilot mcp-config for supported client configuration output, including Claude Code and Cursor. The generated setup uses an absolute uvx path; --runner python can launch the current environment instead. Streamable HTTP is available with querypilot mcp --transport streamable-http --port 8000.

Database drivers are included for SQLite and PostgreSQL. Other engines require their documented extras, such as querypilot[duckdb], querypilot[mysql], or the relevant warehouse or driver extra. Natural-language ask generation can use OpenAI or Anthropic when the corresponding API key is present, an OpenAI-compatible endpoint for Ollama, vLLM, or LM Studio, or an offline demo generator when no key is configured.

Tools and capabilities

  • Discover permitted tables, views, comments, columns, types, keys, and sample values.
  • Search schema metadata for tables and columns related to a question.
  • Validate and rewrite SQL with dialect-aware checks and correction hints.
  • Execute validated SELECT statements with compact rows and truncation status.
  • Convert natural-language questions into validated SQL when a generator is configured.
  • Apply row filters, masking rules, maximum row limits, read-only transactions, and audit logging where the selected mode supports them.

Limitations and notes

QueryPilot is read-only by design for agent SQL operations; writes, DDL, and other rejected statements cannot be used through the normal validated path. Some database protections depend on engine support, so a read-only database role is recommended for warehouses without a read-only session mode. The Postgres proxy is identified as a prototype. Additional database backends may require installing their specific package extras and drivers.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about QueryPilot

QueryPilot is an MCP server that connects AI agents to SQLAlchemy-compatible databases through read-only, policy-checked tools. Its main tools list tables, describe tables, search schemas, validate SQL, run SQL, and optionally answer natural-language database questions with a configured model generator.

Install it with `pip install querypilot`, then configure a database with `querypilot init --db <DATABASE_URL>` or pass a database URL directly. Use `querypilot mcp-config` to generate client configuration, or run the MCP server with the documented command.

QueryPilot supports SQLAlchemy-compatible connections including SQLite, PostgreSQL, DuckDB, MySQL/MariaDB, SQL Server, Snowflake, BigQuery, Redshift, Trino, Oracle, and Databricks. Several backends require installing the matching package extra and database driver.

Yes, QueryPilot works with Cursor through generated MCP configuration. Run `querypilot mcp-config cursor --db <DATABASE_URL>` to print the `mcpServers` configuration block, then add it to Cursor.

No, the validated SQL path permits SELECT statements only. QueryPilot rejects writes and other disallowed statements, while execution uses read-only protections and rolls back every query transaction.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewQueryPilot AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/querypilot?style=directory)](https://allmcps.com/mcp/querypilot)
HTML Embed
<a href="https://allmcps.com/mcp/querypilot"><img src="https://allmcps.com/api/badge/querypilot?style=directory" alt="QueryPilot on AllMCPs" /></a>