mcp-clickhouse

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

211
21

ClickHouse MCP Server

PyPI - Version

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>

Features

Tools

  • 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

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

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.

Environment Variables

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.

Repository

CL
ClickHouse

ClickHouse/mcp-clickhouse

Created

December 25, 2024

Updated

March 28, 2025

Language

Python

Category

Database