▌BestMCPTools.org
ClickHouse MCP logo

ClickHouse MCP

Official ClickHouse server for read-only SQL, schema discovery and chDB

DatabaseOpen SourceClaude CodeClaude DesktopCursorWindsurfCodexChatGPTMedium✓ Verified

Last verified: October 20, 2026

Own ClickHouse MCP? Boost it to the top.✦ Upgrade to Featured

Maintenance status

Active
Last code update: October 15, 2026License: Apache-2.0Checked October 20, 2026

Release 0.7.0 on PyPI, September 2026.

How to Install ClickHouse MCP

$uv run --with mcp-clickhouse --python 3.12 mcp-clickhouse

Compatible with: Claude Code, Claude Desktop, Cursor, Windsurf, Codex, ChatGPT.

About ClickHouse MCP

What it does

ClickHouse MCP is ClickHouse's official open source MCP server. It lets an AI assistant list databases and tables, inspect schemas and run SQL against a ClickHouse cluster, with read-only queries as the default. You run it yourself over stdio or HTTP, and ClickHouse Cloud users can also connect to a separate managed remote server. For a wider comparison, see our list of the best database MCP servers.

Key features and tools

The open source server exposes four tools:

  • run_query: runs a SQL query, with optional params for ClickHouse {name:Type} placeholders. It also accepts DESCRIBE (<query>) to check a result schema and EXPLAIN ESTIMATE <query> to see estimated parts, rows and marks before a large SELECT.
  • list_databases: lists every database on the cluster.
  • list_tables: lists tables in a database with pagination, like and not_like filters, a page_size that defaults to 50, and an option to drop column details for lighter responses.
  • run_chdb_select_query: runs SQL on the embedded chDB engine, which can query files, URLs and other sources directly. It needs the optional chdb extra.

Other features worth knowing:

  • Read-only by default. Queries run with the ClickHouse readonly=1 setting unless you opt in to writes.
  • Two-step write gate. CLICKHOUSE_ALLOW_WRITE_ACCESS=true allows inserts and non-destructive DDL. DROP, TRUNCATE, DELETE, UPDATE and similar statements also need CLICKHOUSE_ALLOW_DROP=true.
  • Three transports. stdio is the default, http serves the MCP endpoint at /mcp, and sse is still available but deprecated.
  • Auth for network mode. HTTP and SSE need a static bearer token (CLICKHOUSE_MCP_AUTH_TOKEN), a FastMCP OAuth or OIDC provider, or an explicit CLICKHOUSE_MCP_AUTH_DISABLED=true meant for local development only. Startup fails if none of these is set.
  • Health check. In HTTP mode, /health returns OK when ClickHouse is reachable and 503 when it is not.
  • TLS options. Private CA bundles and client certificates are supported through CLICKHOUSE_CA_CERT, CLICKHOUSE_CLIENT_CERT, CLICKHOUSE_CLIENT_CERT_KEY and CLICKHOUSE_TLS_MODE.
  • Custom middleware. MCP_MIDDLEWARE_MODULE loads your own module to hook into requests.

Setup

The README launches the server with uv, using Python 3.12:

{
  "mcpServers": {
    "mcp-clickhouse": {
      "command": "uv",
      "args": ["run", "--with", "mcp-clickhouse", "--python", "3.12", "mcp-clickhouse"],
      "env": {
        "CLICKHOUSE_HOST": "<clickhouse-host>",
        "CLICKHOUSE_PORT": "<clickhouse-port>",
        "CLICKHOUSE_USER": "<clickhouse-user>",
        "CLICKHOUSE_PASSWORD": "<clickhouse-password>",
        "CLICKHOUSE_SECURE": "true",
        "CLICKHOUSE_VERIFY": "true",
        "CLICKHOUSE_CONNECT_TIMEOUT": "30"
      }
    }
  }
}

You can also install it with python3 -m pip install mcp-clickhouse, or 'mcp-clickhouse[chdb]' for chDB support, and run python3 -m mcp_clickhouse.main. Python 3.10 is the supported minimum.

CLICKHOUSE_HOST, CLICKHOUSE_USER and CLICKHOUSE_PASSWORD are required. The port defaults to 8443 with TLS and 8123 without, and the server talks to ClickHouse over HTTP only, so the native ports 9000 and 9440 are not supported. For a self-managed server on plain HTTP, set CLICKHOUSE_SECURE=false. ClickHouse publishes setup guides for Claude Code, Claude Desktop, Codex, ChatGPT, Cursor and Windsurf, plus many agent frameworks.

