This project provides MCP server for ClickHouse, including MCP tools to read the ClickHouse database schema, explain queries, and perform semantic search over the ClickHouse documentation.
- Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate- Install this package directly from GitHub using pip:
pip install -e git+https://github.com/izaitsevfb/clickhouse-mcp.git#egg=clickhouse_mcp(Just FYI: once installed, the MCP server could be run as: python -m clickhouse_mcp)
- Add this MCP server to claude code:
claude mcp add-json clickhouse '{ "type": "stdio", "command": "python", "args": [ "-m", "clickhouse_mcp" ], "env": {} }'Note: by default mcp config applies only to running in the current directory. If you want to use is globally, add
--scope user the command above (e.g. claude mcp add-json --scope user clickhouse ...).
- Setup environment variables
Add .env file in the directory where you're running claude code or export required environment variables
for the session.
See .env.example for the list of required variables related to the ClickHouse database.
AWS credentials must also be set: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN
for semantic search to work.
- Run claude code as usual:
claude- Clone the repository
- Install requirements:
pip install -r requirements.txt
- Install in development mode:
pip install -e .
Run unit tests for the improved chunking implementation:
python -m unittest tests/test_chunk_md_improved.pypython tools/chunk_md.py --savepython analyze_index_with_histogram.pySee the Tools README for more details.