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 "Install 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 Servershow 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
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The SQL query to be executed |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It mentions execution but fails to describe critical traits like whether this is read-only or destructive, authentication requirements, rate limits, error handling, or response format. For a database query tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with zero wasted words. It directly states the tool's purpose without unnecessary elaboration, making it appropriately sized and front-loaded for quick comprehension.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a database execution tool with no annotations and no output schema, the description is insufficient. It lacks information about behavioral traits, return values, error conditions, and usage constraints, leaving the agent poorly equipped to use this tool effectively in real scenarios.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with the single parameter 'query' fully documented in the schema. The description adds no additional meaning about parameters beyond what the schema already provides, so it meets the baseline of 3 where the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Execute a query') and target resource ('against the ClickHouse database'), providing a specific verb+resource combination. However, with no sibling tools mentioned, there's no opportunity to distinguish from alternatives, so it cannot achieve the highest score of 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or limitations. It simply states what the tool does without context about appropriate scenarios or constraints, leaving the agent with no usage direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
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
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
The BigQuery remote MCP server is a fully managed service that uses the Model Context Protocol to connect AI applications and LLMs to BigQuery data sources. It provides secure, standardized tools for AI agents to list datasets and tables, retrieve schemas, generate and execute SQL queries through natural language, and analyze data—enabling direct access to enterprise analytics data without requiring manual SQL coding.
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
- AlicenseAqualityAmaintenanceA 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.1329MIT
- AlicenseBqualityFmaintenanceAn 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.22MIT
- 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
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dubin555/clickhouse_mcp_server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server