ClickHouse MCP Server logo

ClickHouse MCP Server

by ClickHouse

The ClickHouse MCP Server provides a set of tools to interact with your ClickHouse cluster, allowing you to execute SQL queries and manage databases and tables. It is designed to be used with Claude Desktop and leverages environment variables for configuration.

View on GitHub

Last updated: N/A

What is ClickHouse MCP Server?

The ClickHouse MCP Server is a server that exposes several tools to interact with a ClickHouse database. It allows users to execute SQL queries, list databases, and list tables within a database.

How to use ClickHouse MCP Server?

To use the ClickHouse MCP Server, you need to configure it within Claude Desktop by adding a new MCP server configuration. This involves specifying the command to run the server (using uv), arguments, and environment variables that define the connection details for your ClickHouse instance. You'll also need to ensure the uv command is accessible and that the necessary environment variables are set correctly.

Key features of ClickHouse MCP Server

  • Execute SQL queries on ClickHouse cluster

  • List all databases on ClickHouse cluster

  • List all tables in a database

  • Configuration via environment variables

Use cases of ClickHouse MCP Server

  • Running read-only queries for data analysis

  • Exploring database schema and table structures

  • Integrating ClickHouse with Claude Desktop for interactive data exploration

  • Testing SQL queries before deploying them to production

FAQ from ClickHouse MCP Server

What is the purpose of the readonly = 1 setting?

All ClickHouse queries are run with readonly = 1 to ensure they are safe and prevent accidental data modification.

How do I configure the server to connect to my ClickHouse instance?

You need to set the CLICKHOUSE_HOST, CLICKHOUSE_PORT, CLICKHOUSE_USER, and CLICKHOUSE_PASSWORD environment variables in the Claude Desktop configuration.

What if I'm using HTTPS for my ClickHouse connection?

Set the CLICKHOUSE_SECURE environment variable to true. The default port will then be 8443.

How do I disable SSL certificate verification?

Set the CLICKHOUSE_VERIFY environment variable to false. However, this is not recommended for production environments.

What is MCP?

MCP stands for Managed Code Platform. It's a framework that allows you to run code in a sandboxed environment.