ClickHouse

by iskakaushik

3 stars
Not rated
GitHub

About

Integrates with ClickHouse databases to execute read-only SQL queries, list databases, and enumerate tables for fast analytical processing of large datasets.

Details

Author
iskakaushik
Repository
iskakaushik/mcp-clickhouse
GitHub stars
3
License
Apache License 2.0
Categories
AI, Design, Developer Tools, Search, Database, Frontend, API

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name ClickHouse
    Command (node, npx, python, etc.) fastmcp
    Arguments
    • Argument 1 dev
    • Argument 2 mcp_clickhouse/mcp_server.py
    Environment
    • CLICKHOUSE_HOST localhost
    • CLICKHOUSE_PORT 8123
    • CLICKHOUSE_USER default
    • CLICKHOUSE_PASSWORD clickhouse

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

> Note: This is a temporary configuration process that will be significantly improved once the package is published.

1. Run uv sync to install the dependencies. To install uv follow the instructions here. Then do source .venv/bin/activate.

2. Setup the .env.production file with the ClickHouse credentials.

CLICKHOUSE_HOST=<CLICKHOUSE_HOST>
CLICKHOUSE_PORT=<CLICKHOUSE_PORT>
CLICKHOUSE_USER=<CLICKHOUSE_USER>
CLICKHOUSE_PASSWORD=<CLICKHOUSE_PASSWORD>

3. Run fastmcp install mcp_clickhouse/mcp_server.py -f .env.production to install the server.

4. Restart Claude Desktop.

run_select_query

Execute SQL queries on your ClickHouse cluster. Input: sql (string): The SQL query to execute.

list_databases

List all databases on your ClickHouse cluster.

list_tables

List all tables in a database. Input: database (string): The name of the database.

run_select_query
- Execute SQL queries on your ClickHouse cluster.
- Input: sql (string): The SQL query to execute.
- All ClickHouse queries are run with readonly = 1 to ensure they are safe.

list_databases
- List all databases on your ClickHouse cluster.

  • list_tables
- List all tables in a database. - Input: database (string): The name of the database.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "clickhouse": {
            "env": {
                "CLICKHOUSE_HOST": "localhost",
                "CLICKHOUSE_PORT": "8123",
                "CLICKHOUSE_USER": "default",
                "CLICKHOUSE_PASSWORD": "clickhouse"
            },
            "args": [
                "dev",
                "mcp_clickhouse/mcp_server.py"
            ],
            "command": "fastmcp"
        }
    }
}

Linux

{
    "env": {
        "CLICKHOUSE_HOST": "localhost",
        "CLICKHOUSE_PORT": "8123",
        "CLICKHOUSE_USER": "default",
        "CLICKHOUSE_PASSWORD": "clickhouse"
    },
    "args": [
        "dev",
        "mcp_clickhouse/mcp_server.py"
    ],
    "command": "fastmcp"
}

Macos

{
    "env": {
        "CLICKHOUSE_HOST": "localhost",
        "CLICKHOUSE_PORT": "8123",
        "CLICKHOUSE_USER": "default",
        "CLICKHOUSE_PASSWORD": "clickhouse"
    },
    "args": [
        "dev",
        "mcp_clickhouse/mcp_server.py"
    ],
    "command": "fastmcp"
}

Windows

{
    "env": {
        "CLICKHOUSE_HOST": "localhost",
        "CLICKHOUSE_PORT": "8123",
        "CLICKHOUSE_USER": "default",
        "CLICKHOUSE_PASSWORD": "clickhouse"
    },
    "args": [
        "dev",
        "mcp_clickhouse/mcp_server.py"
    ],
    "command": "fastmcp"
}

ClickHouse MCP Server

Migrated to https://github.com/ClickHouse/mcp-clickhouse

An MCP server for ClickHouse.

Features

Tools

run_select_query
- Execute SQL queries on your ClickHouse cluster.
- Input: sql (string): The SQL query to execute.
- All ClickHouse queries are run with readonly = 1 to ensure they are safe.

list_databases
- List all databases on your ClickHouse cluster.

  • list_tables
- List all tables in a database. - Input: database (string): The name of the database.

Configuration

> Note: This is a temporary configuration process that will be significantly improved once the package is published.

1. Run uv sync to install the dependencies. To install uv follow the instructions here. Then do source .venv/bin/activate.

2. Setup the .env.production file with the ClickHouse credentials.

CLICKHOUSE_HOST=<CLICKHOUSE_HOST>
CLICKHOUSE_PORT=<CLICKHOUSE_PORT>
CLICKHOUSE_USER=<CLICKHOUSE_USER>
CLICKHOUSE_PASSWORD=<CLICKHOUSE_PASSWORD>

3. Run fastmcp install mcp_clickhouse/mcp_server.py -f .env.production to install the server.

4. Restart Claude Desktop.

Development

1. In test-services directory run docker compose up -d to start the ClickHouse cluster.

2. Add the following variables to a .env file in the root of the repository.

CLICKHOUSE_HOST=localhost
CLICKHOUSE_PORT=8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=clickhouse

3. Run uv sync to install the dependencies. To install uv follow the instructions here. Then do source .venv/bin/activate.

4. For easy testing, you can run fastmcp dev mcp_clickhouse/mcp_server.py to start the MCP server.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.