Skip to main content
Glama
Aguantar

io.github.Aguantar/clickhouse-dataops-mcp

by Aguantar
README.md
# clickhouse-dataops-mcp

mcp-name: io.github.Aguantar/clickhouse-dataops-mcp

A DataOps-focused MCP server for ClickHouse with query optimization, pipeline latency analysis, and data quality monitoring.

## Features

Unlike generic ClickHouse MCP servers that only run queries, this server acts as a **query optimization advisor**:

- **`ch_query`** — Execute SELECT with automatic partition pruning warnings
- **`ch_explain_query`** — EXPLAIN-based analysis with optimization suggestions
- **`ch_table_schema`** — Comprehensive table metadata (columns, keys, partitions, samples)
- **`ch_pipeline_latency`** — CDC pipeline per-segment latency (p50/p95/p99)
- **`ch_data_quality`** — Null/duplicate/gap detection with market coverage checks
- **`ch_slow_queries`** — Slow query detection with root cause diagnosis
- **`ch_disk_usage`** — Disk analysis with TTL and optimization recommendations
- **`ch_list_tables`** — Table catalog with built-in descriptions

## Safety

All queries are read-only. DDL/DML operations are blocked at the SQL validation layer:

- Blocked: `DROP`, `TRUNCATE`, `DELETE`, `ALTER`, `INSERT`, `UPDATE`, `CREATE`, etc.
- Multi-statement queries blocked (`;` separator)
- Comment-based bypass prevented (comments stripped before validation)
- System tables restricted to allowlist
- Query timeout: 30 seconds
- Row limit enforcement

## Installation

```bash
pip install clickhouse-dataops-mcp
```

## Usage with Claude Code

Add to your `.mcp.json`:

```json
{
  "mcpServers": {
    "clickhouse": {
      "command": "clickhouse-mcp-server",
      "env": {
        "CLICKHOUSE_HOST": "localhost",
        "CLICKHOUSE_PORT": "8123",
        "CLICKHOUSE_DATABASE": "cdc_pipeline"
      }
    }
  }
}
```

## Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `CLICKHOUSE_HOST` | `localhost` | ClickHouse HTTP host |
| `CLICKHOUSE_PORT` | `8123` | ClickHouse HTTP port |
| `CLICKHOUSE_USER` | `default` | ClickHouse username |
| `CLICKHOUSE_PASSWORD` | (empty) | ClickHouse password |
| `CLICKHOUSE_DATABASE` | `cdc_pipeline` | Default database |
| `CLICKHOUSE_QUERY_TIMEOUT` | `30` | Query timeout in seconds |

## License

MIT

TDQS

A4.2/5.0

Scored across 8 tools

Disambiguation5/5

Each tool has a distinct purpose: data quality checks, disk usage, query analysis, table listing, pipeline latency, query execution, slow query diagnosis, and schema details. No two tools overlap in functionality; descriptions clearly differentiate them.

Naming Consistency4/5

All tools share the 'ch_' prefix. Most use a verb_noun pattern (e.g., ch_list_tables, ch_explain_query), but 'ch_query' is just a noun and 'ch_slow_queries' is adjective_noun, causing minor inconsistency. Overall pattern is clear.

Tool Count5/5

With 8 tools, the server covers a focused data operations scope without being overloaded. Each tool addresses a specific need, and the count feels well-scoped for managing and optimizing ClickHouse.

Completeness5/5

The tool set covers essential dataops tasks: exploring tables, checking schema, running queries, analyzing slow queries, explaining plans, monitoring pipeline latency, checking data quality, and disk usage. No obvious gaps for a read-optimized monitoring tool.

Maintenance

ActivityInactive
ResponsivenessNo issues