Execute SQL queries on your ClickHouse cluster. All queries are run with readonly=1 for safety.
List all databases on your ClickHouse cluster.
List all tables in a database.
ClickHouse MCP provides a seamless interface between Claude and your ClickHouse database instances. It allows you to execute SQL queries, explore database schemas, and analyze data directly within your conversations. With this integration, you can leverage Claude's natural language capabilities to help you craft queries, analyze results, and gain insights from your ClickHouse data without switching contexts. The MCP ensures all queries are executed in read-only mode for security, making it safe to use with production databases.
The ClickHouse MCP server enables Claude to connect directly to your ClickHouse database instances, allowing you to query data, explore database schemas, and analyze results without leaving your conversation. This integration bridges the gap between natural language interaction and powerful data analysis capabilities.
uv
package manager (install via pip install uv
or follow instructions at https://docs.astral.sh/uv/)Install the ClickHouse MCP package:
pip install mcp-clickhouse
Configure Claude Desktop by editing the configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
Add the ClickHouse MCP server configuration to your Claude Desktop config file:
{
"mcpServers": {
"mcp-clickhouse": {
"command": "uv",
"args": [
"run",
"--with",
"mcp-clickhouse",
"--python",
"3.13",
"mcp-clickhouse"
],
"env": {
"CLICKHOUSE_HOST": "<your-clickhouse-host>",
"CLICKHOUSE_PORT": "<your-clickhouse-port>",
"CLICKHOUSE_USER": "<your-clickhouse-user>",
"CLICKHOUSE_PASSWORD": "<your-clickhouse-password>",
"CLICKHOUSE_SECURE": "true",
"CLICKHOUSE_VERIFY": "true",
"CLICKHOUSE_CONNECT_TIMEOUT": "30",
"CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30"
}
}
}
}
Replace the placeholder values with your actual ClickHouse connection details.
For the command
entry, replace "uv"
with the absolute path to your uv
executable if needed. On macOS, you can find this path using which uv
.
Restart Claude Desktop to apply the changes.
CLICKHOUSE_HOST
: The hostname of your ClickHouse serverCLICKHOUSE_USER
: The username for authenticationCLICKHOUSE_PASSWORD
: The password for authenticationCLICKHOUSE_PORT
: The port number (default: 8443 for HTTPS, 8123 for HTTP)CLICKHOUSE_SECURE
: Enable/disable HTTPS connection (default: "true")CLICKHOUSE_VERIFY
: Enable/disable SSL certificate verification (default: "true")CLICKHOUSE_CONNECT_TIMEOUT
: Connection timeout in seconds (default: "30")CLICKHOUSE_SEND_RECEIVE_TIMEOUT
: Send/receive timeout in seconds (default: "300")CLICKHOUSE_DATABASE
: Default database to use (default: server default)readonly = 1
to ensure they are safe for your database.CLICKHOUSE_SECURE=true
) and certificate verification (CLICKHOUSE_VERIFY=true
) for production environments.If you'd like to try the MCP with a public demo database, you can use the ClickHouse SQL Playground:
"env": {
"CLICKHOUSE_HOST": "sql-clickhouse.clickhouse.com",
"CLICKHOUSE_PORT": "8443",
"CLICKHOUSE_USER": "demo",
"CLICKHOUSE_PASSWORD": "",
"CLICKHOUSE_SECURE": "true",
"CLICKHOUSE_VERIFY": "true"
}
Once configured, you can ask Claude to:
List available databases: "Show me all databases in my ClickHouse instance"
List tables in a specific database: "What tables are in the 'default' database?"
Run a SQL query: "Run this query: SELECT count() FROM system.tables"
Analyze query results: "Query the NYC taxi dataset and show me the average trip distance by hour of day"
Claude will execute these commands using the appropriate MCP tools and return the results directly in your conversation.