ClickHouse
Lets your AI agent run SQL queries, list databases and tables on ClickHouse, and query data with chDB.
903 stars on GitHubby ClickHouseLicense Apache-2.0Updated 19 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add clickhouse -e CLICKHOUSE_HOST="<your value>" -e CLICKHOUSE_USER="<your value>" -- uvx mcp-clickhouse
What to fill in
| Name | What it is | Required |
|---|---|---|
CLICKHOUSE_HOST | Hostname of the ClickHouse server | Yes |
CLICKHOUSE_USER | Username for ClickHouse authentication | Yes |
CLICKHOUSE_PASSWORD | Password for ClickHouse authentication. Required unless a client certificate uses the default or mutual TLS mode | No |
CLICKHOUSE_PORT | ClickHouse HTTP(S) port. Defaults to 8443 when CLICKHOUSE_SECURE=true, 8123 otherwise | No |
CLICKHOUSE_SECURE | Use HTTPS to connect to ClickHouse | No |
CLICKHOUSE_VERIFY | Verify SSL certificates | No |
CLICKHOUSE_CA_CERT | Path to a PEM CA bundle for ClickHouse server certificate verification | No |
CLICKHOUSE_CLIENT_CERT | Path to a PEM client certificate for the ClickHouse HTTPS connection | No |
CLICKHOUSE_CLIENT_CERT_KEY | Path to the PEM private key for CLICKHOUSE_CLIENT_CERT | No |
CLICKHOUSE_TLS_MODE | Client certificate mode: mutual, proxy, or strict | No |
CLICKHOUSE_DATABASE | Default database to use | No |
CLICKHOUSE_ROLE | ClickHouse role to activate for the session | No |
CLICKHOUSE_ALLOW_WRITE_ACCESS | Allow write operations (DDL and DML). Queries run read-only by default | No |
CLICKHOUSE_ALLOW_DROP | Allow destructive operations (DROP, TRUNCATE, DELETE, UPDATE, REPLACE, CLEAR, and DETACH PERMANENTLY) when write access is also enabled | No |
CLICKHOUSE_MCP_QUERY_TIMEOUT | Query tool timeout in seconds | No |
CLICKHOUSE_MCP_MAX_WORKERS | Maximum query worker thread pool size | No |
Ready! Now test it
Restart the app and paste one of these requests in the chat:
List the databases and tables on my ClickHouse cluster.
How many events per day did we get in the last 30 days?
What it is
This is the official MCP server for ClickHouse. It lets your agent explore a ClickHouse cluster and run queries, in read-only mode by default. It can also use chDB, an embedded ClickHouse engine, to query files and URLs directly.
What it can do
run_query: run SQL on your ClickHouse cluster, with optional parameterslist_databases: list all databaseslist_tables: list tables in a database, with filters and pagingrun_chdb_select_query: run SQL with chDB on files, URLs or databases- DESCRIBE and EXPLAIN ESTIMATE can be run through run_query to check a query first
When to use
- βΊWhen you want your agent to explore a ClickHouse database and write queries
- βΊWhen you want to estimate how much data a query would read before running it
- βΊWhen you want to query a file or URL directly without loading it first
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
clickhouse-ioHelps your agent optimize queries and schemas in ClickHouse databases. It applies best practices for high-performance analytical workloads. Use when analytical queries are too slow.cc-skill-clickhouse-ioHas your agent optimize the use of the ClickHouse database. It understands query patterns and data engineering. It's useful for high-performance analytical workloads.sql-database-assistantHelps your agent write and speed up SQL queries, explore a database schema, and create migrations for common database tools.Frequently asked questions
Is it free and open source?
The readme does not state a license or price. The project is on PyPI and GitHub.
Can it write to my database?
Not by default. Queries run read-only unless you set CLICKHOUSE_ALLOW_WRITE_ACCESS to true.
Does it need authentication?
Over stdio no. For HTTP or SSE you must set a static bearer token, OAuth through FastMCP, or explicitly disable auth for local development.
What is chDB?
An embedded ClickHouse engine. It lets you query files, URLs and databases without an ETL step.
Is there a health check?
Yes. With HTTP or SSE transport, /health returns 200 OK if the server can connect to ClickHouse.
Are big numbers handled safely?
Integers outside the safe JavaScript range come back as decimal strings to keep exact values.
If it does not work
- βΊCheck your ClickHouse host and credentials in the server settings.
- βΊIf HTTP or SSE startup fails, set CLICKHOUSE_MCP_AUTH_TOKEN (or another auth mode).
- βΊFor chDB tools, install the extra with pip install 'mcp-clickhouse[chdb]'.
5 new skills a week. 1 minute to read.