JUHE API Marketplace
dubin555 avatar
MCP Server

ClickHouse MCP Server

A Model Context Protocol server that enables AI assistants to securely interact with ClickHouse databases, supporting table exploration and SQL query execution through a controlled interface.

8
GitHub Stars
8/23/2025
Last Updated
MCP Server Configuration
1{
2 "name": "clickhouse",
3 "command": "uv",
4 "args": [
5 "--directory",
6 "/path/to/clickhouse_mcp_server",
7 "run",
8 "-m",
9 "clickhouse_mcp_server.server"
10 ],
11 "env": {
12 "CLICKHOUSE_HOST": "localhost",
13 "CLICKHOUSE_PORT": "8123",
14 "CLICKHOUSE_USER": "default",
15 "CLICKHOUSE_PASSWORD": "CHANGE_TO_YOUR_PASSWORD",
16 "CLICKHOUSE_DATABASE": "default"
17 }
18}
JSON18 lines

README Documentation

ClickHouse MCP Server

A Model Context Protocal (MCP) server implement for ClickHouse.

This server provides AI assistants with a secure and structured way to explore and analyze databases. It enables them to list tables, read data, and execute SQL queries through a controlled interface, ensuring responsible database access.

Configuration

Set the following environment variables:

CLICKHOUSE_HOST=localhost    
CLICKHOUSE_PORT=8123         
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=CHANGE_TO_YOUR_PASSWORD
CLICKHOUSE_DATABASE=default

Or via command-line args:

  • --host the database host
  • --port the database port
  • --user the database username
  • --password the database password
  • --database the database name

Usage

Fake some data in clickhouse

Check the SQL in dev_contribute.md for details.

Post your question to AI assistant in Cline

What is the sales volume in each region? Which product is the best - selling?
Demo Screenshot

CLINE

Configure the MCP server in VSCode, Cline extension, or other MCP client.: Example:

{
  "mcpServers": {
    "clickhouse": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/clickhouse_mcp_server",
        "run",
        "-m",
        "clickhouse_mcp_server.server"
      ],
      "env": {
        "CLICKHOUSE_HOST": "localhost",
        "CLICKHOUSE_PORT": "8123",
        "CLICKHOUSE_USER": "default",
        "CLICKHOUSE_PASSWORD": "CHANGE_TO_YOUR_PASSWORD",
        "CLICKHOUSE_DATABASE": "default"
      }
    }
    
  }
}

License

APACHE - See LICENSE file for details.

Contribute

See dev_contribute.md for details.

Prerequisites

  • Python with uv package manager
  • ClickHouse installation
  • MCP server dependencies

Acknowledgement

This library's implementation was inspired by the following three repositories and incorporates their code, respect for the open-source spirit!

Thanks!

Quick Install

Quick Actions

Key Features

Model Context Protocol
Secure Communication
Real-time Updates
Open Source