io.github.dockndevai/mcp-clickhouse

Registre officiel Données et bases de données

ClickHouse query & management for AI agents — SQL-classified read/write/destructive gating.

Que pouvez-vous faire avec io.github.dockndevai/mcp-clickhouse ?

  • Exploration & monitoring — databases, tables, columns, SHOW CREATE, table stats (parts/rows/bytes), running queries, server metrics, cluster topology.
  • Read queries — a query tool that only accepts read statements, capped at CLICKHOUSE_MAX_ROWS.
  • Management — an execute tool for INSERT/CREATE/ALTER (read-write) and DROP/TRUNCATE/DELETE (admin), each gated by classification.
  • Access modes — read-only → read-write → admin, layered so a mode never exposes statements above its level.
  • Security flags — database allowlist, protected databases, destructive gating, row cap, dry-run, and JSON audit logging (see below).

Installation

Ajoutez ceci à la configuration MCP de votre client (Claude Desktop : claude_desktop_config.json ; Cursor : .cursor/mcp.json ; VS Code et les autres utilisent la même forme « mcpServers »).

NPM package @dockndevai/mcp-clickhouse
Claude Code
claude mcp add mcp-clickhouse -e 'CLICKHOUSE_URL=<CLICKHOUSE_URL>' -e 'CLICKHOUSE_USER=<CLICKHOUSE_USER>' -e 'CLICKHOUSE_PASSWORD=<your clickhouse_password>' -e 'CLICKHOUSE_MODE=<CLICKHOUSE_MODE>' -- npx -y @dockndevai/mcp-clickhouse@0.3.0
Configuration JSON (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "mcp-clickhouse": {
            "command": "npx",
            "args": [
                "-y",
                "@dockndevai/mcp-clickhouse@0.3.0"
            ],
            "env": {
                "CLICKHOUSE_URL": "<CLICKHOUSE_URL>",
                "CLICKHOUSE_USER": "<CLICKHOUSE_USER>",
                "CLICKHOUSE_PASSWORD": "<your clickhouse_password>",
                "CLICKHOUSE_MODE": "<CLICKHOUSE_MODE>"
            }
        }
    }
}

Variables d'environnement

  • CLICKHOUSE_URL ClickHouse HTTP endpoint.
  • CLICKHOUSE_USER ClickHouse user (prefer a read-only user).
  • CLICKHOUSE_PASSWORD secret ClickHouse password.
  • CLICKHOUSE_MODE Access mode: read-only | read-write | admin.

Documentation

Tirée du README du projet sur GitHub, actualisée chaque semaine. Les liens ouvrent GitHub.

Sommaire
  1. mcp-clickhouse
  2. Features
  3. Security model
  4. Tools
  5. Quickstart — add to your agent
  6. Example prompts
  7. Run from source (development)
  8. Develop
  9. Publishing
  10. License

mcp-clickhouse

A Model Context Protocol server for ClickHouse. It lets an MCP-capable client (Claude Desktop, Claude Code, etc.) explore schemas, run analytical queries, and manage the database — with behaviour controlled entirely by flags.

The security model is statement-aware: every SQL statement is classified as read, write, or destructive, and gated against the current access mode. Read-only mode additionally runs queries under ClickHouse's own readonly=1 setting.

Features

  • Exploration & monitoring — databases, tables, columns, SHOW CREATE, table stats (parts/rows/bytes), running queries, server metrics, cluster topology.
  • Read queries — a query tool that only accepts read statements, capped at CLICKHOUSE_MAX_ROWS.
  • Management — an execute tool for INSERT/CREATE/ALTER (read-write) and DROP/TRUNCATE/DELETE (admin), each gated by classification.
  • Access modes — read-only → read-write → admin, layered so a mode never exposes statements above its level.
  • Security flags — database allowlist, protected databases, destructive gating, row cap, dry-run, and JSON audit logging (see below).

Security model

ConcernFlagDefaultEffect
What can the server do?CLICKHOUSE_MODEread-onlyread-only exposes read tools only (and refuses non-SELECT in query); read-write adds execute for writes; admin allows destructive statements.
Which databases are in scope?CLICKHOUSE_DATABASE_ALLOWLIST(all)When set, operations on other databases are refused.
Which databases are read-only forever?CLICKHOUSE_PROTECTED_DATABASESsystem,information_schemaReadable, never mutable.
Can it run destructive SQL?CLICKHOUSE_ALLOW_DELETEfalseDROP/TRUNCATE/DELETE/… need this and admin mode.
Result size capCLICKHOUSE_MAX_ROWS1000Hard cap on rows returned to the model.
Preview without executingCLICKHOUSE_DRY_RUNfalseWrite/destructive statements validate + log intent, then return.
Audit trailCLICKHOUSE_AUDIT_LOGtrueEmits a JSON line to stderr per guarded operation.
Interactive confirmation(automatic)—Destructive & high-impact actions prompt the human to approve via MCP elicitation before running; clients without elicitation fall back to the *_ALLOW_* gate.

