
Mcp Clickhouse
io.github.dockndevaiPublished by GitHub account dockndevaiv0.3.0Updated Oct 24, 2026
ClickHouse query & management for AI agents — SQL-classified read/write/destructive gating.
Overview
A local MCP server for ClickHouse that lets an assistant explore schemas, run read queries, and, when enabled, write or manage the database under statement gats
- What you can do
- Explore databases, tables, columns, table statistics, running queries, server metrics and cluster topology, and view table definitions with SHOW CREATE. Run read-only SQL queries, capped at a configurable row limit. Execute a single INSERT, CREATE or ALTER statement in read-write mode. Run destructive statements such as DROP, TRUNCATE or DELETE only in admin mode with an extra flag. Preview write and destructive statements with dry-run and log guarded operations as JSON audit lines.
- When to use it
- Useful when an assistant needs to inspect or query a ClickHouse analytics database, answer questions about schemas and table sizes, or check running queries and server metrics. Also suited to controlled database management where access levels and destructive-statement gating matter.
- Requirements
- Runs locally via npx from the npm package, so Node.js is needed. Requires a ClickHouse HTTP endpoint, user and password set through CLICKHOUSE_URL, CLICKHOUSE_USER and CLICKHOUSE_PASSWORD, plus CLICKHOUSE_MODE (defaults to read-only). Optional flags cover database allowlist, protected databases, delete permission, row cap, dry-run and audit logging.
Installation
In SourceWeft
- Open Mcp Clickhouse in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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
Source: README.md at commit 6940892
Tools
0Version history
2- v0.3.0LatestSep 29, 2026
- v0.2.2Sep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts