clickhouse.com
clickhouse.com logo

ClickHouse

Integrates with ClickHouse to enable natural language querying and exploration of large datasets while maintaining read-...

Created byApr 22, 2025

ClickHouse MCP Server

An MCP server for ClickHouse.
<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>

Features

Tools

  • run_select_query
  • list_databases
  • list_tables

Configuration

  1. Open the Claude Desktop configuration file located at:
  1. Add the following:
Update the environment variables to point to your own ClickHouse service.
Or, if you'd like to try it out with the ClickHouse SQL Playground, you can use the following config:
  1. Locate the command entry for uv and replace it with the absolute path to the uv executable. This ensures that the correct version of uv is used when starting the server. On a mac, you can find this path using which uv.
  1. Restart Claude Desktop to apply the changes.

Development

  1. In test-services directory run docker compose up -d to start the ClickHouse cluster.
  1. Add the following variables to a .env file in the root of the repository.
Note: The use of the `default` user in this context is intended solely for local development purposes.
  1. Run uv sync to install the dependencies. To install uv follow the instructions here. Then do source .venv/bin/activate.
  1. For easy testing, you can run mcp dev mcp_clickhouse/mcp_server.py to start the MCP server.

Environment Variables

The following environment variables are used to configure the ClickHouse connection:

Required Variables

  • CLICKHOUSE_HOST: The hostname of your ClickHouse server
  • CLICKHOUSE_USER: The username for authentication
  • CLICKHOUSE_PASSWORD: The password for authentication
[!CAUTION]It is important to treat your MCP database user as you would any external client connecting to your database, granting only the minimum necessary privileges required for its operation. The use of default or administrative users should be strictly avoided at all times.

Optional Variables

  • CLICKHOUSE_PORT: The port number of your ClickHouse server
  • CLICKHOUSE_SECURE: Enable/disable HTTPS connection
  • CLICKHOUSE_VERIFY: Enable/disable SSL certificate verification
  • CLICKHOUSE_CONNECT_TIMEOUT: Connection timeout in seconds
  • CLICKHOUSE_SEND_RECEIVE_TIMEOUT: Send/receive timeout in seconds
  • CLICKHOUSE_DATABASE: Default database to use

Example Configurations

For local development with Docker:
For ClickHouse Cloud:
For ClickHouse SQL Playground:
You can set these variables in your environment, in a .env file, or in the Claude Desktop configuration:

YouTube Overview

ClickHouse MCP Server

An MCP server for ClickHouse.
<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>

Features

Tools

  • run_select_query
  • list_databases
  • list_tables

Configuration

  1. Open the Claude Desktop configuration file located at:
  1. Add the following:
Update the environment variables to point to your own ClickHouse service.
Or, if you'd like to try it out with the ClickHouse SQL Playground, you can use the following config:
  1. Locate the command entry for uv and replace it with the absolute path to the uv executable. This ensures that the correct version of uv is used when starting the server. On a mac, you can find this path using which uv.
  1. Restart Claude Desktop to apply the changes.

Development

  1. In test-services directory run docker compose up -d to start the ClickHouse cluster.
  1. Add the following variables to a .env file in the root of the repository.
Note: The use of the `default` user in this context is intended solely for local development purposes.
  1. Run uv sync to install the dependencies. To install uv follow the instructions here. Then do source .venv/bin/activate.
  1. For easy testing, you can run mcp dev mcp_clickhouse/mcp_server.py to start the MCP server.

Environment Variables

The following environment variables are used to configure the ClickHouse connection:

Required Variables

  • CLICKHOUSE_HOST: The hostname of your ClickHouse server
  • CLICKHOUSE_USER: The username for authentication
  • CLICKHOUSE_PASSWORD: The password for authentication
[!CAUTION]It is important to treat your MCP database user as you would any external client connecting to your database, granting only the minimum necessary privileges required for its operation. The use of default or administrative users should be strictly avoided at all times.

Optional Variables

  • CLICKHOUSE_PORT: The port number of your ClickHouse server
  • CLICKHOUSE_SECURE: Enable/disable HTTPS connection
  • CLICKHOUSE_VERIFY: Enable/disable SSL certificate verification
  • CLICKHOUSE_CONNECT_TIMEOUT: Connection timeout in seconds
  • CLICKHOUSE_SEND_RECEIVE_TIMEOUT: Send/receive timeout in seconds
  • CLICKHOUSE_DATABASE: Default database to use

Example Configurations

For local development with Docker:
For ClickHouse Cloud:
For ClickHouse SQL Playground:
You can set these variables in your environment, in a .env file, or in the Claude Desktop configuration:

YouTube Overview