databases

ClickHouse

ClickHouse

by ClickHouse

Unlock powerful OLAP database analytics on ClickHouse MCP Server. Manage OLAP data with seamless online analytical proce

Unlock powerful analytics with the ClickHouse MCP Server—seamlessly run, explore, and manage SQL queries across ClickHouse clusters or with chDB’s embedded OLAP engine. This server offers easy database and table listing, safe query execution, and flexible access to data from files, URLs, or databases. Built-in health checks ensure reliability, while support for both ClickHouse and chDB enables robust data workflows for any project.

github stars

707

0 commentsdiscussion

Both formats append explainx.ai attribution and the canonical URL for this MCP server listing.

Read-only mode availableEnvironment-based configuration

best for

  • / Data analysts exploring ClickHouse datasets
  • / Developers debugging database queries
  • / Business users creating ad-hoc reports

capabilities

  • / Connect to ClickHouse databases
  • / Execute SQL queries
  • / Retrieve query results in JSON format
  • / Run multiple queries in sequence
  • / Switch between different databases

what it does

Connects to ClickHouse databases to execute SQL queries and retrieve results in JSON format. Enables data analysis and exploration through conversational interfaces.

about

ClickHouse is an official MCP server published by ClickHouse that provides AI assistants with tools and capabilities via the Model Context Protocol. Unlock powerful OLAP database analytics on ClickHouse MCP Server. Manage OLAP data with seamless online analytical proce It is categorized under databases.

how to install

You can install ClickHouse in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

license

Apache-2.0

ClickHouse is released under the Apache-2.0 license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

readme

ClickHouse MCP Server

PyPI - Version

An MCP server for ClickHouse.

<a href="https://glama.ai/mcp/servers/yvjy4csvo1"><img width="380" height="200" src="https://glama.ai/mcp/servers/yvjy4csvo1/badge" alt="mcp-clickhouse MCP server" /></a>

Features

ClickHouse Tools

  • run_query

    • Execute SQL queries on your ClickHouse cluster.
    • Input: query (string): The SQL query to execute.
    • Queries run in read-only mode by default (CLICKHOUSE_ALLOW_WRITE_ACCESS=false), but writes can be enabled explicitly if needed.
  • list_databases

    • List all databases on your ClickHouse cluster.
  • list_tables

    • List tables in a database with pagination.
    • Required input: database (string).
    • Optional inputs:
      • like / not_like (string): Apply LIKE or NOT LIKE filters to table names.
      • page_token (string): Token returned by a previous call for fetching the next page.
      • page_size (int, default 50): Number of tables returned per page.
      • include_detailed_columns (bool, default true): When false, omits column metadata for lighter responses while keeping the full create_table_query.
    • Response shape:
      • 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.

chDB Tools

  • run_chdb_select_query
    • Execute SQL queries using chDB's embedded ClickHouse engine.
    • Input: query (string): The SQL query to execute.
    • Query data directly from various sources (files, URLs, databases) without ETL processes.

Health Check Endpoint

When running with HTTP or SSE transport, a health check endpoint is available at /health. This endpoint:

  • Returns 200 OK with the ClickHouse version if the server is healthy and can connect to ClickHouse
  • Returns 503 Service Unavailable if the server cannot connect to ClickHouse

Example:

curl http://localhost:8000/health
# Response: OK - Connected to ClickHouse 24.3.1

Security

Authentication for HTTP/SSE Transports

When using HTTP or SSE transport, authentication is required by default. The stdio transport (default) does not require authentication as it only communicates via standard input/output.

Setting Up Authentication

  1. Generate a secure token (can be any random string):

    # Using uuidgen (macOS/Linux)
    uuidgen
    
    # Using openssl
    openssl rand -hex 32
    
  2. Configure the server with the token:

    export CLICKHOUSE_MCP_AUTH_TOKEN="your-generated-token"
    
  3. Configure your MCP client to include the token in requests:

    For Claude Desktop with HTTP/SSE transport:

    {
      "mcpServers": {
        "mcp-clickhouse": {
          "url": "http://127.0.0.1:8000",
          "headers": {
            "Authorization": "Bearer your-generated-token"
          }
        }
      }
    }
    

    For command-line tools:

    curl -H "Authorization: Bearer your-generated-token" http://localhost:8000/health
    