Remote MCP server in ClickHouse Cloud

ClickHouse Cloud also runs a managed server at https://mcp.clickhouse.cloud/mcp over Streamable HTTP. It authenticates with OAuth 2.0 or a ClickHouse Cloud API key, and every tool it exposes is read-only. You enable it per service from the console under Connect, then MCP. Its 13 tools cover queries and schema (run_select_query, list_databases, list_tables), organizations, services, backups, ClickPipes and organization cost.

Use cases

  • Ask questions of large analytical tables in plain English and get SQL back
  • Explore an unfamiliar schema before writing a dashboard or report
  • Check a heavy query's estimated reads with EXPLAIN ESTIMATE before running it
  • Query local files or URLs with chDB without loading them into a cluster first
  • Give a Cloud team read-only access to service, backup and cost details through the remote server

Limitations and things to watch

  • The write gate is not a security boundary. The README says the destructive operation check is a best-effort guard against accidents. Real enforcement comes from the ClickHouse user's grants, so give the server a dedicated user with only the privileges it needs.
  • Read-only users can still cancel queries. In read-only mode the ClickHouse user can cancel its own queries, including those from other connections using the same user.
  • Network mode needs care. HTTP and SSE open a listener. The default bind host is 127.0.0.1, and setting it to 0.0.0.0 exposes the server on every network interface. The /health endpoint is unauthenticated by design.
  • Timeouts. Queries time out after 30 seconds by default (CLICKHOUSE_MCP_QUERY_TIMEOUT).
  • Tools can change. ClickHouse's MCP overview notes that the tools the server exposes may vary by version.
  • Remote server is read-only. The Cloud server cannot write data, and enabling it needs the control-plane:service:manage-mcp permission.

Pros and cons

Pros

  • Official, Apache 2.0 licensed and actively released (0.7.0 in September 2026)
  • Read-only by default with a separate opt-in for destructive SQL
  • Works with ClickHouse Cloud, self-managed clusters and embedded chDB
  • stdio, HTTP and OAuth options for local or shared deployments
  • Managed read-only remote server for ClickHouse Cloud with OAuth

Cons

  • Needs uv or Python plus connection credentials, so setup takes a few more steps than a single npx command
  • Small tool set focused on querying, with no management tools in the open source server
  • No native protocol support, HTTP ports only

Who it is for

ClickHouse MCP fits data engineers and analysts who already run ClickHouse and want an assistant to explore schemas and write analytical SQL. The read-only default makes it a safe first connection to a production cluster, as long as the ClickHouse user is locked down. Cloud customers who want no local install can use the remote server instead. More options sit in the database category.

Pricing

As of October 2026 the open source server is free under the Apache 2.0 license. Self-managed ClickHouse and chDB add no license cost. ClickHouse Cloud is usage-based. In the N. Virginia region, storage is $25.30 per TB per month and compute starts at $0.2181 per unit per hour on Basic, $0.2985 on Scale and $0.3903 on Enterprise. New organizations get $300 in trial credits valid for 30 days.

Alternatives

Sources

See also how to connect Mixpanel to Claude for asking questions about product events.

Pricing

Open Source: from Free (open source); ClickHouse Cloud usage-based with $300 trial credits (as of October 2026)

Our Take on ClickHouse MCP

ClickHouse MCP is a focused, well maintained server for analytical SQL: four tools, read-only queries by default, a second opt-in before any destructive statement, and stdio, HTTP or OAuth deployment. It is not a management tool, and the README is clear that the write gate is a guard against accidents, not a security boundary, so pair it with a locked-down ClickHouse user. Cloud customers can skip the install and use the read-only remote server, while warehouse teams on other platforms should compare Snowflake MCP server.

Alternatives to ClickHouse MCP

Databricks MCPDatabase

Query Unity Catalog, run notebooks and inspect jobs from an AI agent.

View Databricks MCP →
BigQuery MCPDatabase

Natural-language querying over Google BigQuery datasets.

View BigQuery MCP →
Snowflake MCPDatabase

Query and analyze Snowflake data warehouses with natural language

View Snowflake MCP →

Frequently Asked Questions

Tags