ClickHouse

v0.8.0
io.github.ClickHouse/mcp-clickhouse Checked 15 hours ago Published 1 day ago

Official ClickHouse MCP server for querying and exploring ClickHouse clusters and chDB.

Values you need

VariableWhat it is
CLICKHOUSE_HOSTrequired Hostname of the ClickHouse server
CLICKHOUSE_USERrequired Username for ClickHouse authentication
CLICKHOUSE_PASSWORDoptional secret Password for ClickHouse authentication. Required unless a client certificate uses the default or mutual TLS mode
CLICKHOUSE_PORToptional ClickHouse HTTP(S) port. Defaults to 8443 when CLICKHOUSE_SECURE=true, 8123 otherwise
CLICKHOUSE_SECUREoptional Use HTTPS to connect to ClickHouse Default: true
CLICKHOUSE_VERIFYoptional Verify SSL certificates Default: true
CLICKHOUSE_CA_CERToptional Path to a PEM CA bundle for ClickHouse server certificate verification
CLICKHOUSE_CLIENT_CERToptional Path to a PEM client certificate for the ClickHouse HTTPS connection
CLICKHOUSE_CLIENT_CERT_KEYoptional Path to the PEM private key for CLICKHOUSE_CLIENT_CERT
CLICKHOUSE_TLS_MODEoptional Client certificate mode: mutual, proxy, or strict
CLICKHOUSE_DATABASEoptional Default database to use
CLICKHOUSE_ROLEoptional ClickHouse role to activate for the session
CLICKHOUSE_ALLOW_WRITE_ACCESSoptional Allow write operations (DDL and DML). Queries run read-only by default Default: false
CLICKHOUSE_ALLOW_DROPoptional Allow destructive operations (DROP, TRUNCATE, DELETE, UPDATE, REPLACE, CLEAR, OPTIMIZE DEDUPLICATE, MODIFY/MATERIALIZE TTL, MODIFY/ALTER COLUMN with TTL, and DETACH PERMANENTLY) when write access is also enabled Default: false
CLICKHOUSE_MCP_QUERY_TIMEOUToptional Query tool timeout in seconds Default: 30
CLICKHOUSE_MCP_MAX_WORKERSoptional Maximum query worker thread pool size Default: 10

PyPI (uvx) discovery passed

Requires uv (https://docs.astral.sh/uv/)

Run in a terminal
claude mcp add mcp-clickhouse -e 'CLICKHOUSE_HOST=<CLICKHOUSE_HOST>' -e 'CLICKHOUSE_USER=<CLICKHOUSE_USER>' -- uvx mcp-clickhouse==0.8.0
Add to claude_desktop_config.json
{
  "mcpServers": {
    "mcp-clickhouse": {
      "args": [
        "mcp-clickhouse==0.8.0"
      ],
      "command": "uvx",
      "env": {
        "CLICKHOUSE_HOST": "<CLICKHOUSE_HOST>",
        "CLICKHOUSE_USER": "<CLICKHOUSE_USER>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "mcp-clickhouse": {
      "args": [
        "mcp-clickhouse==0.8.0"
      ],
      "command": "uvx",
      "env": {
        "CLICKHOUSE_HOST": "<CLICKHOUSE_HOST>",
        "CLICKHOUSE_USER": "<CLICKHOUSE_USER>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "CLICKHOUSE_HOST",
      "id": "clickhouse-host",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "CLICKHOUSE_USER",
      "id": "clickhouse-user",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "mcp-clickhouse": {
      "args": [
        "mcp-clickhouse==0.8.0"
      ],
      "command": "uvx",
      "env": {
        "CLICKHOUSE_HOST": "${input:clickhouse-host}",
        "CLICKHOUSE_USER": "${input:clickhouse-user}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.mcp-clickhouse]
command = "uvx"
args = ["mcp-clickhouse==0.8.0"]
env = { "CLICKHOUSE_HOST" = "<CLICKHOUSE_HOST>", "CLICKHOUSE_USER" = "<CLICKHOUSE_USER>" }

Docker

Requires Docker

Run in a terminal
claude mcp add mcp-clickhouse -e 'CLICKHOUSE_HOST=<CLICKHOUSE_HOST>' -e 'CLICKHOUSE_USER=<CLICKHOUSE_USER>' -- docker run -i --rm -e CLICKHOUSE_HOST -e CLICKHOUSE_USER ghcr.io/clickhouse/mcp-clickhouse:0.8.0
Add to claude_desktop_config.json
{
  "mcpServers": {
    "mcp-clickhouse": {
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "CLICKHOUSE_HOST",
        "-e",
        "CLICKHOUSE_USER",
        "ghcr.io/clickhouse/mcp-clickhouse:0.8.0"
      ],
      "command": "docker",
      "env": {
        "CLICKHOUSE_HOST": "<CLICKHOUSE_HOST>",
        "CLICKHOUSE_USER": "<CLICKHOUSE_USER>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "mcp-clickhouse": {
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "CLICKHOUSE_HOST",
        "-e",
        "CLICKHOUSE_USER",
        "ghcr.io/clickhouse/mcp-clickhouse:0.8.0"
      ],
      "command": "docker",
      "env": {
        "CLICKHOUSE_HOST": "<CLICKHOUSE_HOST>",
        "CLICKHOUSE_USER": "<CLICKHOUSE_USER>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "CLICKHOUSE_HOST",
      "id": "clickhouse-host",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "CLICKHOUSE_USER",
      "id": "clickhouse-user",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "mcp-clickhouse": {
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "CLICKHOUSE_HOST",
        "-e",
        "CLICKHOUSE_USER",
        "ghcr.io/clickhouse/mcp-clickhouse:0.8.0"
      ],
      "command": "docker",
      "env": {
        "CLICKHOUSE_HOST": "${input:clickhouse-host}",
        "CLICKHOUSE_USER": "${input:clickhouse-user}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.mcp-clickhouse]
command = "docker"
args = ["run", "-i", "--rm", "-e", "CLICKHOUSE_HOST", "-e", "CLICKHOUSE_USER", "ghcr.io/clickhouse/mcp-clickhouse:0.8.0"]
env = { "CLICKHOUSE_HOST" = "<CLICKHOUSE_HOST>", "CLICKHOUSE_USER" = "<CLICKHOUSE_USER>" }

For AI agents

  1. Ask the user for: CLICKHOUSE_HOST, CLICKHOUSE_USER. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  3. Restart or reload the client so it starts the server.
  4. Verify: the server should expose these tools: list_databases, list_tables, run_query.
  5. If it fails, check that the required runtime is installed (uv (https://docs.astral.sh/uv/)) and that the values above are set.

Machine-readable: install.md · manifest.json