Skip to main content
Glama
mrsnurk32

cfm-dwh-mcp

by mrsnurk32

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, password

Related 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+C

Optional HTTP healthcheck:

cfm-dwh-mcp-health
curl -s http://127.0.0.1:8787/health

Docker

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 down

Credentials 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

host

ClickHouse host

port

HTTP port (usually 8123)

database

default analytics

user

CH user

password

CH password

Allowlist (NIK-17)

  • analytics.f_kafka_mobile_events

  • analytics.f_logistics

Verify

  1. Fill .env

  2. cfm-dwh-mcp-health then curl -s http://127.0.0.1:8787/health

  3. Point your MCP client at cfm-dwh-mcp; tools should include ping and list_allowed_tables. query_clickhouse is a stub until NIK-17.

Available Tools

3 tools
list_allowed_tablesList Allowed TablesA

List ClickHouse tables this MCP server is allowed to query (read-only).

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description states the tool is read-only, which is a behavioral trait. However, with no annotations provided, the description carries the full burden. It doesn't disclose whether the list is cached, whether it reflects live permissions, or what happens if no tables are allowed. Still, for a simple list operation, the read-only disclosure is adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is concise and front-loaded with the key information: what is listed and the read-only constraint. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, read-only list tool with an output schema present, the description is largely complete. It could mention whether the list is sorted or how permissions are determined, but these are minor gaps. The output schema likely covers the return structure.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so there is no parameter semantics burden. The description correctly implies no inputs are needed. The schema confirms this with an empty properties object. Baseline 4 for zero-param tools is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: listing ClickHouse tables the MCP server is allowed to query. It specifies the verb (list), the resource (ClickHouse tables), and the scope (allowed to query, read-only), which distinguishes it from the sibling query_clickhouse tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this is a discovery/preflight tool to see which tables are queryable, which is useful before calling query_clickhouse. It doesn't explicitly state when to use it vs alternatives, but the read-only qualifier and sibling context make the usage context clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

pingPingA

Health check: MCP alive; optionally verifies ClickHouse connectivity.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Despite having no annotations, the description explains what the tool does—performs a health check (likely non-destructive) and optionally verifies ClickHouse connectivity, meaning it may make an external connection. It does not fully disclose potential error conditions or timeout behavior, but for a simple health check this coverage is sufficient and accurate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no filler. It front-front loads the primary purpose (health check) and optional connectivity check, making it easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple (no parameters), has a schema, and an output schema exists. The description covers its essential function and optional behavior, leaving no meaningful information an agent would need to invoke it successfully.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

This tool accepts zero parameters, and the schema is empty (100% coverage trivially). No parameter explanation is required from the description. Baseline 4 applies since no parameters exist.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states a specific action ('health check') and resource ('MCP alive; optionally verifies ClickHouse connectivity'). It distinguishes itself from sibling tools like query_clickhouse and list_allowed_tables by focusing on liveness, not data access.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear context about when this tool is appropriate (to check if the MCP server is alive and optionally ClickHouse connection). It does not explicitly mention alternatives or exclusions, but the purpose is self-evident as a diagnostic tool and the sibling tools are obviously different in scope. This meets the 'clear context, no exclusions' criterion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

query_clickhouseQuery ClickhouseC

TODO NIK-17: run a read-only parameterized query against allowlisted analytics tables.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description is the only behavioral disclosure. It does usefully state that the operation is read-only and parameterized, and that the target must be an allowed table. However, it does not explain behavior on disallowed queries, error handling, timeouts, or output amplification, and the TODO marker suggests the description is unfinished.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One compact sentence, but it is front-loaded with 'TODO NIK-17', which is placeholder metadata rather than useful guidance. The remaining wording is tight and covers the core action, though at the cost of under-specification.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With a single parameter and an output schema present, the description does not need to document return values. Yet for a tool that executes arbitrary SQL, omitting the parameterized-query syntax and how allowlisting is enforced leaves a meaningful gap; the description is minimally viable rather than complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema provides zero description for the sql property, and the tool description only says it is a 'parameterized query.' It does not specify placeholder syntax, SQL dialect, statement restrictions, or an example, so the agent has to guess the expected value format beyond knowing it should be SQL.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific action ('run') and a specific resource ('allowlisted analytics tables'), and clarifies the query is read-only and parameterized. This clearly differentiates it from ping and list_allowed_tables, though it does not name them. The TODO prefix is noise but does not obscure the meaning.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance is given about when to choose this tool over ping or list_allowed_tables; the only hint is the phrase 'against allowlisted analytics tables,' which implies a data-query context. There are no when-to-use or when-not-to-use statements, so the agent must infer the boundary between querying and listing tables.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.0
    • First observedlist_allowed_tables
    • First observedping
    • First observedquery_clickhouse

TDQS

A3.8/5.0

Scored across 3 tools

Disambiguation5/5

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.

Naming Consistency4/5

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.

Tool Count5/5

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.

Completeness4/5

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

ActivityMaintained
ResponsivenessResponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables interaction with ClickHouse databases via MCP, providing tools to list databases and tables and execute safe SELECT, SHOW, and DESCRIBE queries.
    34 npm
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    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.
    6
    6 npm
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides governed, read-only PostgreSQL access for AI agents via MCP. Enforces schema/table allowlists, query limits, and audit events.
    MIT