clickhouse.com
clickhouse.com logo

ClickHouse

Integrates with ClickHouse databases to execute read-only SQL queries, list databases, and enumerate tables for fast ana...

Created byApr 23, 2025

ClickHouse MCP Server

Migrated to https://github.com/ClickHouse/mcp-clickhouse

An MCP server for ClickHouse.

Features

Tools

  • `run_select_query` - Execute SQL queries on your ClickHouse cluster. - Input: `sql` (string): The SQL query to execute. - All ClickHouse queries are run with `readonly = 1` to ensure they are safe.
  • `list_databases` - List all databases on your ClickHouse cluster.
  • `list_tables` - List all tables in a database. - Input: `database` (string): The name of the database.

Configuration

**Note**: This is a temporary configuration process that will be significantly improved once the package is published.
  1. Run `uv sync` to install the dependencies. To install `uv` follow the instructions [here](https://docs.astral.sh/uv/). Then do `source .venv/bin/activate`.
  1. Setup the `.env.production` file with the ClickHouse credentials.
  1. Run `fastmcp install mcp_clickhouse/mcp_server.py -f .env.production` to install the server.
  1. Restart Claude Desktop.

Development

  1. In `test-services` directory run `docker compose up -d` to start the ClickHouse cluster.
  1. Add the following variables to a `.env` file in the root of the repository.
  1. Run `uv sync` to install the dependencies. To install `uv` follow the instructions [here](https://docs.astral.sh/uv/). Then do `source .venv/bin/activate`.
  1. For easy testing, you can run `fastmcp dev mcp_clickhouse/mcp_server.py` to start the MCP server.