ClickHouse MCP Server
Enables secure and structured exploration of ClickHouse databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.
The server implementation was inspired by and incorporates code from mcp-server-duckdb, suggesting potential DuckDB database connectivity capabilities.
The server implementation was inspired by and incorporates code from mysql_mcp_server, suggesting potential MySQL database connectivity capabilities.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ClickHouse MCP Server show me the top 10 products by sales last month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ClickHouse MCP Server
A Model Context Protocal (MCP) server implement for ClickHouse.
This server provides AI assistants with a secure and structured way to explore and analyze databases. It enables them to list tables, read data, and execute SQL queries through a controlled interface, ensuring responsible database access.
Configuration
Set the following environment variables:
CLICKHOUSE_HOST=localhost
CLICKHOUSE_PORT=8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=CHANGE_TO_YOUR_PASSWORD
CLICKHOUSE_DATABASE=defaultOr via command-line args:
--hostthe database host--portthe database port--userthe database username--passwordthe database password--databasethe database name
Usage
Fake some data in clickhouse
Check the SQL in dev_contribute.md for details.
Related MCP server: GreptimeDB MCP Server
Post your question to AI assistant in Cline
What is the sales volume in each region? Which product is the best - selling?CLINE
Configure the MCP server in VSCode, Cline extension, or other MCP client.: Example:
{
"mcpServers": {
"clickhouse": {
"command": "uv",
"args": [
"--directory",
"/path/to/clickhouse_mcp_server",
"run",
"-m",
"clickhouse_mcp_server.server"
],
"env": {
"CLICKHOUSE_HOST": "localhost",
"CLICKHOUSE_PORT": "8123",
"CLICKHOUSE_USER": "default",
"CLICKHOUSE_PASSWORD": "CHANGE_TO_YOUR_PASSWORD",
"CLICKHOUSE_DATABASE": "default"
}
}
}
}License
APACHE - See LICENSE file for details.
Contribute
See dev_contribute.md for details.
Prerequisites
Python with
uvpackage managerClickHouse installation
MCP server dependencies
Acknowledgement
This library's implementation was inspired by the following three repositories and incorporates their code, respect for the open-source spirit!
Thanks!
Available Tools
1 toolexecute_sqlC
Execute a query against the ClickHouse database
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined and distinct by default.
Since there is only a single tool, naming consistency is inherently perfect. The tool name follows a clear verb_noun pattern (execute_sql), which would be consistent if more tools were added.
A single tool is too few for a database server's scope, as it lacks essential operations like schema inspection, data manipulation beyond queries, or connection management. This minimal set will likely cause agent failures in complex tasks.
The tool surface is severely incomplete for a ClickHouse database server. It only provides query execution, missing critical operations such as listing tables, describing schemas, inserting data, or managing connections, leaving significant gaps for agent workflows.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Governed access to production AI-agent traces in an existing ClickHouse store.
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables Large Language Models to seamlessly interact with ClickHouse databases, supporting resource listing, schema retrieval, and query execution.2MIT
- AlicenseAqualityBmaintenanceA Model Context Protocol server implementation that enables AI assistants to securely interact with GreptimeDB, allowing them to explore database schema, read data, and execute SQL queries through a controlled interface.1529MIT
- AlicenseBqualityDmaintenanceAn MCP server implementation that enables Claude AI to interact with Clickhouse databases. Features include secure database connections, query execution, read-only mode support, and multi-query capabilities.223 PyPI2MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI assistants to securely interact with OceanBase databases by listing tables, reading data, and executing SQL queries through a controlled interface.13Apache 2.0