mcp-clickhouse
Provides tools for exploring ClickHouse schemas, running analytical read queries, and managing the database with configurable access modes and security restrictions.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-clickhouseWhat are the biggest tables in the analytics database?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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).
Related MCP server: clickhouse-mcp-server
Security model
Concern | Flag | Default | Effect |
What can the server do? |
|
|
|
Which databases are in scope? |
| (all) | When set, operations on other databases are refused. |
Which databases are read-only forever? |
|
| Readable, never mutable. |
Can it run destructive SQL? |
|
| DROP/TRUNCATE/DELETE/… need this and admin mode. |
Result size cap |
|
| Hard cap on rows returned to the model. |
Preview without executing |
|
| Write/destructive statements validate + log intent, then return. |
Audit trail |
|
| 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.
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.
Use with your MCP client
Works with Claude Code, Claude Desktop, Cursor, OpenAI Codex CLI, Windsurf, VS Code (Copilot), and any other MCP client — see docs/CLIENTS.md for per-client setup.
Install
npm install
npm run buildRun with Claude Desktop / Claude Code
{
"mcpServers": {
"clickhouse": {
"command": "node",
"args": ["/absolute/path/to/mcp-clickhouse/dist/index.js"],
"env": {
"CLICKHOUSE_URL": "http://clickhouse:8123",
"CLICKHOUSE_USER": "readonly",
"CLICKHOUSE_PASSWORD": "…",
"CLICKHOUSE_MODE": "read-only",
"CLICKHOUSE_DATABASE_ALLOWLIST": "analytics"
}
}
}
}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?"
Develop
npm run dev
npm test # SQL classification + security policy (30 tests)
npm run typecheckPublishing
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
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityFmaintenanceAn 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.22MIT
- AlicenseNot gradedqualityCmaintenanceEnables interaction with ClickHouse databases via MCP, providing tools to list databases and tables and execute safe SELECT, SHOW, and DESCRIBE queries.32MIT
- FlicenseAqualityCmaintenanceRead-only MCP server for ClickHouse that allows listing databases and tables, describing schemas, and running SELECT queries.4
Related MCP Connectors
Read-only MCP access to sessions, funnels, campaigns, errors, live visitors, and anomalies.
MCP server for managing Prisma Postgres.
Read-only Yandex Metrika MCP. Query visits, sources, geo, devices and more in plain language.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dockndevai/mcp-clickhouse'
If you have feedback or need assistance with the MCP directory API, please join our Discord server