Skip to main content

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!

Metadata

Release files for iflow-mcp_clickhouse-mcp-server 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iflow-mcp_clickhouse-mcp-server 0.1.0
File Size Uploaded
iflow_mcp_clickhouse_mcp_server-0.1.0.tar.gz 201.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp_clickhouse-mcp-server 0.1.0
File Interpreter ABI Platform
iflow_mcp_clickhouse_mcp_server-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 213.2 kB

Release files / iflow_mcp_clickhouse_mcp_server-0.1.0.tar.gz

Download URL iflow_mcp_clickhouse_mcp_server-0.1.0.tar.gz
Size 201.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a3e8ba137127ae5f19084110ffbb973fa96bbdb9caa784340773af0b49d908e9
BLAKE2b-256 checksum
How to use checksums
d8110f4ca268b1d09d7725f76ff11cdc741f5acedd9615e15a0e7bb689f058e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release files / iflow_mcp_clickhouse_mcp_server-0.1.0-py3-none-any.whl

Download URL iflow_mcp_clickhouse_mcp_server-0.1.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6719d9fb7a66a467f64aecf25d62e2fa79df8477bd96a6634203667ae7c60009
BLAKE2b-256 checksum
How to use checksums
5d197f07edee8871e28fa49aa4128b05a399c0e589d620244c34baea1ae0c55d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page