An MCP server that exposes ClickHouse through Model-Context-Protocol (MCP) with tools for running read-only SQL queries and listing databases/tables.
https://github.com/ClickHouse/mcp-clickhouseYou've got terabytes of analytics data in ClickHouse, but every time you want AI insights, you're back to the same tedious workflow: craft queries, export results, clean up the data, then paste it into Claude. What if your AI could just query your database directly?
Most developers end up building janky workflows around their analytics databases. You write a query, dump it to CSV, massage the format, upload to Claude, then repeat when you need slightly different data. It's 2024 and we're still manually shuttling data between systems like it's 1999.
Meanwhile, your ClickHouse cluster is sitting there with all the context your AI needs – real-time metrics, user behavior data, performance logs – but there's this massive friction barrier preventing natural conversation about your data.
This MCP server creates a direct bridge between Claude (or any MCP-compatible AI) and your ClickHouse database. Three simple tools that change everything:
run_select_query
- Execute any SQL query directly from Claudelist_databases
- Explore your data structure without switching contextslist_tables
- Discover available tables and their schemasAll queries run with readonly = 1
, so your AI can explore freely without breaking anything.
Performance debugging: "Claude, show me the slowest queries from the last hour where response_time > 2000ms" - no more manual log exports or dashboard screenshots.
Business intelligence: "What's our conversion rate by traffic source this week compared to last month?" Claude can join your events and users tables directly, then interpret the results in context.
Data exploration: Instead of writing exploratory queries in your ClickHouse client then explaining the results to Claude, just have the conversation directly. "What patterns do you see in our user engagement data?"
Alert investigation: When something's wrong, Claude can immediately query relevant tables, correlate metrics, and suggest root causes without you manually gathering data first.
The setup is refreshingly straightforward. Add this to your Claude Desktop config:
{
"mcpServers": {
"mcp-clickhouse": {
"command": "uv",
"args": ["run", "--with", "mcp-clickhouse", "--python", "3.13", "mcp-clickhouse"],
"env": {
"CLICKHOUSE_HOST": "your-host",
"CLICKHOUSE_USER": "your-user",
"CLICKHOUSE_PASSWORD": "your-password"
}
}
}
}
Want to try it first? Point it at ClickHouse's SQL playground:
{
"env": {
"CLICKHOUSE_HOST": "sql-clickhouse.clickhouse.com",
"CLICKHOUSE_USER": "demo",
"CLICKHOUSE_PASSWORD": ""
}
}
Restart Claude Desktop and you're ready. No additional infrastructure, no API keys, no complex authentication flows.
Official support: Built and maintained by the ClickHouse team, so you know it follows best practices and stays current with ClickHouse features.
Safety first: Read-only queries mean your AI can't accidentally modify data, even if you give it broad permissions.
Real ClickHouse integration: Uses the official clickhouse-connect driver with proper connection pooling, SSL support, and timeout handling.
Zero-dependency deployment: Uses uv
for isolated Python execution - no virtual environment management or conflicting dependencies.
Flexible connection options: Works with ClickHouse Cloud, self-hosted clusters, or local Docker instances with the same config pattern.
Stop treating your database like a fortress that AI can't access. With 390+ stars and official ClickHouse backing, this MCP server is becoming the standard way to connect analytics databases to AI workflows.
Your data is already structured and queryable. Your AI is already capable of complex analysis. This server just removes the friction between them.
Quick links: