ClickHouse MCP Server logo

ClickHouse MCP Server

by jovezhong

The ClickHouse MCP Server allows you to interact with your ClickHouse cluster through MCP (Managed Code Platform). It provides tools to execute SQL queries, list databases, and list tables within a database.

View on GitHub

Last updated: N/A

What is ClickHouse MCP Server?

The ClickHouse MCP Server is a server that integrates with the Managed Code Platform (MCP) to provide tools for interacting with ClickHouse databases. It allows you to execute SQL queries and retrieve database schema information.

How to use ClickHouse MCP Server?

To use the ClickHouse MCP Server, you need to configure it within the Claude Desktop application by adding it to the mcpServers section of the configuration file. You'll need to provide connection details such as host, port, user, and password for your ClickHouse instance. After configuring, you can use the provided tools like run_select_query, list_databases, and list_tables through the MCP interface.

Key features of ClickHouse MCP Server

  • Execute SQL queries on ClickHouse

  • List all databases in a ClickHouse cluster

  • List all tables within a specific database

  • Secure query execution with readonly mode

Use cases of ClickHouse MCP Server

  • Querying data from ClickHouse databases through MCP

  • Automating database schema discovery

  • Integrating ClickHouse with other MCP-managed services

  • Providing a secure and controlled interface for ClickHouse interaction

FAQ from ClickHouse MCP Server

What is the purpose of the readonly = 1 setting?

The readonly = 1 setting ensures that all SQL queries executed through the server are read-only, preventing accidental data modification.

How do I configure the ClickHouse connection?

You configure the connection by adding the server configuration to the mcpServers section in the Claude Desktop configuration file, providing the necessary environment variables like CLICKHOUSE_HOST, CLICKHOUSE_USER, and CLICKHOUSE_PASSWORD.

What environment variables are required?

The required environment variables are CLICKHOUSE_HOST, CLICKHOUSE_USER, and CLICKHOUSE_PASSWORD. CLICKHOUSE_PORT defaults to 8443 if HTTPS is enabled, or 8123 if disabled.

How do I test the server locally?

You can run the server locally by setting up a ClickHouse cluster using Docker Compose, configuring the environment variables in a .env file, and then running the server using mcp dev mcp_clickhouse/mcp_server.py.

Can I use the ClickHouse SQL Playground with this server?

Yes, you can use the ClickHouse SQL Playground by configuring the server with the appropriate host, port, user, and password for the playground instance.