Development Mode (Disabling Authentication)

For local development and testing only, you can disable authentication by setting:

export CLICKHOUSE_MCP_AUTH_DISABLED=true

WARNING: Only use this for local development. Do not disable authentication when the server is exposed to any network.

Configuration

This MCP server supports both ClickHouse and chDB. You can enable either or both depending on your needs.

  1. Open the Claude Desktop configuration file located at:

    • On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • On Windows: %APPDATA%/Claude/claude_desktop_config.json
  2. Add the following:

{
  "mcpServers": {
    "mcp-clickhouse": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp-clickhouse",
        "--python",
        "3.10",
        "mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_HOST": "<clickhouse-host>",
        "CLICKHOUSE_PORT": "<clickhouse-port>",
        "CLICKHOUSE_USER": "<clickhouse-user>",
        "CLICKHOUSE_PASSWORD": "<clickhouse-password>",
        "CLICKHOUSE_ROLE": "<clickhouse-role>",
        "CLICKHOUSE_SECURE": "true",
        "CLICKHOUSE_VERIFY": "true",
        "CLICKHOUSE_CONNECT_TIMEOUT": "30",
        "CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30"
      }
    }
  }
}

Update the environment variables to point to your own ClickHouse service.

Or, if you'd like to try it out with the ClickHouse SQL Playground, you can use the following config:

{
  "mcpServers": {
    "mcp-clickhouse": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp-clickhouse",
        "--python",
        "3.10",
        "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",
        "CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30"
      }
    }
  }
}

For chDB (embedded ClickHouse engine), add the following configuration:

{
  "mcpServers": {
    "mcp-clickhouse": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp-clickhouse",
        "--python",
        "3.10",
        "mcp-clickhouse"
      ],
      "env": {
        "CHDB_ENABLED": "true",
        "CLICKHOUSE_ENABLED": "false",
        "CHDB_DATA_PATH": "/path/to/chdb/data"
      }
    }
  }
}

You can also enable both ClickHouse and chDB simultaneously:

{
  "mcpServers": {
    "mcp-clickhouse": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp-clickhouse",
        "--python",
        "3.10",
        "mcp-clickhouse"
      ],
      "env": {
        "CLICKHOUSE_HOST": "<clickhouse-host>",
        "CLICKHOUSE_PORT": "<clickhouse-port>",
        "CLICKHOUSE_USER": "<clickhouse-user>",
        "CLICKHOUSE_PASSWORD": "<clickhouse-password>",
        "CLICKHOUSE_SECURE": "true",
        "CLICKHOUSE_VERIFY": "true",
        "CLICKHOUSE_CONNECT_TIMEOUT": "30",
        "CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30",
        "CHDB_ENABLED": "true",
        "CHDB_DATA_PATH": "/path/to/chdb/data"
      }
    }
  }
}
  1. Locate the command entry for uv and replace it with the absolute path to the uv executable. This ensures that the correct version of uv is used when starting the server. On a mac, you can find this path using which uv.

  2. Restart Claude Desktop to apply the changes.

Optional Write Access

By default, this MCP enforces read-only queries so that accidental mutations cannot happen during exploration. To allow DDL or INSERT/UPDATE statements, set the CLICKHOUSE_ALLOW_WRITE_ACCESS environment variable to true. The server keeps enforcing read-only mode if the ClickHouse instance itself disallows writes.

Destructive Operation Protection

Even when write access is enabled (CLICKHOUSE_ALLOW_WRITE_ACCESS=true), destructive operations (DROP TABLE, DROP DATABASE, DROP VIEW, DROP DICTIONARY, TRUNCATE TABLE) require an additional opt-in flag for safety. This prevents accidental data deletion during AI exploration.

To enable destructive operations, set both flags:

