by ClickHouse
Unlock powerful OLAP database analytics on ClickHouse MCP Server. Manage OLAP data with seamless online analytical proce
Connects to ClickHouse databases to execute SQL queries and retrieve results in JSON format. Enables data analysis and exploration through conversational interfaces.
ClickHouse is an official MCP server published by ClickHouse that provides AI assistants with tools and capabilities via the Model Context Protocol. Unlock powerful OLAP database analytics on ClickHouse MCP Server. Manage OLAP data with seamless online analytical proce It is categorized under databases.
You can install ClickHouse in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
Apache-2.0
ClickHouse is released under the Apache-2.0 license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
Enable Claude to query your database directly using natural language
Example
Ask 'Show me top 10 customers by revenue this month' and get SQL results instantly
Eliminate manual SQL writing for ad-hoc queries, get insights 10x faster
Generate complex reports and analytics without leaving conversation
Example
Analyze sales trends, cohort retention, user behavior patterns conversationally
Democratize data access—non-technical team members can query databases
Understand database structure, relationships, and data models
Example
'Explain the user_orders table schema and its relationships'
Onboard engineers faster, explore unfamiliar databases efficiently
Share your MCP server with the developer community
Useful MCP listing: ClickHouse is the kind of server we cite when onboarding engineers to host + tool permissions.
According to our notes, ClickHouse benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
Useful MCP listing: ClickHouse is the kind of server we cite when onboarding engineers to host + tool permissions.
I recommend ClickHouse for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
Strong directory entry: ClickHouse surfaces stars and publisher context so we could sanity-check maintenance before adopting.
We evaluated ClickHouse against two servers with overlapping tools; this profile had the clearer scope statement.
We wired ClickHouse into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
ClickHouse is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.
Strong directory entry: ClickHouse surfaces stars and publisher context so we could sanity-check maintenance before adopting.
I recommend ClickHouse for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
showing 1-10 of 72
An MCP server for ClickHouse.
<a href="https://glama.ai/mcp/servers/yvjy4csvo1"><img width="380" height="200" src="https://glama.ai/mcp/servers/yvjy4csvo1/badge" alt="mcp-clickhouse MCP server" /></a>
run_query
query (string): The SQL query to execute.CLICKHOUSE_ALLOW_WRITE_ACCESS=false), but writes can be enabled explicitly if needed.list_databases
list_tables
database (string).like / not_like (string): Apply LIKE or NOT LIKE filters to table names.page_token (string): Token returned by a previous call for fetching the next page.page_size (int, default 50): Number of tables returned per page.include_detailed_columns (bool, default true): When false, omits column metadata for lighter responses while keeping the full create_table_query.tables: Array of table objects for the current page.next_page_token: Pass this value back to fetch the next page, or null when there are no more tables.total_tables: Total count of tables that match the supplied filters.run_chdb_select_query
query (string): The SQL query to execute.When running with HTTP or SSE transport, a health check endpoint is available at /health. This endpoint:
200 OK with the ClickHouse version if the server is healthy and can connect to ClickHouse503 Service Unavailable if the server cannot connect to ClickHouseExample:
curl http://localhost:8000/health
# Response: OK - Connected to ClickHouse 24.3.1
When using HTTP or SSE transport, authentication is required by default. The stdio transport (default) does not require authentication as it only communicates via standard input/output.
Generate a secure token (can be any random string):
# Using uuidgen (macOS/Linux)
uuidgen
# Using openssl
openssl rand -hex 32
Configure the server with the token:
export CLICKHOUSE_MCP_AUTH_TOKEN="your-generated-token"
Configure your MCP client to include the token in requests:
For Claude Desktop with HTTP/SSE transport:
{
"mcpServers": {
"mcp-clickhouse": {
"url": "http://127.0.0.1:8000",
"headers": {
"Authorization": "Bearer your-generated-token"
}
}
}
}
For command-line tools:
curl -H "Authorization: Bearer your-generated-token" http://localhost:8000/health
For local development and testing only, you can disable authentication by setting:
export CLICKHOUSE_MCP_AUTH_DISABLED=true
WARNING: Only use this for local development. Do not disable authentication when the server is exposed to any network.
This MCP server supports both ClickHouse and chDB. You can enable either or both depending on your needs.
Open the Claude Desktop configuration file located at:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%/Claude/claude_desktop_config.jsonAdd the following:
{
"mcpServers": {
"mcp-clickhouse": {
"command": "uv",
"args": [
"run",
"--with",
"mcp-clickhouse",
"--python",
"3.10",
"mcp-clickhouse"
],
"env": {
"CLICKHOUSE_HOST": "<clickhouse-host>",
"CLICKHOUSE_PORT": "<clickhouse-port>",
"CLICKHOUSE_USER": "<clickhouse-user>",
"CLICKHOUSE_PASSWORD": "<clickhouse-password>",
"CLICKHOUSE_ROLE": "<clickhouse-role>",
"CLICKHOUSE_SECURE": "true",
"CLICKHOUSE_VERIFY": "true",
"CLICKHOUSE_CONNECT_TIMEOUT": "30",
"CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30"
}
}
}
}
Update the environment variables to point to your own ClickHouse service.
Or, if you'd like to try it out with the ClickHouse SQL Playground, you can use the following config:
{
"mcpServers": {
"mcp-clickhouse": {
"command": "uv",
"args": [
"run",
"--with",
"mcp-clickhouse",
"--python",
"3.10",
"mcp-clickhouse"
],
"env": {
"CLICKHOUSE_HOST": "sql-clickhouse.clickhouse.com",
"CLICKHOUSE_PORT": "8443",
"CLICKHOUSE_USER": "demo",
"CLICKHOUSE_PASSWORD": "",
"CLICKHOUSE_SECURE": "true",
"CLICKHOUSE_VERIFY": "true",
"CLICKHOUSE_CONNECT_TIMEOUT": "30",
"CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30"
}
}
}
}
For chDB (embedded ClickHouse engine), add the following configuration:
{
"mcpServers": {
"mcp-clickhouse": {
"command": "uv",
"args": [
"run",
"--with",
"mcp-clickhouse",
"--python",
"3.10",
"mcp-clickhouse"
],
"env": {
"CHDB_ENABLED": "true",
"CLICKHOUSE_ENABLED": "false",
"CHDB_DATA_PATH": "/path/to/chdb/data"
}
}
}
}
You can also enable both ClickHouse and chDB simultaneously:
{
"mcpServers": {
"mcp-clickhouse": {
"command": "uv",
"args": [
"run",
"--with",
"mcp-clickhouse",
"--python",
"3.10",
"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",
"CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30",
"CHDB_ENABLED": "true",
"CHDB_DATA_PATH": "/path/to/chdb/data"
}
}
}
}
Locate the command entry for uv and replace it with the absolute path to the uv executable. This ensures that the correct version of uv is used when starting the server. On a mac, you can find this path using which uv.
Restart Claude Desktop to apply the changes.
By default, this MCP enforces read-only queries so that accidental mutations cannot happen during exploration. To allow DDL or INSERT/UPDATE statements, set the CLICKHOUSE_ALLOW_WRITE_ACCESS environment variable to true. The server keeps enforcing read-only mode if the ClickHouse instance itself disallows writes.
Even when write access is enabled (CLICKHOUSE_ALLOW_WRITE_ACCESS=true), destructive operations (DROP TABLE, DROP DATABASE, DROP VIEW, DROP DICTIONARY, TRUNCATE TABLE) require an additional opt-in flag for safety. This prevents accidental data deletion during AI exploration.
To enable destructive operations, set both flags:
"env": {
"CLICKHOUSE_ALLOW_WRITE_ACCESS": "true",
"CLICKHOUSE_ALLOW_DROP": "true"
}
This two-tier approach ensures that accidental drops are very difficult:
CLICKHOUSE_ALLOW_WRITE_ACCESS=trueCLICKHOUSE_ALLOW_DROP=trueIf you prefer to use the system Python installation instead of uv, you can install the package from PyPI and run it directly:
Install the package using pip:
python3 -m pip install mcp-clickhouse
To upgrade to the latest version:
python3 -m pip install --upgrade mcp-clickhouse
Update your Claude Desktop configuration to use Python directly:
{
"mcpServers": {
"mcp-clickhouse": {
"command": "python3",
"args": [
"-m",
"mcp_clickhouse.main"
],
"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",
"CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30"
}
}
}
}
Alternatively, you can use the installed script directly:
{
"mcpServers": {
"mcp-clickhouse": {
"command": "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",
"CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30"
}
}
}
}
Note: Make sure to use the full path to the Python executable or the mcp-clickhouse script if they are not in your system PATH. You can find the paths using:
which python3 for the Python executablewhich mcp-clickhouse for the installed scriptYou can add custom middleware to the MCP server without modifying the source code. FastMCP provides a middleware system that allows you to intercept and process MCP protocol messages (tool calls, resource reads, pro
Run data quality queries to catch anomalies and inconsistencies
Example
Find duplicate records, missing values, orphaned foreign keys automatically
Maintain data integrity with less manual SQL work
Prerequisites
Time Estimate
15-30 minutes including configuration and testing
Steps
Troubleshooting
✓ Do
✗ Don't
💡 Pro Tips
Architecture
MCP server acts as bridge between Claude and database, translating natural language to SQL queries and returning results in structured format.
Protocols
Compatibility
✓ Use when
Use for ad-hoc data queries, exploratory analysis, report generation, schema exploration, and democratizing data access. Best for read-heavy analytics workloads.
✗ Avoid when
Avoid for production write operations, mission-critical transactions, real-time OLTP workloads, or when database contains sensitive PII without proper access controls. Use read replicas, not primary.