MCP Servers · Publisher repository

ClickHouse MCP Server

ClickHouse’s official MCP server lets hosts such as Claude Desktop discover databases and table schemas, execute SQL, and analyze results. It defaults to read-only access, supports named parameters and optional chDB, and requires a dedicated database user with minimal grants for production.

903 StarsApache-2.0PythonUpdated 23 days ago
01

Project overview

Before an agent can analyze ClickHouse data, it needs to discover the databases, tables, and columns. ClickHouse MCP Server exposes discovery and SQL execution as MCP tools. A local process connects to the database and returns results to the host. It suits interactive exploration of an existing ClickHouse deployment and includes a public Playground setup for a first connection. This assessment is based on the README, v0.7.0 release notes, and source review; installation and functionality were not tested.

02

Core capabilities

01

Discover the schema

Start with list_databases, then inspect columns, types, and table information with list_tables. Pagination defaults to 50 tables per page; name filters help avoid dumping a large schema.

02

Run parameterized SQL

run_query accepts query and optional params with {name:Type} binding, added in v0.7.0. Tool responses return to the MCP client as JSON-encoded strings.

03

Inspect a query before execution

Use run_query with DESCRIBE (<query>) to inspect output columns or EXPLAIN ESTIMATE to estimate reads. Analysis can execute scalar subqueries, so these checks can still incur costs.

04

Choose a deployment transport

Use stdio locally. HTTP mode provides Streamable HTTP and needs separate MCP authentication, Host, and Origin settings. Database HTTPS settings do not configure the inbound endpoint.

03

Setup and connection

Start with the README’s public SQL Playground configuration to connect ClickHouse MCP Server to Claude Desktop. Verify tool discovery and a minimal parameterized query before separately evaluating credentials and grants for your own database.

AI AGENT INSTALL

Let an AI Agent install it

Send this prompt to Codex, Claude Code, or another AI agent that can work with your local environment.

Help me connect ClickHouse MCP Server to Claude Desktop from https://github.com/ClickHouse/mcp-clickhouse. Read the current README, v0.7.0 README, pyproject.toml, and release notes, and identify the package version being installed. Use the README’s public SQL Playground configuration with uv, Python 3.12, and stdio. Back up and merge existing mcpServers entries, keep default read-only access, and leave chDB disabled. Locate the actual uv executable for this system. After restarting, check for the three ClickHouse tools, call list_databases, and run the README’s named-parameter query. Report actual results. Ask before using real credentials, granting additional permissions, or overwriting existing files. Do not connect a private database or enable writes automatically.
01Before you start
  • Install Claude Desktop and uv, and allow uv to obtain Python 3.12 and Python packages.
  • Allow access to the official public Playground. This example requires no private data or real password.
  • Back up the host configuration and preserve existing mcpServers entries.
02Copy the install command or configuration
{
  "mcpServers": {
    "mcp-clickhouse": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp-clickhouse",
        "--python",
        "3.12",
        "mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_HOST": "sql-clickhouse.clickhouse.com",
        "CLICKHOUSE_PORT": "8443",
        "CLICKHOUSE_USER": "demo",
        "CLICKHOUSE_PASSWORD": "",
        "CLICKHOUSE_SECURE": "true",
        "CLICKHOUSE_VERIFY": "true",
        "CLICKHOUSE_CONNECT_TIMEOUT": "30"
      }
    }
  }
}
03Complete the setup steps
  1. 1
    Locate and back up the host configuration

    On macOS, use ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows, use %APPDATA%/Claude/claude_desktop_config.json. Back up the file, then merge the complete Playground configuration provided in the acquisition section while preserving existing servers.

  2. 2
    Save the public sample configuration and restart

    The supplied JSON uses sql-clickhouse.clickhouse.com, the demo user, and an empty password from the official public example. Keep HTTPS and certificate verification enabled. Check the executable with which uv and use its absolute path for command if necessary. Save and restart Claude Desktop.

  3. 3
    Discover tools and run a minimal query

    Approve tool calls against the public sample, call list_databases, and pass the following arguments to run_query. Expect a single row of constant values. ```json { "query": "SELECT {id:UInt32} AS id, {name:String} AS name", "params": {"id": 13, "name": "O'Reilly"} } ``` After confirming the result, use list_tables to inspect the target database.

  4. 4
    Review grants before connecting your own database

    Replace the Playground host, port, user, and password with your own HTTP endpoint and dedicated account in secure local configuration. Keep read-only defaults and leave write and destructive-operation flags disabled. Review host data handling, query costs, and account isolation before querying approved data.

