mcp-clickhouse is a Model Context Protocol (MCP) server for ClickHouse, developed by dockndevai and hosted on GitHub. It allows MCP-capable clients (such as Claude Desktop, Claude Code, etc.) to explore database schemas, run analytical queries, and manage databases, with all behavior fully controlled by flags.
Purpose The server is designed to provide MCP clients with secure access to and operation of ClickHouse databases, covering the complete workflow from schema exploration and query execution to database management.
Main capabilities
- Exploration and monitoring: Supports viewing databases, tables, columns, SHOW CREATE statements, table statistics (parts/rows/bytes), running queries, server metrics, and cluster topology.
- Read-only queries: Provides a query tool that accepts only read statements, with the number of result rows limited by CLICKHOUSE_MAX_ROWS.
- Administrative operations: Provides an execute tool for executing INSERT/CREATE/ALTER (read-write mode) as well as DROP/TRUNCATE/DELETE (admin mode), with each statement gated by classification.
- Access modes: Divided into three tiers: read-only, read-write, and admin. The modes are progressive, and no mode exposes statements above its level.
- Security flags: Includes database allowlist, protected databases, destructive operation gating, row limits, dry-run, and JSON audit logs.
- Statement classification: The classification logic is located in src/sql.ts and uses a fail-safe design—ALTER … DELETE/UPDATE is treated as a destructive operation, and any statement that cannot be parsed is also treated as destructive.
Tool list
- Read (read-only and above): list_databases, list_tables, describe_table, show_create_table, table_stats, running_queries, server_metrics, cluster_info, query.
- Write/admin (read-write and above): execute—runs a single statement after classification; write operations require read-write mode, and destructive statements require admin mode and the CLICKHOUSE_ALLOW_DELETE.
Usage The server has been published to npm under the package name @dockndevai/mcp-clickhouse. No cloning or building is required; MCP clients can run it on demand via npx. It is recommended to start in read-only mode; all environment variables can be found in .env.example, and the complete configuration guide for each client is in docs/CLIENTS.md.
Configuration examples (clients mentioned in the materials)
- Claude Code (CLI)
- Claude Desktop, Cursor, Windsurf: Use the same configuration block in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.json.
- OpenAI Codex CLI: Configure in ~/.codex/config.toml.
- VS Code (GitHub Copilot, Agent mode): Configure in .vscode/mcp.json.
Example prompts
- “What are the biggest tables in the analytics database?”
- “Show me the schema for events and run a query for daily counts this week.”
- “Which queries are currently running and using the most memory?”
Running from source (development) Prefer the published package above. To run from a cloned repository, no specific commands are provided in the materials.
Other information The server includes server.json for the official MCP registry, as well as mcpName for npm ownership verification. Instructions for publishing to npm and listing in the MCP registry, Smithery, Glama, Cursor, and PulseMCP are in PUBLISHING.md.
Use cases Suitable for developers and data analysis scenarios that need to securely explore, query, and manage ClickHouse databases through MCP clients, especially where access control, statement classification, and auditing are requiredteam.
Limitations The materials do not provide specific installation commands, a complete list of environment variables, supported ClickHouse versions, performance metrics, or pricing information. The specific code block contents of some client configurations are not fully shown in the materials.