ClickHouse
MCP ServerFree** - Query your [ClickHouse](https://clickhouse.com/) database server.
Capabilities6 decomposed
read-only database query execution with mcp protocol binding
Medium confidenceExecutes SELECT queries against ClickHouse databases through a FastMCP server interface with strict read-only enforcement at the client level. The system uses the clickhouse-connect library to establish thread-safe connections and enforces read-only mode via the get_readonly_setting() function, which detects server-side read-only settings and applies client-side constraints if needed. Query results are returned as structured data with full error handling and timeout management.
Implements dual-layer read-only enforcement: first via ClickHouse server settings detection (get_readonly_setting()), then via client-side query validation through FastMCP tool schema. Uses thread-safe clickhouse-connect client with configurable timeouts and SSL verification, integrated directly into MCP protocol for seamless Claude Desktop integration.
More secure than direct database connections because credentials never leave the MCP server process and read-only is enforced at both client and server levels, unlike generic SQL query tools that rely solely on database permissions.
database schema discovery and metadata retrieval
Medium confidenceProvides two complementary tools for exploring ClickHouse schema: list_databases() returns all accessible databases, and list_tables(database, like=None) returns detailed metadata for tables including schema definitions, column information, row counts, and table comments. The system queries ClickHouse system tables (system.databases and system.tables) to build this metadata without requiring direct schema introspection APIs. Optional pattern matching via the 'like' parameter enables filtered table discovery.
Leverages ClickHouse system tables (system.databases, system.tables) for metadata retrieval rather than generic SQL introspection, providing native access to ClickHouse-specific metadata like row counts and table comments. Integrates pattern matching directly into the tool interface via the 'like' parameter for filtered discovery.
More efficient than generic database introspection tools because it queries ClickHouse system tables directly which are optimized for metadata queries, and includes ClickHouse-specific metadata like row counts without requiring separate COUNT(*) queries.
environment-based connection configuration with singleton pattern
Medium confidenceManages ClickHouse connection parameters through environment variables (CLICKHOUSE_HOST, CLICKHOUSE_USER, CLICKHOUSE_PASSWORD, CLICKHOUSE_PORT, CLICKHOUSE_SECURE, CLICKHOUSE_VERIFY, CLICKHOUSE_CONNECT_TIMEOUT, CLICKHOUSE_SEND_RECEIVE_TIMEOUT, CLICKHOUSE_DATABASE) loaded via python-dotenv. Configuration is instantiated as a singleton to ensure consistent settings throughout the application lifecycle. Supports both HTTP and HTTPS connections with configurable SSL verification and timeout parameters.
Uses singleton pattern for configuration management ensuring single source of truth for connection parameters across all MCP tools. Supports both HTTPS and HTTP with configurable SSL verification, and includes separate timeout controls for connection establishment (CLICKHOUSE_CONNECT_TIMEOUT) and query execution (CLICKHOUSE_SEND_RECEIVE_TIMEOUT).
More flexible than hardcoded configuration because environment variables support multi-environment deployments without code changes, and the singleton pattern prevents configuration inconsistencies that could arise from multiple connection instances with different parameters.
fastmcp server framework integration with tool schema binding
Medium confidenceExposes ClickHouse functionality as three MCP tools (list_databases, list_tables, run_select_query) through a FastMCP server instance that handles protocol translation between MCP clients (like Claude Desktop) and the underlying ClickHouse operations. Each tool is registered with explicit parameter schemas and descriptions, enabling MCP clients to understand tool capabilities and validate inputs before execution. The FastMCP framework handles request routing, error serialization, and response formatting according to MCP protocol specifications.
Implements MCP server using FastMCP framework which provides automatic protocol handling and tool schema registration. Each tool (list_databases, list_tables, run_select_query) is registered with explicit parameter definitions and descriptions, enabling MCP clients to discover capabilities and validate inputs before execution.
More maintainable than manual MCP protocol implementation because FastMCP handles serialization, error handling, and protocol compliance automatically, reducing boilerplate and potential protocol violations compared to building MCP servers from scratch.
thread-safe connection pooling with clickhouse-connect client
Medium confidenceManages ClickHouse database connections using the clickhouse-connect library with thread-safe connection pooling. The client is instantiated once per configuration and reused across all tool invocations, ensuring efficient connection reuse and preventing connection exhaustion. The clickhouse-connect library handles connection lifecycle management, including SSL/TLS negotiation, authentication, and automatic reconnection on connection loss.
Uses clickhouse-connect library's built-in connection pooling with thread-safe semantics, eliminating need for manual connection management. Supports both HTTP and HTTPS protocols with configurable SSL verification, and handles authentication transparently via library.
More reliable than manual connection management because clickhouse-connect handles connection lifecycle, automatic reconnection, and thread safety internally, reducing risk of connection leaks or race conditions compared to raw socket-based implementations.
strict read-only enforcement with dual-layer validation
Medium confidenceImplements read-only access through a two-layer enforcement mechanism: first, the get_readonly_setting() function detects the server's read-only configuration and applies client-side constraints if the server allows write operations; second, the MCP tool schema restricts run_select_query to SELECT statements only, preventing other SQL operations at the protocol level. This dual approach ensures that even if the ClickHouse server permits writes, the MCP interface cannot execute them.
Implements dual-layer read-only enforcement: server-side detection via get_readonly_setting() function that checks ClickHouse read_only setting and applies client constraints, combined with MCP tool schema that restricts run_select_query to SELECT statements only. This prevents both server-level write operations and protocol-level bypass attempts.
More secure than single-layer enforcement because it combines server-side setting detection with client-side validation, preventing bypass through either layer independently. Unlike generic database tools that rely solely on database permissions, this approach enforces read-only at the MCP protocol level.
Capabilities are decomposed by AI analysis. Each maps to specific user intents and improves with match feedback.
Related Artifactssharing capabilities
Artifacts that share capabilities with ClickHouse, ranked by overlap. Discovered automatically through the match graph.
SchemaCrawler
** - Connect to any relational database, and be able to get valid SQL, and ask questions like what does a certain column prefix mean.
PostgreSQL
** - Read-only database access with schema inspection.
Database
** (by Legion AI) - Universal database MCP server supporting multiple database types including PostgreSQL, Redshift, CockroachDB, MySQL, RDS MySQL, Microsoft SQL Server, BigQuery, Oracle DB, and SQLite
@iflow-mcp/db-mcp-tool
Database Explorer MCP Tool - PostgreSQL, MySQL ve Firestore veritabanları için yönetim aracı
DreamFactory
** - An MCP server for securely (via RBAC) talking to on-premise and cloud MS SQL Server, MySQL, PostgreSQL databases and other data sources.
CockroachDB
** - A Model Context Protocol server for managing, monitoring, and querying data in [CockroachDB](https://cockroachlabs.com).
Best For
- ✓AI application developers integrating ClickHouse with Claude Desktop or other MCP clients
- ✓teams building read-only analytics dashboards powered by LLMs
- ✓organizations requiring secure database access through AI agents without direct credential exposure
- ✓developers building query assistants that need to understand database structure
- ✓data analysts exploring unfamiliar ClickHouse instances through AI interfaces
- ✓teams implementing schema-aware code generation for analytics queries
- ✓DevOps teams deploying MCP servers across multiple environments
- ✓developers building containerized MCP applications with environment-based configuration
Known Limitations
- ⚠SELECT-only enforcement means no INSERT, UPDATE, DELETE, or DDL operations regardless of user permissions
- ⚠Query timeout defaults to 300 seconds and cannot be exceeded without configuration changes
- ⚠No query result pagination or streaming — entire result set must fit in memory
- ⚠No support for parameterized queries or prepared statements — all queries are raw SQL strings
- ⚠Returns metadata only from system.databases and system.tables — does not include view definitions or materialized view logic
- ⚠Pattern matching uses ClickHouse LIKE syntax which may differ from regex expectations
Requirements
Input / Output
UnfragileRank
UnfragileRank is computed from adoption signals, documentation quality, ecosystem connectivity, match graph feedback, and freshness. No artifact can pay for a higher rank.
About
** - Query your [ClickHouse](https://clickhouse.com/) database server.
Categories
Alternatives to ClickHouse
Are you the builder of ClickHouse?
Claim this artifact to get a verified badge, access match analytics, see which intents users search for, and manage your listing.
Get the weekly brief
New tools, rising stars, and what's actually worth your time. No spam.
Data Sources
Looking for something else?
Search →