Skip to main content
Glama
ClickHouse MCP Server

ClickHouse MCP Server

by iskakaushik

ClickHouse MCP 服务器

迁移至https://github.com/ClickHouse/mcp-clickhouse

ClickHouse 的 MCP 服务器。

特征

工具

  • run_select_query

    • 在您的 ClickHouse 集群上执行 SQL 查询。

    • 输入: sql (字符串):要执行的 SQL 查询。

    • 所有 ClickHouse 查询均以readonly = 1运行,以确保它们是安全的。

  • list_databases

    • 列出 ClickHouse 集群上的所有数据库。

  • list_tables

    • 列出数据库中的所有表。

    • 输入: database (字符串):数据库的名称。

Related MCP server: Altinity MCP

配置

注意:这是一个临时配置过程,一旦软件包发布,将会得到显著改善。

  1. 运行uv sync来安装依赖项。要安装uv ,请按照此处的说明操作。然后执行source .venv/bin/activate 。

  2. 使用 ClickHouse 凭证设置.env.production文件。

CLICKHOUSE_HOST=<CLICKHOUSE_HOST>
CLICKHOUSE_PORT=<CLICKHOUSE_PORT>
CLICKHOUSE_USER=<CLICKHOUSE_USER>
CLICKHOUSE_PASSWORD=<CLICKHOUSE_PASSWORD>
  1. 运行fastmcp install mcp_clickhouse/mcp_server.py -f .env.production来安装服务器。

  2. 重新启动 Claude Desktop。

发展

  1. 在test-services目录中运行docker compose up -d来启动 ClickHouse 集群。

  2. 将以下变量添加到存储库根目录中的.env文件中。

CLICKHOUSE_HOST=localhost
CLICKHOUSE_PORT=8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=clickhouse
  1. 运行uv sync来安装依赖项。要安装uv ,请按照此处的说明操作。然后执行source .venv/bin/activate 。

  2. 为了方便测试,您可以运行fastmcp dev mcp_clickhouse/mcp_server.py来启动 MCP 服务器。

Available Tools

3 tools
list_databasesD

Inputs: no named parameters.

list_tablesD

Inputs: database (required), like.

run_select_queryD

Inputs: query (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    D1.8/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: list_databases retrieves database names, list_tables retrieves table names within a database, and run_select_query executes SQL queries. There is no overlap or ambiguity between these operations.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern with snake_case naming: list_databases, list_tables, run_select_query. The naming is predictable and readable throughout the set.

    Tool Count3/5

    With only 3 tools, the set feels thin for a database server like ClickHouse, lacking operations for data manipulation (e.g., insert, update, delete), schema management (e.g., create_table), or advanced query features. However, it covers basic listing and querying.

    Completeness2/5

    The tool surface is significantly incomplete for a database server. It provides read-only operations (list and select) but lacks essential CRUD functionality (create, update, delete), schema modifications, or administrative tasks, which will limit agent capabilities in managing ClickHouse effectively.

    Related MCP Connectors

    Related MCP Servers

    • 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
      2
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Production-ready MCP server designed to empower AI agents and LLMs to interact seamlessly with ClickHouse. It exposes your ClickHouse database as a set of standardized tools and resources that adhere to the MCP protocol, making it easy for agents built on OpenAI, Claude, or other platforms to query, explore, and analyse your data.
      39
      -
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server for ClickHouse with enhanced filtering for database and table discovery, supporting LIKE/NOT LIKE patterns and both ClickHouse and chDB tools.
      3
      Apache 2.0