Skip to main content

A Model Context Protocal (MCP) server that enables secure interaction with Clickhouse. This server allows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.

Project description

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_clickhouse_mcp_server-0.1.0.tar.gz (201.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iflow_mcp_clickhouse_mcp_server-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_clickhouse_mcp_server-0.1.0.tar.gz.

File metadata

File hashes

Hashes for iflow_mcp_clickhouse_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a3e8ba137127ae5f19084110ffbb973fa96bbdb9caa784340773af0b49d908e9
MD5 5628cb86f5e609964e7662892d62a489
BLAKE2b-256 d8110f4ca268b1d09d7725f76ff11cdc741f5acedd9615e15a0e7bb689f058e8

See more details on using hashes here.

File details

Details for the file iflow_mcp_clickhouse_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for iflow_mcp_clickhouse_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6719d9fb7a66a467f64aecf25d62e2fa79df8477bd96a6634203667ae7c60009
MD5 3284ca16a687f5efe4c5a793d97f142d
BLAKE2b-256 5d197f07edee8871e28fa49aa4128b05a399c0e589d620244c34baea1ae0c55d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page