"env": {
  "CLICKHOUSE_ALLOW_WRITE_ACCESS": "true",
  "CLICKHOUSE_ALLOW_DROP": "true"
}

This two-tier approach ensures that accidental drops are very difficult:

  • Write operations (INSERT, UPDATE, CREATE) require CLICKHOUSE_ALLOW_WRITE_ACCESS=true
  • Destructive operations (DROP, TRUNCATE) additionally require CLICKHOUSE_ALLOW_DROP=true

Running Without uv (Using System Python)

If you prefer to use the system Python installation instead of uv, you can install the package from PyPI and run it directly:

  1. Install the package using pip:

    python3 -m pip install mcp-clickhouse
    

    To upgrade to the latest version:

    python3 -m pip install --upgrade mcp-clickhouse
    
  2. Update your Claude Desktop configuration to use Python directly:

{
  "mcpServers": {
    "mcp-clickhouse": {
      "command": "python3",
      "args": [
        "-m",
        "mcp_clickhouse.main"
      ],
      "env": {
        "CLICKHOUSE_HOST": "<clickhouse-host>",
        "CLICKHOUSE_PORT": "<clickhouse-port>",
        "CLICKHOUSE_USER": "<clickhouse-user>",
        "CLICKHOUSE_PASSWORD": "<clickhouse-password>",
        "CLICKHOUSE_SECURE": "true",
        "CLICKHOUSE_VERIFY": "true",
        "CLICKHOUSE_CONNECT_TIMEOUT": "30",
        "CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30"
      }
    }
  }
}

Alternatively, you can use the installed script directly:

{
  "mcpServers": {
    "mcp-clickhouse": {
      "command": "mcp-clickhouse",
      "env": {
        "CLICKHOUSE_HOST": "<clickhouse-host>",
        "CLICKHOUSE_PORT": "<clickhouse-port>",
        "CLICKHOUSE_USER": "<clickhouse-user>",
        "CLICKHOUSE_PASSWORD": "<clickhouse-password>",
        "CLICKHOUSE_SECURE": "true",
        "CLICKHOUSE_VERIFY": "true",
        "CLICKHOUSE_CONNECT_TIMEOUT": "30",
        "CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30"
      }
    }
  }
}

Note: Make sure to use the full path to the Python executable or the mcp-clickhouse script if they are not in your system PATH. You can find the paths using:

  • which python3 for the Python executable
  • which mcp-clickhouse for the installed script

Custom Middleware

