This repository provides an MCP server for ClickHouse, enabling users to execute SQL queries, list databases, and list tables within a ClickHouse cluster. It offers tools for interacting with ClickHouse
An MCP server designed to interface with ClickHouse, enabling interaction with ClickHouse clusters through tools.
<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_select_query
: Executes read-only SQL queries on ClickHouse. Input: sql
(string).list_databases
: Lists all databases within the ClickHouse cluster.list_tables
: Lists tables in a specified database. Input: database
(string).Configuration involves modifying the Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json
on macOS, %APPDATA%/Claude/claude_desktop_config.json
on Windows) to include the mcp-clickhouse
server definition. This definition specifies the command to run the server, along with environment variables for ClickHouse connection details. The uv
command path must be updated to the absolute path of the uv
executable.
Development setup involves using Docker Compose to start a ClickHouse cluster, defining environment variables in a .env
file, and using uv sync
to install dependencies. The server can then be started using mcp dev mcp_clickhouse/mcp_server.py
.
The server relies on environment variables for configuration, including CLICKHOUSE_HOST
, CLICKHOUSE_USER
, CLICKHOUSE_PASSWORD
, and optional variables like CLICKHOUSE_PORT
, CLICKHOUSE_SECURE
, CLICKHOUSE_VERIFY
, CLICKHOUSE_CONNECT_TIMEOUT
, CLICKHOUSE_SEND_RECEIVE_TIMEOUT
, and CLICKHOUSE_DATABASE
.
ClickHouse/mcp-clickhouse
December 25, 2024
March 28, 2025
Python