ClickHouse
Query your [ClickHouse](https://clickhouse.com/) database server.
⚡Config Installation
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"clickhouse": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-clickhouse"
]
}
}
}* Note: Requires restart of Claude Desktop app.
Deployment Infrastructure
Adoption Framework for ClickHouse
Before installing any skill, define a clear objective and measurable outcome. A useful implementation question is: what workflow becomes faster, safer, or more reliable after this skill is active? If that answer is vague, delay rollout and tighten scope first.
For most teams, a low-risk pattern is preview-first rollout with one owner, one test scenario, and one rollback plan. Capture failures in a structured log so quality decisions are evidence-based. This is especially important for skills that touch file systems, external APIs, or automation chains with downstream side effects.
- Define success metrics before installation.
- Validate permission scope against policy boundaries.
- Run one controlled pilot and document failure categories.
- Promote only after acceptance checks pass consistently.
Pre-Deployment Review Questions
Use these questions before enabling the skill in shared environments. They reduce surprise incidents and make approval decisions consistent across teams.
- What data can this skill read, write, or transmit by default?
- Which failures are recoverable automatically and which require manual stop?
- Do we have verifiable logs that prove safe behavior under load?
- Is rollback tested, documented, and assigned to a clear owner?
If any answer is unclear, keep rollout in preview and close the gap before production use.
Editorial Review Snapshot
This listing includes an editorial QA layer in addition to automated rendering. Review status is based on documentation depth, content uniqueness, and operational safety signals from the upstream repository.
- Last scan date: 2026-01-18
- README depth: 1131 words
- Content diversity score: 0.45 (higher is better)
- Template signal count: 0
- Index status: Index eligible
Recommendation: Pilot in a bounded environment first. Confirm observability and ownership before promoting to shared workflows.
Skill Implementation Board
Actionable utility module for rollout decisions. Use the inputs below to choose a deployment path, then execute the checklist and record an output note.
Input: Security Grade
B
Input: Findings
0
Input: README Depth
1131 words
Input: Index State
Eligible
| Decision Trigger | Action | Expected Output |
|---|---|---|
| Input: risk band moderate, docs partial, findings 0 | Run a preview pilot with fixed ownership and observability checkpoints. | Pilot can start with rollback checklist attached. |
| Input: page is index-eligible | Proceed with external documentation and team onboarding draft. | Reusable rollout runbook ready for team adoption. |
| Input: context tags/scenarios are missing | Define two concrete scenarios before broad rollout. | Clear scope definition before further deployment. |
Execution Steps
- Capture objective, owner, and rollback contact.
- Run one preview pilot with fixed test scenario.
- Record warning behavior and recovery evidence.
- Promote only if pilot output matches expected threshold.
Output Template
skill=clickhouse mode=B pilot_result=pass|fail warning_count=0 next_step=rollout|patch|hold
🛡️ Security Analysis
Clean Scan Report
Our static analysis engine detected no common vulnerabilities (RCE, API Leaks, Unbounded FS).
DocumentationREADME.md
ClickHouse MCP Server
An MCP server for ClickHouse.
Features
ClickHouse 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 = 1to ensure they are safe.
-
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): ApplyLIKEorNOT LIKEfilters to table names.page_token(string): Token returned by a previous call for fetching the next page.page_size(int, default50): Number of tables returned per page.include_detailed_columns(bool, defaulttrue): Whenfalse, omits column metadata for lighter responses while keeping the fullcreate_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, ornullwhen 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:
sql(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 OKwith the ClickHouse version if the server is healthy and can connect to ClickHouse - Returns
503 Service Unavailableif the server cannot connect to ClickHouse
Example:
curl http://localhost:8000/health
# Response: OK - Connected to ClickHouse 24.3.1
Configuration
This MCP server supports both ClickHouse and chDB. You can enable either or both depending on your needs.
-
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
- On macOS:
-
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"
}
}
}
}
-
Locate the command entry for
uvand replace it with the absolute path to theuvexecutable. This ensures that the correct version ofuvis used when starting the server. On a mac, you can find this path usingwhich uv. -
Restart Claude Desktop to apply the changes.
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:
-
Install the package using pip:
python3 -m pip install mcp-clickhouseTo upgrade to the latest version:
python3 -m pip install --upgrade mcp-clickhouse -
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 python3for the Python executablewhich mcp-clickhousefor the installed script
Development
-
In
test-servicesdirectory rundocker compose up -dto start the ClickHouse cluster. -
Add the following variables to a
.envfile in the root of the repository.
Note: The use of the default user in this context is intended solely for local development purposes.
CLICKHOUSE_HOST=localhost
CLICKHOUSE_PORT=8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=clickhouse
-
Run
uv syncto install the dependencies. To installuvfollow the instructions here. Then dosource .venv/bin/activate. -
For easy testing with the MCP Inspector, run
fastmcp dev mcp_clickhouse/mcp_server.pyto start the MCP server. -
To test with HTTP transport and the health check endpoint:
# Using default port 8000 CLICKHOUSE_MCP_SERVER_TRANSPORT=http python -m mcp_clickhouse.main # Or with a custom port CLICKHOUSE_MCP_SERVER_TRANSPORT=http CLICKHOUSE_MCP_BIND_PORT=4200 python -m mcp_clickhouse.main # Then in another terminal: curl http://localhost:8000/health # or http://localhost:4200/health for custom port
Environment Variables
The following environment variables are used to configure the ClickHouse and chDB connections:
ClickHouse Variables
Required Variables
CLICKHOUSE_HOST: The hostname of your ClickHouse serverCLICKHOUSE_USER: The username for authenticationCLICKHOUSE_PASSWORD: The password for authentication
[!CAUTION] It is important to treat your MCP database user as you would any external client connecting to your database, granting only the minimum necessary privileges required for its operation. The use of default or administrative users should be strictly avoided at all times.
Optional Variables
CLICKHOUSE_PORT: The port number of your ClickHouse server- Default:
8443if HTTPS is enabled,8123if disabled - Usually doesn't need to be set unless using a non-standard port
- Default:
CLICKHOUSE_ROLE: The role to use for authentication- Default: None
- Set this if your user requires a specific role
CLICKHOUSE_SECURE: Enable/disable HTTPS connection- Default:
"true" - Set to
"false"for non-secure connections
- Default:
CLICKHOUSE_VERIFY: Enable/disable SSL certificate verification- Default:
"true" - Set to
"false"to disable certificate verification (not recommended for production) - TLS certificates: The package uses your operating system trust store for TLS certificate verification via
truststore. We calltruststore.inject_into_ssl()at startup to ensure proper certificate handling. Python’s default SSL behavior is used as a fallback only if an unexpected error occurs.
- Default:
- `CLICKHOU
...(truncated)