ClickHouse MCP Server

Query your ClickHouse database server.

Local serverstdioPython

What is the ClickHouse MCP server?

Clickhouse mcp server connects ClickHouse to AI assistants that speak the Model Context Protocol. Query your ClickHouse database server.

What ClickHouse does

When running with HTTP or SSE transport, a health check endpoint is available at /health. This endpoint: - Returns 200 OK (body: OK) if the server is healthy and can connect to ClickHouse - Returns 503 Service Unavailable with a generic error message if the server cannot connect to ClickHouse

Tools it exposes

Once connected, the assistant can call these 4 tools directly:

  • Input — query (string): The SQL query to execute
  • tables — Array of table objects for the current page
  • next_page_token — Pass this value back to fetch the next page, or null when there are no more tables
  • total_tables — Total count of tables that match the supplied filters

Installing the clickhouse mcp server

The server is distributed via PyPI as mcp-clickhouse, so most clients can run it without a manual build step. Add it to your MCP client's configuration and restart the client to pick it up — the copy-paste configs for Claude Desktop, Claude Code and Cursor are on this page.

Configuration

The server reads 8 environment variables: CLICKHOUSE_HOST, CLICKHOUSE_PORT, CLICKHOUSE_USER, CLICKHOUSE_PASSWORD, CLICKHOUSE_ROLE, CLICKHOUSE_SECURE, CLICKHOUSE_VERIFY, CLICKHOUSE_CONNECT_TIMEOUT. Keep credentials in your client's env block or a secrets manager rather than committing them.

Where it fits

Database servers turn schema archaeology and ad-hoc reporting into conversation, which is why they tend to be the second or third server people install. ClickHouse sits in that group, and the shape of its toolset — Input, tables, next_page_token among others — tells you what it is really for. Worth comparing against the other databases servers in this directory before you commit to one, since several overlap in scope but differ sharply in setup cost and permissions.

Practical notes

  • This server runs locally, so it operates with whatever access your machine and its credentials already have. Scope that deliberately rather than by default.
  • Written in Python.
  • MCP clients ask for confirmation before each tool call by default. Keep that on while you learn what the clickhouse mcp server actually does with your data.
  • Every entry in this directory is reviewed by hand before it goes live, and details are checked against the project's own documentation.

Available tools

ToolWhat it does
Inputquery (string): The SQL query to execute.
tablesArray of table objects for the current page.
next_page_tokenPass this value back to fetch the next page, or null when there are no more tables.
total_tablesTotal count of tables that match the supplied filters.

How to install the ClickHouse MCP server

{
  "mcpServers": {
    "clickhouse": {
      "command": "uvx",
      "args": ["mcp-clickhouse"],
      "env": {
        "CLICKHOUSE_HOST": "your-value",
        "CLICKHOUSE_PORT": "your-value",
        "CLICKHOUSE_USER": "your-value",
        "CLICKHOUSE_PASSWORD": "your-value",
        "CLICKHOUSE_ROLE": "your-value",
        "CLICKHOUSE_SECURE": "your-value",
        "CLICKHOUSE_VERIFY": "your-value",
        "CLICKHOUSE_CONNECT_TIMEOUT": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

VariableDescriptionRequired
CLICKHOUSE_HOSTEndpoint or connection string the server talks to.Optional
CLICKHOUSE_PORTConfiguration value read at startup.Optional
CLICKHOUSE_USERConfiguration value read at startup.Optional
CLICKHOUSE_PASSWORDConfiguration value read at startup.Optional
CLICKHOUSE_ROLEConfiguration value read at startup.Optional
CLICKHOUSE_SECUREConfiguration value read at startup.Optional
CLICKHOUSE_VERIFYConfiguration value read at startup.Optional
CLICKHOUSE_CONNECT_TIMEOUTConfiguration value read at startup.Optional

Example prompts to try

  • Use ClickHouse to Input.
  • Use ClickHouse to tables.
  • Use ClickHouse to next page token.

Frequently asked questions

It connects ClickHouse to MCP-compatible AI assistants such as Claude and Cursor, exposing 4 tools (Input, tables, next_page_token, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with ClickHouse directly.