Skip to main content
Glama
clickhouse

clickhouse

by donald-ada

ClickHouse MCP Server

一个用于 ClickHouse 的 Model Context Protocol (MCP) 服务器,让 Claude 等 AI 助手能够直接查询和管理 ClickHouse 数据库。

功能

提供 5 个工具:

工具

描述

list_databases

列出所有数据库

list_tables

列出指定数据库的所有表

describe_table

查看表的列信息和建表语句

query

执行 SELECT 查询,返回 JSON 结果

execute

执行 DDL / DML 语句(CREATE、ALTER、DROP、INSERT 等)

Related MCP server: ClickHouse MCP Server

快速开始

安装依赖

npm install

配置环境变量

复制 .env.example 并填写你的 ClickHouse 连接信息:

cp .env.example .env
CLICKHOUSE_HOST=http://your-clickhouse-host:8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=your_password
CLICKHOUSE_DATABASE=default

构建

npm run build

在 Claude Desktop 中使用

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS):

{
  "mcpServers": {
    "clickhouse": {
      "command": "node",
      "args": ["/path/to/clickhouse/dist/index.js"],
      "env": {
        "CLICKHOUSE_HOST": "http://your-clickhouse-host:8123",
        "CLICKHOUSE_USER": "default",
        "CLICKHOUSE_PASSWORD": "your_password",
        "CLICKHOUSE_DATABASE": "default"
      }
    }
  }
}

在 Claude Code 中使用

claude mcp add clickhouse node /path/to/clickhouse/dist/index.js \
  -e CLICKHOUSE_HOST=http://your-clickhouse-host:8123 \
  -e CLICKHOUSE_USER=default \
  -e CLICKHOUSE_PASSWORD=your_password \
  -e CLICKHOUSE_DATABASE=default

开发

# 直接运行(无需构建)
npm run dev

技术栈

License

MIT

Available Tools

5 tools
describe_tableA
Read-only

Show column names, types, and default expressions for a table. Also returns the CREATE TABLE statement for full schema details.

Inputs: table (required), database (required).

executeA
Destructive

Execute a DDL or DML statement: CREATE TABLE, ALTER TABLE, DROP TABLE, INSERT, UPDATE, DELETE. Returns success/error only — no row results. Use query for SELECT.

Inputs: sql (required), database.

list_databasesA
Read-only

List all databases in ClickHouse.

Inputs: no named parameters.

list_tablesA
Read-only

List all tables in a database.

Inputs: database (required).

queryA
Read-only

Execute a SELECT query and return results as JSON rows. Use for read-only operations only. For DDL or DML use execute instead.

Inputs: sql (required), database.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool serves a distinct purpose: list_databases and list_tables handle exploration, describe_table provides schema details, query is for read-only SELECTs, and execute handles DDL/DML. There is no overlap or ambiguity between them.

    Naming Consistency5/5

    All tool names use consistent snake_case with a clear verb-noun pattern (list_*, describe_*, query, execute). The naming is uniform and predictable.

    Tool Count5/5

    Five tools is well-scoped for a database server covering exploration, schema inspection, and data manipulation. Each tool is necessary and there is no bloat.

    Completeness5/5

    The tool surface covers the essential lifecycle of a ClickHouse database: listing databases and tables, inspecting schema, running SELECT queries, and executing all DDL/DML statements. No critical operations appear missing.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables executing SQL queries, listing databases, and listing tables on a ClickHouse cluster through natural language.
      Apache 2.0
    • A
      license
      A
      quality
      Not graded
      maintenance
      Provides AI agents safe, read-only access to a ClickHouse database, enabling table listing, query execution, schema inspection, and caching.
      6
      6
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI to execute SQL queries against MySQL and ClickHouse connections, retrieve and manage results, and inject them into the aiQueryLab VSCode IDE.
      Apache 2.0