How to verify the setup

After restarting Claude Desktop, check for list_databases, list_tables, and run_query. Call list_databases, then run the tutorial’s named-parameter example. Expect one row with id 13 and name O'Reilly. This is a verification procedure, not a test performed in this run.

Before using it
  • The configuration is copied verbatim from the v0.7.0 README and does not pin a package version. Record the version resolved when launching.
  • If the graphical host cannot find uv, use which uv and supply its absolute executable path.
  • For a private database, use a dedicated least-privilege account and keep TLS verification enabled. Use HTTP interface ports such as 8443/8123, not 9000/9440.
  • The default query timeout is 30 seconds and the server attempts cancellation on timeout. Read-only exploration still needs query-cost controls.
04

Use cases

SCENARIO 01

Explore an unfamiliar analytics database

List databases and tables, then use columns and comments to prepare queries when taking over an existing ClickHouse dataset.

SCENARIO 02

Draft and inspect SQL

Have an agent prepare parameterized queries and inspect output or estimated reads with DESCRIBE or EXPLAIN ESTIMATE. Review metric definitions and permitted query scope yourself.

SCENARIO 03

Learn MCP setup using public data

Use the public Playground to check tool discovery, parameter binding, and result formatting before supplying private database credentials.

05

Assessment

The public evidence supports inclusion because the project is maintained by the official organization, includes a directly usable connection configuration, and documents parameter binding, read-only defaults, and remote authentication in detail. Query and authentication modules back those descriptions, and release notes explain upgrade changes. It suits users prepared to manage database permissions. Compatibility with a specific host version, network, and workload still needs testing. Stars indicate attention only.

Why it may be useful

  • Officially maintained repository with implementation, tests, releases, and installation configuration.
  • Core tools cover schema discovery and query execution; v0.7.0 adds named parameters.
  • Documentation distinguishes database TLS, MCP endpoint authentication, and read-only limitations.

What to know first

  • Host integration, query correctness, and performance were not tested in this run.
  • Read-only queries still involve data disclosure, cost, and same-account query cancellation.
  • Main differs from the release, and legacy SSE is deprecated.
  • No standalone SECURITY.md was found. Official ownership does not establish a security guarantee.
06

README

ClickHouse MCP Server


Overview

ClickHouse’s official MCP server lets hosts such as Claude Desktop discover databases and table schemas, execute SQL, and analyze results. It defaults to read-only access, supports named parameters and optional chDB, and requires a dedicated database user with minimal grants for production. Connect ClickHouse to your AI assistants.

Getting started

  • Start with the README’s public SQL Playground configuration to connect ClickHouse MCP Server to Claude Desktop. Verify tool discovery and a minimal parameterized query before separately evaluating credentials and grants for your own database.
  • list_databases discovers databases, list_tables provides paginated table metadata, and run_query executes SQL with ClickHouse named parameters.
  • Local hosts can use the default stdio transport. New remote deployments can use Streamable HTTP; the older standalone SSE transport is deprecated.
  • After restarting Claude Desktop, check for list_databases, list_tables, and run_query. Call list_databases, then run the tutorial’s named-parameter example. Expect one row with id 13 and name O'Reilly. This is a verification procedure, not a test performed in this run.

Configuration

{
  "mcpServers": {
    "mcp-clickhouse": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp-clickhouse",
        "--python",
        "3.12",
        "mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_HOST": "sql-clickhouse.clickhouse.com",
        "CLICKHOUSE_PORT": "8443",
        "CLICKHOUSE_USER": "demo",
        "CLICKHOUSE_PASSWORD": "",
        "CLICKHOUSE_SECURE": "true",
        "CLICKHOUSE_VERIFY": "true",
        "CLICKHOUSE_CONNECT_TIMEOUT": "30"
      }
    }
  }
}
Read the complete README on GitHub →