ClickHouse
MCP server by ClickHouse Community
Official MCP server from ClickHouse for querying and exploring ClickHouse clusters and the embedded chDB engine. Aimed at developers and data teams who want an AI assistant to run SQL and browse schemas.
Install ClickHouse
Built from the published package, never by AI.
claude mcp add clickhouse -e CLICKHOUSE_HOST=YOUR_CLICKHOUSE_HOST -e CLICKHOUSE_USER=YOUR_CLICKHOUSE_USER -- uvx mcp-clickhouseRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"clickhouse": {
"env": {
"CLICKHOUSE_HOST": "YOUR_CLICKHOUSE_HOST",
"CLICKHOUSE_USER": "YOUR_CLICKHOUSE_USER"
},
"args": [
"mcp-clickhouse"
],
"command": "uvx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"clickhouse": {
"env": {
"CLICKHOUSE_HOST": "YOUR_CLICKHOUSE_HOST",
"CLICKHOUSE_USER": "YOUR_CLICKHOUSE_USER"
},
"args": [
"mcp-clickhouse"
],
"command": "uvx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"clickhouse": {
"env": {
"CLICKHOUSE_HOST": "YOUR_CLICKHOUSE_HOST",
"CLICKHOUSE_USER": "YOUR_CLICKHOUSE_USER"
},
"args": [
"mcp-clickhouse"
],
"command": "uvx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add clickhouse --env CLICKHOUSE_HOST=YOUR_CLICKHOUSE_HOST --env CLICKHOUSE_USER=YOUR_CLICKHOUSE_USER -- uvx mcp-clickhouse{
"mcpServers": {
"clickhouse": {
"env": {
"CLICKHOUSE_HOST": "YOUR_CLICKHOUSE_HOST",
"CLICKHOUSE_USER": "YOUR_CLICKHOUSE_USER"
},
"args": [
"mcp-clickhouse"
],
"command": "uvx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
gemini mcp add clickhouse uvx mcp-clickhouseGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the clickhouse block.
About
The ClickHouse MCP server gives AI assistants tools to run SQL queries on a ClickHouse cluster, list databases, and list tables with pagination. Queries run in read-only mode by default, and writes can be enabled explicitly. The server also offers a chDB tool that runs queries through chDB's embedded ClickHouse engine, which can read data from files, URLs and databases without a separate ETL step.
The server supports MCP protocol versions from 2024-11-05 through 2026-07-28. It includes a health check endpoint for HTTP and SSE transports and requires authentication for those transports by default. The source describes it for developers and data teams who want an assistant to explore ClickHouse schemas, check queries before running them, and analyze data.
Written from the project's README and checked against it.
Tools it gives your assistant
run_queryExecutes SQL queries on the ClickHouse cluster, with optional named parameters.list_databasesLists all databases on the ClickHouse cluster.list_tablesLists tables in a database with pagination and LIKE filters on table names.run_chdb_select_queryExecutes SQL queries using chDB's embedded ClickHouse engine.
What you need
- A ClickHouse cluster
- Python, with pip to install mcp-clickhouse
- Optional chdb extra for the chDB tool
- Bearer token or OAuth provider for HTTP or SSE transport
| Setting | Needed | What it is |
|---|---|---|
CLICKHOUSE_Environment variable | Required | Hostname of the ClickHouse server |
CLICKHOUSE_Environment variable | Required | Username for ClickHouse authentication |
CLICKHOUSE_Environment variable, secret | Optional | Password for ClickHouse authentication. Required unless a client certificate uses the default or mutual TLS mode |
CLICKHOUSE_Environment variable | Optional | ClickHouse HTTP(S) port. Defaults to 8443 when CLICKHOUSE_SECURE=true, 8123 otherwise |
CLICKHOUSE_Environment variable | Optional | Use HTTPS to connect to ClickHouse Default: true |
CLICKHOUSE_Environment variable | Optional | Verify SSL certificates Default: true |
CLICKHOUSE_Environment variable | Optional | Path to a PEM CA bundle for ClickHouse server certificate verification |
CLICKHOUSE_Environment variable | Optional | Path to a PEM client certificate for the ClickHouse HTTPS connection |
CLICKHOUSE_Environment variable | Optional | Path to the PEM private key for CLICKHOUSE_CLIENT_CERT |
CLICKHOUSE_Environment variable | Optional | Client certificate mode: mutual, proxy, or strict |
CLICKHOUSE_Environment variable | Optional | Default database to use |
CLICKHOUSE_Environment variable | Optional | ClickHouse role to activate for the session |
CLICKHOUSE_Environment variable | Optional | Allow write operations (DDL and DML). Queries run read-only by default Default: false |
CLICKHOUSE_Environment variable | Optional | Allow destructive operations (DROP, TRUNCATE, DELETE, UPDATE, REPLACE, CLEAR, OPTIMIZE DEDUPLICATE, MODIFY/MATERIALIZE TTL, MODIFY/ALTER COLUMN with TTL, and DETACH PERMANENTLY) when write access is also enabled Default: false |
CLICKHOUSE_Environment variable | Optional | Query tool timeout in seconds Default: 30 |
CLICKHOUSE_Environment variable | Optional | Maximum query worker thread pool size Default: 10 |
From the publisher's entry in the official MCP Registry. Required settings are already in the install config below as placeholders.
Try asking
- List all databases on my ClickHouse cluster
- Show the tables in the sales database that start with orders
- Run a query that totals revenue by month from the events table
Good to know
- Queries run in read-only mode by default, and writes must be enabled explicitly.
- HTTP and SSE transports require authentication unless it is disabled.
- EXPLAIN ESTIMATE covers only MergeTree family tables.
- Parameter values can appear in ClickHouse system logs.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: README.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to ClickHouse
All alternatives →Connects Supabase projects to AI assistants such as Cursor, Claude and Windsurf over the Model Context Protocol. It lets assistants manage tables, fetch config and query data in a Supabase project.
ArcadeDB MCP Server is the built-in Model Context Protocol server of the ArcadeDB multi-model database. It lets AI assistants and LLMs work with ArcadeDB's graph, document, time-series, vector and other data models. It suits people who already run ArcadeDB and want assistant access to it.
Connects MCP clients such as Claude Desktop, Cursor and VS Code to PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, ClickHouse and SQLite. It exposes two tools by default, with read-only mode and query timeouts available as guardrails.
MCP Toolbox for Databases is an open source MCP server that connects AI agents, IDEs and applications to enterprise databases. It provides prebuilt tools for exploring schemas and running queries, plus a framework for custom tools. It is aimed at developers building agents that need database access.
Connects AI agents, IDEs and applications to enterprise databases through the Model Context Protocol. Offers prebuilt database tools for MCP clients and a framework for building custom tools for production agents.
MongoDB MCP Server lets AI assistants interact with MongoDB databases and MongoDB Atlas. It is an official server from mongodb-js, run locally with npx or Docker. It works with self-managed deployments and Atlas clusters.
Compare with Supabase, ArcadeDB MCP Server or DBHub
ClickHouse: common questions
Can the assistant change data with this server?
Queries run in read-only mode by default. The source says writes can be enabled explicitly through CLICKHOUSE_ALLOW_WRITE_ACCESS.
What authentication options does it support for HTTP or SSE?
The source lists a static bearer token, OAuth or OIDC through FastMCP providers, or disabling authentication for local development. Startup fails if none is configured for HTTP or SSE.
Does it work with chDB without a ClickHouse cluster?
The source describes run_chdb_select_query as using chDB's embedded engine, which queries files, URLs and databases directly. It requires the optional chdb extra to be installed.
How do I install ClickHouse?
In Claude Code run claude mcp add clickhouse -e CLICKHOUSE_HOST=YOUR_CLICKHOUSE_HOST -e CLICKHOUSE_USER=YOUR_CLICKHOUSE_USER -- uvx mcp-clickhouse. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is ClickHouse the official server?
ClickHouse is a community project by ClickHouse, not verified by a company domain.
Is ClickHouse free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is ClickHouse safe to use?
It scores 87 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to ClickHouse?
Similar MCP servers: Supabase, ArcadeDB MCP Server, DBHub, MCP Toolbox for Databases.
Does ClickHouse work with ChatGPT?
Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.