Statement classification lives in src/sql.ts and is fail-safe: ALTER … DELETE/UPDATE counts as destructive, and anything unparseable is treated as destructive.

Tools

Read (read-only+): list_databases, list_tables, describe_table, show_create_table, table_stats, running_queries, server_metrics, cluster_info, query

Write/Admin (read-write+): execute — runs a single statement after classifying it; writes need read-write mode, destructive statements need admin mode + CLICKHOUSE_ALLOW_DELETE.

Quickstart — add to your agent

Published on npm as @dockndevai/mcp-clickhouse. No clone or build needed — your MCP client runs it on demand with npx. Start in read-only mode; see .env.example for every variable and docs/CLIENTS.md for the full per-client guide.

Claude Code (CLI)

claude mcp add clickhouse -e CLICKHOUSE_URL="http://localhost:8123" -e CLICKHOUSE_USER="default" -e CLICKHOUSE_MODE="read-only" -- npx -y @dockndevai/mcp-clickhouse

Claude Desktop · Cursor · Windsurf — same block in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "clickhouse": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_URL": "http://localhost:8123",
        "CLICKHOUSE_USER": "default",
        "CLICKHOUSE_MODE": "read-only"
      }
    }
  }
}

OpenAI Codex CLI — in ~/.codex/config.toml:

[mcp_servers.clickhouse]
command = "npx"
args = ["-y", "@dockndevai/mcp-clickhouse"]
env = { CLICKHOUSE_URL = "http://localhost:8123", CLICKHOUSE_USER = "default", CLICKHOUSE_MODE = "read-only" }

VS Code (GitHub Copilot, Agent mode) — in .vscode/mcp.json:

{
  "servers": {
    "clickhouse": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_URL": "http://localhost:8123",
        "CLICKHOUSE_USER": "default",
        "CLICKHOUSE_MODE": "read-only"
      }
    }
  }
}

Example prompts

  • "What are the biggest tables in the analytics database?"
  • "Show me the schema for events and run a query for daily counts this week."
  • "Which queries are currently running and using the most memory?"

Run from source (development)

Prefer the published package above. To run from a clone:

npm install
npm run build
node dist/index.js   # with the environment variables set

Develop

npm run dev
npm test          # SQL classification + security policy (30 tests)
npm run typecheck

Publishing

This server ships a server.json for the official MCP registry and an mcpName for npm ownership validation. See PUBLISHING.md for publishing to npm and listing on the MCP registry, Smithery, Glama, Cursor, and PulseMCP.

License

MIT

Questions fréquentes

Qu'est-ce que io.github.dockndevai/mcp-clickhouse ?

ClickHouse query & management for AI agents — SQL-classified read/write/destructive gating.

Comment installer io.github.dockndevai/mcp-clickhouse ?

Il s'exécute sur votre machine. Dans Claude Code : claude mcp add mcp-clickhouse -e 'CLICKHOUSE_URL=<CLICKHOUSE_URL>' -e 'CLICKHOUSE_USER=<CLICKHOUSE_USER>' -e 'CLICKHOUSE_PASSWORD=<your clickhouse_password>' -e 'CLICKHOUSE_MODE=<CLICKHOUSE_MODE>' -- npx -y @dockndevai/mcp-clickhouse@0.3.0. Pour les autres clients, collez la configuration JSON de cette page dans leurs réglages MCP.

Faut-il une clé API pour io.github.dockndevai/mcp-clickhouse ?

Oui. Il attend CLICKHOUSE_PASSWORD, à renseigner dans sa configuration.

io.github.dockndevai/mcp-clickhouse est-il open source ?

Oui. Son code est sur GitHub sous licence MIT.

Qui maintient io.github.dockndevai/mcp-clickhouse ?

Il est publié par dockndevai. AI.tn le référence sans le maintenir ni le recommander.

Issu du registre MCP officiel. Être listé n'est pas une recommandation : vérifiez le code et les permissions d'un serveur avant de lui donner accès à vos données.