Skip to main content
Glama
ClickHouse MCP Server

ClickHouse MCP Server

by dubin555

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.

Related MCP server: GreptimeDB MCP Server

Post your question to AI assistant in Cline

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

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!

Available Tools

1 tool
execute_sqlC

Execute a query against the ClickHouse database

Inputs: query (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined and distinct by default.

    Naming Consistency5/5

    Since there is only a single tool, naming consistency is inherently perfect. The tool name follows a clear verb_noun pattern (execute_sql), which would be consistent if more tools were added.

    Tool Count2/5

    A single tool is too few for a database server's scope, as it lacks essential operations like schema inspection, data manipulation beyond queries, or connection management. This minimal set will likely cause agent failures in complex tasks.

    Completeness1/5

    The tool surface is severely incomplete for a ClickHouse database server. It only provides query execution, missing critical operations such as listing tables, describing schemas, inserting data, or managing connections, leaving significant gaps for agent workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that enables Large Language Models to seamlessly interact with ClickHouse databases, supporting resource listing, schema retrieval, and query execution.
      2
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      A Model Context Protocol server implementation that enables AI assistants to securely interact with GreptimeDB, allowing them to explore database schema, read data, and execute SQL queries through a controlled interface.
      15
      29
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      An MCP server implementation that enables Claude AI to interact with Clickhouse databases. Features include secure database connections, query execution, read-only mode support, and multi-query capabilities.
      2
      23 PyPI
      2
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI assistants to securely interact with OceanBase databases by listing tables, reading data, and executing SQL queries through a controlled interface.
      1
      3
      Apache 2.0