ClickHouse query & management for AI agents β SQL-classified read/write/destructive gating.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
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.
SHOW CREATE, table stats (parts/rows/bytes), running queries, server metrics, cluster topology.query tool that only accepts read statements, capped at CLICKHOUSE_MAX_ROWS.execute tool for INSERT/CREATE/ALTER (read-write) and DROP/TRUNCATE/DELETE (admin), each gated by classification.read-only β read-write β admin, layered so a mode never exposes statements above its level.| Concern | Flag | Default | Effect |
|---|---|---|---|
| What can the server do? | CLICKHOUSE_MODE | read-only | read-only exposes read tools only (and refuses non-SELECT in query); read-write adds execute for writes; admin allows destructive statements. |
| Which databases are in scope? | CLICKHOUSE_DATABASE_ALLOWLIST | (all) | When set, operations on other databases are refused. |
| Which databases are read-only forever? | CLICKHOUSE_PROTECTED_DATABASES | system,information_schema | Readable, never mutable. |
| Can it run destructive SQL? | CLICKHOUSE_ALLOW_DELETE | false | DROP/TRUNCATE/DELETE/β¦ need this and admin mode. |
| Result size cap | CLICKHOUSE_MAX_ROWS | 1000 | Hard cap on rows returned to the model. |
| Preview without executing | CLICKHOUSE_DRY_RUN | false | Write/destructive statements validate + log intent, then return. |
| Audit trail | CLICKHOUSE_AUDIT_LOG | true | Emits a JSON line to stderr per guarded operation. |
Statement classification lives in src/sql.ts and is fail-safe: ALTER β¦ DELETE/UPDATE counts as destructive, and anything unparseable is treated as destructive.
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.
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:
analytics database?"events and run a query for daily counts this week."Prefer the published package above. To run from a clone:
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.
MIT
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/mcp-clickhouse)<a href="https://allmcps.com/mcp/mcp-clickhouse"><img src="https://allmcps.com/api/badge/mcp-clickhouse?style=directory" alt="MCP Clickhouse on AllMCPs" /></a>