clickhouse-mcp
A read-only MCP server for ClickHouse that enables AI agents to discover schema, sample data, and run read-only SQL queries to investigate observability data like logs, metrics, and traces.
README
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 |
|---|---|
list_databases |
SHOW DATABASES |
list_tables |
SHOW TABLES FROM <db> |
describe_table |
DESCRIBE TABLE <db>.<table> |
show_create_table |
SHOW CREATE TABLE (schema + engine + settings) |
sample_rows |
SELECT * FROM <db>.<table> LIMIT n (peek at the shape) |
query |
Arbitrary read-only SQL (SELECT/WITH/SHOW/DESCRIBE/EXPLAIN) |
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 auth
Verify it talks to ClickHouse
npm run self-test
# Connecting to http://localhost:8123
# databases: [ 'default', 'system', 'INFORMATION_SCHEMA', ... ]
# version: [ { v: '25.x.x.x' } ]
# OK
Run as an MCP server (stdio)
npm start
Use 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.ts
MCP Inspector (great for debugging the tools directly):
npx @modelcontextprotocol/inspector npx tsx src/index.ts
Then ask an agent: "What tables are in the system database? Show recent slow queries from system.query_log grouped by minute."
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.