clickhouse-mcp
Provides read-only access to a ClickHouse instance, enabling schema exploration, data sampling, and execution of guarded SELECT/SHOW/DESCRIBE/EXPLAIN queries to investigate observability data like logs, metrics, and traces.
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., "@clickhouse-mcpWhy did p99 latency spike at 02:14?"
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.
clickhouse-mcp
A read-only Model Context Protocol server for ClickHouse. It gives an AI agent a small set of tools to explore a ClickHouse instance and investigate observability data (logs, metrics, traces) without being able to write or mutate anything.
Built as a reference for wiring agents onto a petabyte-scale analytics platform: the agent discovers the schema, samples data, and runs guarded read-only SQL to answer questions like "why did p99 latency spike at 02:14?".
Tools
Tool | What it does |
|
|
|
|
|
|
|
|
|
|
| Arbitrary read-only SQL (SELECT/WITH/SHOW/DESCRIBE/EXPLAIN) |
Related MCP server: db-connect-mcp
Safety
Verb guard: only
SELECT / WITH / SHOW / DESCRIBE / EXPLAIN / EXISTSare allowed; write/DDL verbs (INSERT,CREATE,DROP,ALTER,TRUNCATE, …) are rejected.Limits: every query sets
max_result_rowsandmax_execution_time, and the rows returned to the model are capped (with a truncation note) to protect its context window.Defence in depth: still point this at a read-only ClickHouse user. The app-level guard is a first line, not the only one.
Prerequisites
Node.js 20+
Any ClickHouse instance. Easiest is local docker (no setup, includes
system.*observability tables to play with):docker run -d --name ch -p 8123:8123 -p 9000:9000 clickhouse/clickhouse-server
Install
git clone <your-fork-url> clickhouse-mcp && cd clickhouse-mcp
npm install
cp .env.example .env # then edit if your ClickHouse needs authVerify it talks to ClickHouse
npm run self-test
# Connecting to http://localhost:8123
# databases: [ 'default', 'system', 'INFORMATION_SCHEMA', ... ]
# version: [ { v: '25.x.x.x' } ]
# OKRun as an MCP server (stdio)
npm startUse it from a client
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"clickhouse": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/clickhouse-mcp/src/index.ts"],
"env": {
"CLICKHOUSE_URL": "http://localhost:8123",
"CLICKHOUSE_USERNAME": "default",
"CLICKHOUSE_PASSWORD": ""
}
}
}
}Claude Code:
claude mcp add clickhouse -e CLICKHOUSE_URL=http://localhost:8123 -- npx tsx /absolute/path/to/clickhouse-mcp/src/index.tsMCP Inspector (great for debugging the tools directly):
npx @modelcontextprotocol/inspector npx tsx src/index.tsThen ask an agent: "What tables are in the system database? Show recent slow queries from system.query_log grouped by minute."
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
Flicense-qualityAmaintenanceProduction-ready MCP server designed to empower AI agents and LLMs to interact seamlessly with ClickHouse. It exposes your ClickHouse database as a set of standardized tools and resources that adhere to the MCP protocol, making it easy for agents built on OpenAI, Claude, or other platforms to query, explore, and analyse your data.Last updated37- AlicenseAqualityAmaintenanceA read-only MCP server for exploratory data analysis across PostgreSQL, MySQL, and ClickHouse databases, providing safe, read-only access with comprehensive analysis capabilities.Last updated106MIT
- Flicense-qualityFmaintenanceA read-only MCP server that enables AI agents to explore database schemas and execute safe queries on PostgreSQL and MySQL.Last updated
- FlicenseAqualityCmaintenanceRead-only MCP server for ClickHouse that allows listing databases and tables, describing schemas, and running SELECT queries.Last updated4
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Hosted Amazon Seller Central and Amazon Ads MCP server for Claude, ChatGPT, Cursor, and agents.
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/jvanvalkenhoef/mcp_server_clickhouse'
If you have feedback or need assistance with the MCP directory API, please join our Discord server