You can add custom middleware to the MCP server without modifying the source code. FastMCP provides a middleware system that allows you to intercept and process MCP protocol messages (tool calls, resource reads, pro


FAQ

What is the ClickHouse MCP server?
ClickHouse is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
How do MCP servers relate to agent skills?
Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
How are reviews shown for ClickHouse?
This profile displays 72 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.5 out of 5—verify behavior in your own environment before production use.

Use Cases

Direct Database Queries from AI

Enable Claude to query your database directly using natural language

Example

Ask 'Show me top 10 customers by revenue this month' and get SQL results instantly

Eliminate manual SQL writing for ad-hoc queries, get insights 10x faster

Data Analysis & Reporting

Generate complex reports and analytics without leaving conversation

Example

Analyze sales trends, cohort retention, user behavior patterns conversationally

Democratize data access—non-technical team members can query databases

Schema Exploration

Understand database structure, relationships, and data models

Example

'Explain the user_orders table schema and its relationships'

Onboard engineers faster, explore unfamiliar databases efficiently

Data Validation & Quality Checks

Run data quality queries to catch anomalies and inconsistencies

Example

Find duplicate records, missing values, orphaned foreign keys automatically

Maintain data integrity with less manual SQL work

Implementation Guide

Prerequisites

  • Claude Desktop 0.7.0+ or Cursor with MCP support
  • Database credentials (read-only recommended for safety)
  • Network access from Claude client to database
  • Understanding of database security and access control

Time Estimate

15-30 minutes including configuration and testing

Installation Steps

  1. 1.Install MCP server: npm install -g @modelcontextprotocol/server-[name]
  2. 2.Configure database connection in Claude Desktop config (~/.claude/mcp.json)
  3. 3.Provide connection string: host, port, database, username, password
  4. 4.Restart Claude Desktop to load MCP server
  5. 5.Test connection: 'List all tables in database'
  6. 6.Run simple query: 'Show me 5 rows from users table'
  7. 7.Verify results and permissions are correct
  8. 8.Document query patterns for team use

Troubleshooting

  • Connection refused: Check database is running and network accessible
  • Authentication failed: Verify credentials, check user permissions
  • Claude can't see tables: Grant appropriate read permissions to database user
  • Slow queries: Add indexes, limit result set size, use read replicas
  • MCP server not loading: Check config syntax, restart Claude Desktop

Best Practices

✓ Do

  • +Use read-only database credentials to prevent accidental writes
  • +Connect to read replica, not production primary database
  • +Set query timeout limits to prevent long-running queries
  • +Document database schema and common queries for AI context
  • +Monitor query performance and optimize slow queries
  • +Use connection pooling for better performance
  • +Test with non-production data first

✗ Don't

  • Don't use production write credentials—risk of data corruption
  • Don't query production database during peak traffic hours
  • Don't expose sensitive PII without proper access controls
  • Don't skip query result validation—AI can misinterpret schema
  • Don't allow unlimited result set sizes—set LIMIT clauses
  • Don't share database credentials in plain text config files

💡 Pro Tips

  • Create database views for common queries to simplify AI access
  • Add schema comments/descriptions so AI understands column meanings
  • Use semantic table/column names ('customer_lifetime_value' not 'clv')
  • Set up query logging to audit what Claude is querying
  • Create saved query templates for recurring analysis
  • Combine with data visualization tools for better insights

Technical Details

Architecture

MCP server acts as bridge between Claude and database, translating natural language to SQL queries and returning results in structured format.

Protocols

  • Model Context Protocol (MCP)
  • Database-specific protocols (PostgreSQL, MySQL, MongoDB)

Compatibility

  • PostgreSQL
  • MySQL
  • SQLite
  • MongoDB
  • Redis

When to Use This

✓ Use When

Use for ad-hoc data queries, exploratory analysis, report generation, schema exploration, and democratizing data access. Best for read-heavy analytics workloads.

✗ Avoid When

Avoid for production write operations, mission-critical transactions, real-time OLTP workloads, or when database contains sensitive PII without proper access controls. Use read replicas, not primary.

Integration

  • Read replica connection for analytics queries
  • Database view layer to abstract complex joins
  • Query result caching for repeated questions
  • Audit logging of all AI-generated queries

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.

List & Promote Your MCP Server

Share your MCP server with the developer community

GET_STARTED →
MCP server reviews

Ratings

4.572 reviews
  • Valentina Khan· Dec 28, 2024

    Useful MCP listing: ClickHouse is the kind of server we cite when onboarding engineers to host + tool permissions.

  • Luis White· Dec 16, 2024

    According to our notes, ClickHouse benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.

  • Valentina Ndlovu· Dec 4, 2024

    Useful MCP listing: ClickHouse is the kind of server we cite when onboarding engineers to host + tool permissions.

  • Luis Bansal· Nov 23, 2024

    I recommend ClickHouse for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.

  • Evelyn Perez· Nov 19, 2024

    Strong directory entry: ClickHouse surfaces stars and publisher context so we could sanity-check maintenance before adopting.

  • Diego Mehta· Nov 19, 2024

    We evaluated ClickHouse against two servers with overlapping tools; this profile had the clearer scope statement.

  • Luis Srinivasan· Nov 7, 2024

    We wired ClickHouse into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.

  • Luis Choi· Oct 26, 2024

    ClickHouse is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.

  • Jin Choi· Oct 14, 2024

    Strong directory entry: ClickHouse surfaces stars and publisher context so we could sanity-check maintenance before adopting.

  • Yuki Yang· Oct 10, 2024

    I recommend ClickHouse for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.

showing 1-10 of 72

1 / 8