cfm-dwh-mcp
Provides read-only query tools for ClickHouse analytics tables, enabling LLM clients to query data from specified tables (allowlisted).
Click on "Deploy 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., "@cfm-dwh-mcp what's the daily event count from f_kafka_mobile_events for the last week?"
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.
cfm-dwh-mcp
Python MCP server for Coffeemania DWH: lets an LLM client query ClickHouse analytics tables (read-only).
Linear: NIK-15 (scaffold), NIK-16 (auth/guards), NIK-17 (query tools), NIK-26 (Docker).
Stack: Python 3.11+ / FastMCP / clickhouse-connect.
Setup
python3.11 -m venv .venv
source .venv/bin/activate
pip install -e .
cp .env.example .env
# fill host, port, database, user, passwordRelated MCP server: clickhouse-mcp-server
Start / stop
MCP over stdio (Cursor / Claude Desktop / etc.):
cfm-dwh-mcp
# or: python -m cfm_dwh_mcp.server
# stop: Ctrl+COptional HTTP healthcheck:
cfm-dwh-mcp-health
curl -s http://127.0.0.1:8787/healthDocker
Runs cfm-dwh-mcp-health (HTTP on 8787) against existing ClickHouse. This compose file does not start ClickHouse or Qwen.
cp .env.example .env
# fill host, port, database, user, password
# if ClickHouse is on the Docker host, use host=host.docker.internal (not localhost)
docker compose up --build
# logs should show: health listening on http://0.0.0.0:8787/health
curl -s http://127.0.0.1:8787/health
docker compose downCredentials come from .env (env_file + read-only mount). They are not baked into the image.
Stdio MCP (cfm-dwh-mcp) is for a local MCP client, not the Compose service.
Config
Loaded from .env (exact lowercase keys; CLICKHOUSE_* aliases also work). Never commit .env.
Key | Meaning |
| ClickHouse host |
| HTTP port (usually |
| default |
| CH user |
| CH password |
Allowlist (NIK-17)
analytics.f_kafka_mobile_eventsanalytics.f_logistics
Verify
Fill
.envcfm-dwh-mcp-healththencurl -s http://127.0.0.1:8787/healthPoint your MCP client at
cfm-dwh-mcp; tools should includepingandlist_allowed_tables.query_clickhouseis a stub until NIK-17.
Available Tools
3 toolslist_allowed_tablesList Allowed TablesA
List ClickHouse tables this MCP server is allowed to query (read-only).
Inputs: no named parameters. Returns: result
pingPingA
Health check: MCP alive; optionally verifies ClickHouse connectivity.
Inputs: no named parameters. Returns: result
query_clickhouseQuery ClickhouseC
TODO NIK-17: run a read-only parameterized query against allowlisted analytics tables.
Inputs: sql (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
ping, list_allowed_tables, and query_clickhouse have clearly distinct purposes: health check, table discovery, and query execution. There is no overlap that would cause an agent to misselect.
All names are lowercase snake_case and verb-led, giving a consistent style. ping is a standalone verb rather than a verb_noun pair, but this is a minor and conventional deviation for a health check.
Three tools is small but well-scoped for a read-only ClickHouse gateway: connectivity check, allowlist discovery, and query execution. Each tool has a necessary and distinct role.
The core read-only workflow is covered: verify connectivity, list allowed tables, and run parameterized queries. The main gap is schema or column introspection, since list_allowed_tables exposes table names but not their structure.
Maintenance
Related MCP Connectors
Read-only Google Analytics 4 MCP server for AI assistants.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Read-only analytics for Convex apps, queryable via MCP from Claude, Cursor, and other clients.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with ClickHouse databases via MCP, providing tools to list databases and tables and execute safe SELECT, SHOW, and DESCRIBE queries.93 npmMIT
- FlicenseAqualityDmaintenanceRead-only MCP server for ClickHouse that allows listing databases and tables, describing schemas, and running SELECT queries.4-
- AlicenseAqualityDmaintenanceA 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.6MIT

MCP DB Gatewayofficial
AlicenseNot gradedqualityDmaintenanceProvides governed, read-only PostgreSQL access for AI agents via MCP. Enforces schema/table allowlists, query limits, and audit events.1MIT