Learn how to set up and configure ClickHouse MCP server with tools for executing queries and managing databases
The MCP ClickHouse Server is an implementation of the Model Context Protocol (MCP) specifically tailored for enhancing data access through ClickHouse, a high-performance distributed column-oriented database management system. This server acts as a bridge between AI applications such as Claude Desktop and a ClickHouse database, enabling seamless integration and efficient querying of data.
The core value of this MCP server lies in its ability to standardize communication protocols, making it easier for various AI applications to interact with complex databases without reinventing the wheel. It ensures compatibility, security, and ease of use, all while maintaining high performance and reliability.
The MCP ClickHouse Server excels in several key areas:
run_select_query
tool allows users to execute SQL queries on their ClickHouse cluster.
run_select_query(sql: str)
readonly = 1
, ensuring data safety and preventing unintended modifications.list_databases
tool provides a list of all databases within the ClickHouse cluster.
list_databases()
list_tables
tool lists all tables in a given database, with an optional parameter to specify which database.
list_tables(database: str)
These core capabilities are essential for maintaining the integrity and accessibility of data within AI workflows.
The implementation of the Model Context Protocol (MCP) in this ClickHouse server involves several critical components:
graph TD
A[AI Application] -->|MCP Client| B[MCP Server]
B --> C[MCP Protocol]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
Setting up the MCP ClickHouse Server involves several steps:
Open Configuration File:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
Add Configuration Entry:
{
"mcpServers": {
"mcp-clickhouse": {
"command": "uv",
"args": [
"run",
"--with",
"mcp-clickhouse",
"--python",
"3.13",
"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"
}
}
}
}
Update Environment Variables:
Restart Claude Desktop:
list_databases()
# List all databases
The following table shows the compatibility of this MCP ClickHouse Server with various MCP clients:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
This compatibility matrix ensures that the MCP ClickHouse Server can be seamlessly integrated into a wide range of AI-driven workflows.
The performance and compatibility of the MCP ClickHouse Server are crucial for ensuring smooth operation in diverse environments:
Advanced configurations include fine-tuning environment variables to suit specific use cases:
CLICKHOUSE_HOST=localhost
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=clickhouse
CLICKHOUSE_PORT=8123
CLICKHOUSE_SECURE=true
CLICKHOUSE_VERIFY=true
{
"mcpServers": {
"mcp-clickhouse": {
"command": "uv",
"args": [
"run",
"--with",
"mcp-clickhouse",
"--python",
"3.13",
"mcp-clickhouse"
],
"env": {
"CLICKHOUSE_HOST": "<clickhouse-host>",
"CLICKHOUSE_USER": "<clickhouse-user>",
"CLICKHOUSE_PASSWORD": "<clickhouse-password>"
}
}
}
}
Q: Can I use this server with non-secure ClickHouse connections?
CLICKHOUSE_SECURE
to "false"
for a non-secure connection.Q: What happens if I experience timeouts during queries?
CLICKHOUSE_CONNECT_TIMEOUT
and CLICKHOUSE_SEND_RECEIVE_TIMEOUT
settings as needed.Q: How do I ensure secure communication with ClickHouse?
CLICKHOUSE_SECURE
to "true"
and CLICKHOUSE_VERIFY
to "true"
, but avoid disabling it in production environments.Q: Is there a default database selection option?
CLICKHOUSE_DATABASE
environment variable.Q: Can I develop with this server locally on Docker?
This comprehensive documentation positions the MCP ClickHouse Server as an essential tool for enhancing data access in AI applications through standardization and advanced configurations.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica