The ClickHouse MCP Server allows interaction with a ClickHouse cluster to execute SQL queries and manage database objects.
Execute SQL Queries: Run
run_select_queryto execute read-only SQL queries on the ClickHouse cluster.List Databases: Use
list_databasesto fetch all databases in the cluster.List Tables: Use
list_tablesto retrieve tables within a specific database, with optional filtering.
Allows querying and interacting with ClickHouse databases, providing tools for executing SQL select queries, listing databases, and viewing tables within a database.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ClickHouse MCP Servershow me the top 10 customers by total sales"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ClickHouse MCP Server
Migrated to https://github.com/ClickHouse/mcp-clickhouse
An MCP server for ClickHouse.
Features
Tools
run_select_queryExecute SQL queries on your ClickHouse cluster.
Input:
sql(string): The SQL query to execute.All ClickHouse queries are run with
readonly = 1to ensure they are safe.
list_databasesList all databases on your ClickHouse cluster.
list_tablesList all tables in a database.
Input:
database(string): The name of the database.
Related MCP server: mcp-clickup
Configuration
Note: This is a temporary configuration process that will be significantly improved once the package is published.
Run
uv syncto install the dependencies. To installuvfollow the instructions here. Then dosource .venv/bin/activate.Setup the
.env.productionfile with the ClickHouse credentials.
CLICKHOUSE_HOST=<CLICKHOUSE_HOST>
CLICKHOUSE_PORT=<CLICKHOUSE_PORT>
CLICKHOUSE_USER=<CLICKHOUSE_USER>
CLICKHOUSE_PASSWORD=<CLICKHOUSE_PASSWORD>Run
fastmcp install mcp_clickhouse/mcp_server.py -f .env.productionto install the server.Restart Claude Desktop.
Development
In
test-servicesdirectory rundocker compose up -dto start the ClickHouse cluster.Add the following variables to a
.envfile in the root of the repository.
CLICKHOUSE_HOST=localhost
CLICKHOUSE_PORT=8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=clickhouseRun
uv syncto install the dependencies. To installuvfollow the instructions here. Then dosource .venv/bin/activate.For easy testing, you can run
fastmcp dev mcp_clickhouse/mcp_server.pyto start the MCP server.
Resources
Looking for Admin?
Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.