Skip to main content

duckquery-mcp

An MCP server that exposes a locally-running DuckQuery backend to MCP clients (Claude Code, Cursor, Codex). Start DuckQuery first (desktop app, Docker, or uvicorn main:app --port 48001); this server auto-discovers it.

Run

uvx duckquery-mcp            # zero-install
# or: pipx run duckquery-mcp

Env:

  • DUCKQUERY_API_BASE — explicit backend URL (e.g. http://127.0.0.1:48001). Optional; auto-discovered otherwise (runtime.json, then probes 48001/8000/8001).
  • DUCKQUERY_MCP_MODE — read-only | normal (default) | full.

Add to a CLI

Claude Code:

claude mcp add duckquery -- uvx duckquery-mcp

Cursor / Codex (mcp.json):

{
  "mcpServers": {
    "duckquery": {
      "command": "uvx",
      "args": ["duckquery-mcp"],
      "env": { "DUCKQUERY_MCP_MODE": "normal" }
    }
  }
}

Claude Desktop — add the same mcpServers block to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json, Windows: %APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "duckquery": {
      "command": "uvx",
      "args": ["duckquery-mcp"]
    }
  }
}

Tools

MCP package version 0.4.0 adds get_capabilities. Call it before emitting DuckDB 2.0-specific SQL: it reports engine support separately from direct SQL, Agent, and MCP policy support. run_sql and federated_query use the backend's fail-closed SQL classification when available and retain a conservative local fallback for older DuckQuery backends.

The 0.4.0 wheel is attached to the DuckQuery v2.0.0 prerelease. PyPI still serves 0.3.1, so the unpinned uvx duckquery-mcp command below remains on 0.3.1 until a trusted PyPI publishing channel is configured.

High-level tools (query, the AI agent tools below, discover, add sources, configure LLM, transform, export) plus a generic duckquery_request passthrough. Safety mode gates which tools are exposed:

The AI tools all call the backend's unified Agent Engine (POST /api/ai/agent/run, one thin tool per mode), replacing the removed single-purpose LLM services:

  • ask_agent (mode=data_qa) — conversational data agent. Runs bounded, read-only probe queries — inspecting schemas, verifying real column values, and dry-running row-capped SELECTs — over local tables and, when you pass attach_databases, attached MySQL/PostgreSQL/SQLite/DuckDB tables, before answering. Any returned sql is a draft; the agent never executes writes.
  • generate_sql (mode=generate_sql) — NL → an EXPLAIN-validated SQL draft (not executed).
  • repair_sql (mode=repair_sql) — error doctor: failing SQL + error → a fix.
  • explain_sql (mode=explain_sql) — plain-language explanation of a statement.
  • suggest_chart (mode=suggest_chart) — a chart spec for a result set.

All five are read-tier tools — exposed in every safety mode — and never execute writes.

  • read-only — hides all mutating tools; non-GET duckquery_request calls are hard-blocked (confirm cannot override).
  • normal (default) — mutating tools are exposed, but changing tables, saving connections, importing data, running mutating SQL, and non-GET duckquery_request calls each require confirm=true.
  • full — bypasses the MCP confirmation gates above; backend safeguards still apply.

The AI-settings tools (configure_llm, test_llm_provider) are write-tier: hidden in read-only, and in normal mode they take the same confirm=true parameter as every other write tool.

Metadata

Release files for duckquery-mcp 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for duckquery-mcp 0.4.0
File Size Uploaded
duckquery_mcp-0.4.0.tar.gz 91.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for duckquery-mcp 0.4.0
File Interpreter ABI Platform
duckquery_mcp-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 112.3 kB

Release files / duckquery_mcp-0.4.0.tar.gz

Download URL duckquery_mcp-0.4.0.tar.gz
Size 91.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3be90e89d7c602cfebd7e33cda0f9527a0f3821ec6bba96bb3e6e0bc1caa6f74
BLAKE2b-256 checksum
How to use checksums
69f8ce3e2191c093d7d182506e520d4c99c113ba0c958215e7518de62cf02404
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / duckquery_mcp-0.4.0-py3-none-any.whl

Download URL duckquery_mcp-0.4.0-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6bd498eb650e8ad4ef1d0bdb3cc64206f1c9374c9e8b68b6596862727904ea5a
BLAKE2b-256 checksum
How to use checksums
6c3174e9398825631eb11dd8c94b5e1f105a3dcc9ea0487a38f2a1eadad8aa40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page