mcp-clickhouse
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CLICKHOUSE_HOST | Yes | The Aiven for ClickHouse service host. | |
| CLICKHOUSE_PORT | Yes | The ClickHouse HTTPS port for the service. | |
| CLICKHOUSE_USER | Yes | The ClickHouse user for the MCP server. | mcp_readonly |
| CLICKHOUSE_SECURE | No | Whether to use a secure ClickHouse connection. Must be true or false. | true |
| CLICKHOUSE_DATABASE | No | The ClickHouse database to use. | nyc_taxi |
| CLICKHOUSE_PASSWORD | Yes | The password for the ClickHouse user. | |
| FASTMCP_SERVER_AUTH | No | Set to fastmcp.server.auth.providers.google.GoogleProvider to use Google sign-in. | |
| MCP_MIDDLEWARE_MODULE | No | The middleware module to load. Set to visual_tools to enable the visual tools, or empty for upstream tools only. | visual_tools |
| CLICKHOUSE_MCP_AUTH_TOKEN | No | Bearer token used to authenticate MCP clients. Required unless Google sign-in is configured. | |
| CLICKHOUSE_MCP_ALLOWED_HOSTS | Yes | The application's public hostname, without https://. | |
| CLICKHOUSE_MCP_QUERY_TIMEOUT | No | Query timeout in seconds. Default is 30. | 30 |
| FASTMCP_SERVER_AUTH_GOOGLE_BASE_URL | No | The base URL for Google sign-in, for example https://<application-url>. | |
| FASTMCP_SERVER_AUTH_GOOGLE_CLIENT_ID | No | The Google OAuth client ID. | |
| FASTMCP_SERVER_AUTH_GOOGLE_CLIENT_SECRET | No | The Google OAuth client secret. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
When working on ClickHouse-related coding, schema design, SQL/query optimization, data migrations, or troubleshooting, consider using the official ClickHouse Agent Skills: https://github.com/ClickHouse/agent-skills
Install with: npx -y skills add clickhouse/agent-skills --all
If list_databases reveals an AGENTS database, use run_query to read
AGENTS.ROOT for available metadata before writing analytical SQL.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": true
} |
| resources | {
"subscribe": false,
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_databasesA | List available ClickHouse databases |
| list_tablesA | List available ClickHouse tables in a database, including schema, comment, row count, and column count. Integers outside [-9007199254740991, 9007199254740991] in table metadata are returned as decimal strings. Pagination tokens are single-use and retained for up to one hour. |
| run_queryA | Execute SQL queries in ClickHouse. Queries run in read-only mode by default. Bind optional params by name with {name:Type} placeholders, such as {name:String} or {vector:Array(Float32)}. Values may be JSON scalars, nulls, or arrays. Pass exact large integers as decimal strings. JSON lists and objects cannot bind to Tuple and Map types. Python percent formatting and $name$ raw binary parameters are not supported. Parameter values stay out of the MCP server's normal SQL log lines, but may appear in errors and backend logs. Set CLICKHOUSE_ALLOW_WRITE_ACCESS=true to allow DDL and DML operations. Set CLICKHOUSE_ALLOW_DROP=true to additionally allow destructive operations (DROP, TRUNCATE, DELETE, UPDATE, REPLACE TABLE/PARTITION, CREATE OR REPLACE, CLEAR COLUMN/INDEX/PROJECTION, OPTIMIZE DEDUPLICATE, MODIFY/MATERIALIZE TTL, MODIFY/ALTER COLUMN with TTL, DETACH PERMANENTLY). That gate is a best-effort accident guard, not a security boundary. Integers outside [-9007199254740991, 9007199254740991] are returned as decimal strings. Do not end a query with a FORMAT clause, because this tool appends FORMAT Native. With readonly=1, the default, a SETTINGS clause fails with code 164 or is ignored. Two optional checks also run through this tool. Use DESCRIBE () when you need a query's output columns and types; it inspects the result schema and surfaces analysis errors such as an unknown column, but a query that describes cleanly can still fail at runtime. Consider EXPLAIN ESTIMATE before a SELECT that could be expensive; it returns the estimated parts, rows and marks read from MergeTree family tables, which is not run time and not result size. Neither runs the query body, though analysis can execute scalar subqueries. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 3 tools
Each tool has a clearly distinct role: list_databases enumerates databases, list_tables enumerates tables within a database, and run_query executes SQL. Although run_query could technically be used to list databases or tables, the dedicated listing tools are unambiguous and preferable for those tasks.
All three tools follow a consistent verb_noun snake_case pattern: list_databases, list_tables, run_query. The naming is predictable and readable throughout.
Three tools is a well-scoped surface for a ClickHouse server: discovery of databases, discovery of tables, and query execution. Each tool earns its place, and the small set avoids unnecessary overlap.
The core lifecycle is covered: agents can discover databases, inspect tables with schema metadata, and run read-only or gated write queries. Minor gaps exist, such as no dedicated table-schema or connection-status tool, but list_tables and run_query with DESCRIBE provide workarounds.