
Mcp Clickhouse
io.github.dockndevai由 GitHub 账号 dockndevai 发布v0.3.0更新于 Oct 24, 2026
ClickHouse query & management for AI agents — SQL-classified read/write/destructive gating.
概览
面向 ClickHouse 的本地 MCP 服务器,让助手浏览库表结构、执行只读查询,并在开启相应模式后写入或管理数据库,语句按读、写、破坏性分级拦截。
- 可以做什么
- 浏览数据库、表、列、表统计信息、正在运行的查询、服务器指标和集群拓扑,并查看建表语句。执行只读 SQL 查询,返回行数受可配置上限约束。在读写模式下执行单条 INSERT、CREATE 或 ALTER 语句。仅在管理员模式并额外开启删除许可时执行 DROP、TRUNCATE、DELETE 等破坏性语句。可用试运行预览写入与破坏性语句,并将受控操作以 JSON 审计行记录。
- 适用场景
- 适合让助手查看或查询 ClickHouse 分析数据库,回答表结构、表大小等问题,或检查正在运行的查询与服务器指标。也适合需要分级权限和破坏性语句拦截的受控数据库管理场景。
- 运行要求
- 通过 npx 从 npm 包在本地运行,需要 Node.js。需要 ClickHouse HTTP 地址、用户和密码,分别通过 CLICKHOUSE_URL、CLICKHOUSE_USER、CLICKHOUSE_PASSWORD 设置,并设置 CLICKHOUSE_MODE(默认只读)。可选配置包括数据库白名单、受保护数据库、删除许可、行数上限、试运行和审计日志。
安装
在 SourceWeft 中
- 打开 控制台中的 Mcp Clickhouse,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
mcp-clickhouse
A Model Context Protocol server for ClickHouse. It lets an MCP-capable client (Claude Desktop, Claude Code, etc.) explore schemas, run analytical queries, and manage the database — with behaviour controlled entirely by flags.
The security model is statement-aware: every SQL statement is classified as read, write, or destructive, and gated against the current access mode. Read-only mode additionally runs queries under ClickHouse's own readonly=1 setting.
Features
- Exploration & monitoring — databases, tables, columns,
SHOW CREATE, table stats (parts/rows/bytes), running queries, server metrics, cluster topology. - Read queries — a
querytool that only accepts read statements, capped atCLICKHOUSE_MAX_ROWS. - Management — an
executetool for INSERT/CREATE/ALTER (read-write) and DROP/TRUNCATE/DELETE (admin), each gated by classification. - Access modes —
read-only→read-write→admin, layered so a mode never exposes statements above its level. - Security flags — database allowlist, protected databases, destructive gating, row cap, dry-run, and JSON audit logging (see below).
Security model
Statement classification lives in src/sql.ts and is fail-safe: ALTER … DELETE/UPDATE counts as destructive, and anything unparseable is treated as destructive.
Tools
Read (read-only+): list_databases, list_tables, describe_table, show_create_table, table_stats, running_queries, server_metrics, cluster_info, query
Write/Admin (read-write+): execute — runs a single statement after classifying it; writes need read-write mode, destructive statements need admin mode + CLICKHOUSE_ALLOW_DELETE.
Quickstart — add to your agent
Published on npm as @dockndevai/mcp-clickhouse. No clone or build needed — your MCP client runs it on demand with npx. Start in read-only mode; see .env.example for every variable and docs/CLIENTS.md for the full per-client guide.
Claude Code (CLI)
Claude Desktop · Cursor · Windsurf — same block in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.json:
OpenAI Codex CLI — in ~/.codex/config.toml:
VS Code (GitHub Copilot, Agent mode) — in .vscode/mcp.json:
Example prompts
- "What are the biggest tables in the
analyticsdatabase?" - "Show me the schema for
eventsand run a query for daily counts this week." - "Which queries are currently running and using the most memory?"
Run from source (development)
Prefer the published package above. To run from a clone:
Develop
Publishing
This server ships a server.json for the official MCP registry and an mcpName for npm ownership validation. See PUBLISHING.md for publishing to npm and listing on the MCP registry, Smithery, Glama, Cursor, and PulseMCP.
License
MIT
来源:README.md,提交 6940892
工具
0版本历史
2- v0.3.0最新Sep 29, 2026
- v0.2.2Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分