Skip to main content
Glama
donald-ada

clickhouse

by donald-ada

ClickHouse MCP Server

一个用于 ClickHouseModel 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.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYesTable name
databaseYesDatabase name

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The readOnlyHint annotation already indicates a safe read, and the description adds context by specifying that it returns both column info and the CREATE TABLE statement. This clarifies what the agent will receive beyond the annotation's safety indicator.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences: the first leads with the core purpose, and the second adds a valuable extra detail. Every word earns its place with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a low-complexity tool with two self-evident parameters, the description fully explains the return behavior (columns, types, defaults, and CREATE TABLE). No output schema exists, but the description covers what is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with both 'database' and 'table' parameters described directly in the schema. The description itself does not add further semantic detail about parameters, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Show') with a clear resource ('column names, types, and default expressions for a table'). It also adds the CREATE TABLE statement detail, distinguishing it from sibling tools like list_tables (which lists identifiers) and query/execute (which run SQL).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies when to use this tool: when you need column-level schema details or full DDL. It doesn't explicitly name alternatives or exclusions, but the purpose is distinct enough from siblings that an agent can infer appropriate usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesDDL or DML SQL statement
databaseNoDatabase context (optional)

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The destructiveHint annotation (true) covers the destructive nature, and the description adds context that the tool returns only success/error and no row results. This extra behavioral detail goes beyond the annotation by clarifying the command's output behavior. No contradiction exists, and the description enriches the safety profile slightly beyond the bare annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, front-loaded with the core purpose and examples, followed by output behavior and an alternative. Every sentence adds value: the first details scope, the second clarifies return semantics and directs users to the correct sibling for SELECT. No superfluous words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is relatively simple, the description covers the required statement types, output behavior (success/error only), and explicitly mentions the alternative for SELECT. Given the destructiveHint annotation and lack of output schema, the description provides sufficient context for an agent to select and invoke the tool correctly. It fully addresses the essential aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with both 'sql' and 'database' parameters described in the schema. The description reinforces that the sql parameter should contain a DDL/DML statement, but it does not add new semantic details about parameters beyond what the schema already provides. Baseline 3 is appropriate since the schema carries the full descriptive burden.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool executes DDL/DML statements and lists concrete examples (CREATE TABLE, ALTER TABLE, DROP TABLE, INSERT, UPDATE, DELETE). It explicitly distinguishes itself from the sibling 'query' tool by noting that SELECT statements should use 'query' instead. This gives a specific verb, resource, and scope that unambiguously differentiates it from siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use the tool: for DDL or DML statements that return no row results. It also names the alternative for read-only queries: 'Use query for SELECT.' This directly addresses selection between siblings, meeting the explicit when/alternative criterion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_databasesA
Read-only

List all databases in ClickHouse.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The readOnlyHint annotation already declares the tool as a safe read operation. The description adds no further behavioral traits (e.g., pagination, output format), but it does not contradict the annotation. Minimal value is added beyond the annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence with no redundant wording. It is front-loaded and contains exactly the necessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no parameters, no output schema, read-only annotation), the description fully captures its purpose and scope. There is no missing information that would prevent an agent from selecting or invoking it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the description correctly implies no arguments are needed. With no parameters to document, the baseline of 4 applies, and the description is consistent with the empty schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('list') and resource ('databases') with a clear context ('in ClickHouse'). It is clearly distinct from sibling tools like list_tables and describe_table, which target different resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The usage is implied: this is the tool to enumerate databases. However, no explicit alternatives or exclusions are provided, and there is no mention of when not to use it. The context is clear but not explicitly differentiated from siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_tablesA
Read-only

List all tables in a database.

ParametersJSON Schema
NameRequiredDescriptionDefault
databaseYesDatabase name

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare readOnlyHint=true, so the agent knows it's a safe read operation. The description adds no extra behavioral context beyond the name, such as output format or scope, but it doesn't contradict the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One short sentence of eight words, immediately conveying the action and subject. No filler or redundant explanation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read-only operation with a single well-documented parameter, the description is minimally sufficient. However, it lacks any mention of return format, pagination, or edge cases like system tables, so it's not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema fully describes the single 'database' parameter with 'Database name'. The description's phrase 'in a database' implicitly aligns with this parameter but adds no additional semantic detail beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'List' and identifies the resource 'tables' within a 'database', clearly distinguishing it from sibling tools like list_databases and describe_table.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. The purpose is clear enough that usage can be inferred, but it doesn't mention when not to use it or direct to sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesSELECT SQL statement
databaseNoDatabase context (optional)

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnlyHint annotation, the description adds that results are returned as JSON rows, which is valuable since no output schema is provided. It doesn't discuss edge cases like errors or pagination, but the annotation covers the safety aspect, so this is appropriate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no wasted words. The primary action and return format are front-loaded, followed by a clear usage directive. Perfectly concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with two parameters (one required) and no output schema, the description covers purpose, usage guidance, and return format. It doesn't mention performance limits or error cases, but given the low complexity and strong annotations, this is nearly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for both parameters (sql and database). The description adds no extra parameter-specific meaning beyond what the schema already provides, so the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool executes SELECT queries and returns JSON rows, distinguishing it from siblings like execute. The specific verb 'Execute' and resource 'SELECT query' make the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit guidance is provided: 'Use for read-only operations only' and 'For DDL or DML use execute instead.' This directly tells the agent when to use this tool and names the alternative.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.3/5.0
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 issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/donald-ada/clickhouse'

If you have feedback or need assistance with the MCP directory API, please join our Discord server