# ClickHouse MCP server

> Run read-only SQL and explore databases and tables on any ClickHouse cluster or in the embedded chDB engine.

- Listing: https://mcp.tc/i/clickhouse
- Connect: this is a local (stdio) server; install it on your machine (see Install). The listing link is a page, not an MCP endpoint.
- Type: local (stdio)
- Auth: API key
- Category: [Databases & Backend](https://mcp.tc/c/databases)
- Vendor: ClickHouse
- Verified: yes, mcp.tc checked that this is the official server (https://mcp.tc/verify). It says who runs the server, not that it is safe.
- Homepage: <https://github.com/ClickHouse/mcp-clickhouse>
- Repository: <https://github.com/ClickHouse/mcp-clickhouse>
- Package: pypi `mcp-clickhouse`

## About

Connects an assistant to a ClickHouse cluster or to chDB, the embedded ClickHouse engine. It can run SQL queries, list databases, list tables with pagination and filters, and run SELECT queries through chDB. Queries are read-only by default, and writes can be enabled explicitly. Parameterized queries with typed placeholders are supported.

Runs locally over stdio with uvx mcp-clickhouse (PyPI package), or as the ghcr.io/clickhouse/mcp-clickhouse container image. It needs CLICKHOUSE\_HOST and CLICKHOUSE\_USER, plus CLICKHOUSE\_PASSWORD unless a client certificate is used. Optional variables set the port, TLS options, default database and role.

## What it can do

- Run SQL queries on a ClickHouse cluster, read-only by default
- List all databases on the cluster
- List tables in a database with LIKE filters and pagination
- Bind typed query parameters with ClickHouse placeholders
- Check a query with DESCRIBE or EXPLAIN ESTIMATE before running it
- Run SELECT queries on the embedded chDB engine

## Example prompts

- "List all databases on my ClickHouse cluster."
- "Show the tables in the analytics database that start with events\_."
- "Count rows per day in default.events for the last 30 days."
- "Estimate how many rows this query would read before running it."

## Install

### Claude Code

1. Run this in a terminal, in your project folder:

```bash
claude mcp add --transport stdio clickhouse --env "CLICKHOUSE_HOST=<YOUR_CLICKHOUSE_HOST>" --env "CLICKHOUSE_USER=<YOUR_CLICKHOUSE_USER>" --env "CLICKHOUSE_PASSWORD=<YOUR_CLICKHOUSE_PASSWORD>" -- uvx mcp-clickhouse
```

2. Start Claude Code and type `/mcp`. **clickhouse** should show as connected.

Add `--scope user` to make it available in every project. Replace the placeholders with your own values.

### Claude Desktop

1. Open **Settings → Developer → Edit Config**. It opens `claude_desktop_config.json`. Add:

`claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "clickhouse": {
      "command": "uvx",
      "args": [
        "mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_HOST": "<YOUR_CLICKHOUSE_HOST>",
        "CLICKHOUSE_USER": "<YOUR_CLICKHOUSE_USER>",
        "CLICKHOUSE_PASSWORD": "<YOUR_CLICKHOUSE_PASSWORD>"
      }
    }
  }
}
```

2. Save the file and restart Claude Desktop. Replace the placeholders with your own values.

Needs uv (Python) on your computer. The file lives in `~/Library/Application Support/Claude/` on macOS and `%APPDATA%\Claude\` on Windows.

### Cursor

[Add to Cursor](<https://cursor.com/install-mcp?name=clickhouse&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyJtY3AtY2xpY2tob3VzZSJdLCJlbnYiOnsiQ0xJQ0tIT1VTRV9IT1NUIjoiPFlPVVJfQ0xJQ0tIT1VTRV9IT1NUPiIsIkNMSUNLSE9VU0VfVVNFUiI6IjxZT1VSX0NMSUNLSE9VU0VfVVNFUj4iLCJDTElDS0hPVVNFX1BBU1NXT1JEIjoiPFlPVVJfQ0xJQ0tIT1VTRV9QQVNTV09SRD4ifX0%3D>) (opens Cursor)

Or add it by hand to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (this project):

`mcp.json`:

```json
{
  "mcpServers": {
    "clickhouse": {
      "command": "uvx",
      "args": [
        "mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_HOST": "<YOUR_CLICKHOUSE_HOST>",
        "CLICKHOUSE_USER": "<YOUR_CLICKHOUSE_USER>",
        "CLICKHOUSE_PASSWORD": "<YOUR_CLICKHOUSE_PASSWORD>"
      }
    }
  }
}
```

Needs uv (Python) on your computer. Replace the placeholders with your own values.

### VS Code

Add it to `.vscode/mcp.json`. VS Code asks for the secret the first time and stores it securely:

`.vscode/mcp.json`:

```json
{
  "servers": {
    "clickhouse": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_HOST": "<YOUR_CLICKHOUSE_HOST>",
        "CLICKHOUSE_USER": "<YOUR_CLICKHOUSE_USER>",
        "CLICKHOUSE_PASSWORD": "${input:clickhouse-password}"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "clickhouse-password",
      "description": "CLICKHOUSE_PASSWORD",
      "password": true
    }
  ]
}
```

Needs uv (Python) on your computer.

### Devin Desktop

1. Add it to `~/.config/devin/mcp_config.json` (macOS and Linux) or `%APPDATA%\devin\mcp_config.json` (Windows):

`mcp_config.json`:

```json
{
  "mcpServers": {
    "clickhouse": {
      "command": "uvx",
      "args": [
        "mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_HOST": "<YOUR_CLICKHOUSE_HOST>",
        "CLICKHOUSE_USER": "<YOUR_CLICKHOUSE_USER>",
        "CLICKHOUSE_PASSWORD": "<YOUR_CLICKHOUSE_PASSWORD>"
      }
    }
  }
}
```

2. Refresh the MCP server list in Cascade. Replace the placeholders with your own values.

Devin Desktop is the new name for Windsurf.

### Codex

```bash
codex mcp add clickhouse --env "CLICKHOUSE_HOST=<YOUR_CLICKHOUSE_HOST>" --env "CLICKHOUSE_USER=<YOUR_CLICKHOUSE_USER>" --env "CLICKHOUSE_PASSWORD=<YOUR_CLICKHOUSE_PASSWORD>" -- uvx mcp-clickhouse
```

Or edit `~/.codex/config.toml` directly:

`config.toml`:

```toml
[mcp_servers.clickhouse]
command = "uvx"
args = ["mcp-clickhouse"]
env = { CLICKHOUSE_HOST = "<YOUR_CLICKHOUSE_HOST>", CLICKHOUSE_USER = "<YOUR_CLICKHOUSE_USER>", CLICKHOUSE_PASSWORD = "<YOUR_CLICKHOUSE_PASSWORD>" }
```

Needs uv (Python) on your computer. Replace the placeholders with your own values.

### Gemini CLI

```bash
gemini mcp add -e "CLICKHOUSE_HOST=<YOUR_CLICKHOUSE_HOST>" -e "CLICKHOUSE_USER=<YOUR_CLICKHOUSE_USER>" -e "CLICKHOUSE_PASSWORD=<YOUR_CLICKHOUSE_PASSWORD>" clickhouse uvx mcp-clickhouse
```

This adds it to the current project. Add `-s user` to use it everywhere.

### Any client

Most clients that start local servers accept this shape:

```json
{
  "mcpServers": {
    "clickhouse": {
      "command": "uvx",
      "args": [
        "mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_HOST": "<YOUR_CLICKHOUSE_HOST>",
        "CLICKHOUSE_USER": "<YOUR_CLICKHOUSE_USER>",
        "CLICKHOUSE_PASSWORD": "<YOUR_CLICKHOUSE_PASSWORD>"
      }
    }
  }
}
```

Zed puts servers under `context_servers` in its settings, with the same `command`, `args` and `env` fields.

Needs uv (Python) on your computer. Replace the placeholders with your own values.

## Details

- Server version: 0.7.0
- Last checked: 2026-10-03
- Listed: 2026-10-03
- Updated: 2026-10-04

---
Source: https://mcp.tc/i/clickhouse (mcp.tc is an independent directory, not affiliated with this server's publisher). Corrections: https://mcp.tc/report
