Read-only MCP server for ClickHouse metadata, parameterized queries, and plan analysis.
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"io-github-alyiox-mcp-clickhousex": {
"command": "<see-readme>",
"args": []
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
A read-only Model Context Protocol (MCP) server for ClickHouse that supports metadata discovery, resources, parameterized SELECT queries, SHOW introspection, query analysis, and snapshot mode for large result sets, with profile-based configuration and strict no-DML/DDL enforcement.
No automated test available for this server. Check the GitHub README for setup instructions.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
No package registry to scan.
Click any tool to inspect its schema.
profilesList configured profiles. Each entry includes name and optional description.
chx://profiles
cluster_propertiesGet cluster properties and execution limits. Returns ClickHouse server version plus enforced limits (max rows, timeouts) for the profile.
chx://profiles/{profile}/cluster
databasesList databases. Rows from system.databases visible to the connection.
chx://profiles/{profile}/databases
tablesList tables and views in a database. Rows from system.tables: name, engine, primary_key, sorting_key, partition_key, total_rows, total_bytes for query planning.
chx://profiles/{profile}/databases/{database}/tables
columnsList columns for a table or view. Rows from system.columns for the resolved database and table.
chx://profiles/{profile}/databases/{database}/tables/{table}/columns
snapshotsFetch persisted query result as CSV file
chx://snapshots/{id}
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in other
MCP server for Spanning Cloud Backup — M365/GWS/Salesforce backups, restores, audit.
AI agent control of 3D printers — 432 tools for OctoPrint, Moonraker, Bambu, Prusa, Elegoo
MCP server for Kaseya Autotask PSA — companies, tickets, projects, time entries, and more.
On-chain provenance lookup for AnchorRegistry. Resolve AR-IDs, hashes, and full trees. Authless.
MCP Security Weekly
Get CVE alerts and security updates for io.github.alyiox/mcp-clickhousex and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
A read-only Model Context Protocol (MCP) server for ClickHouse that supports metadata discovery, resources, parameterized SELECT queries, SHOW introspection, query analysis, and snapshot mode for large result sets, with profile-based configuration and strict no-DML/DDL enforcement.
Requirements: Python 3.13+, a running ClickHouse instance, and connection details via environment variables or a config file.
Set a DSN and run the server with MCP Inspector:
# Option 1: Run directly with uvx (no clone needed)
export MCP_CLICKHOUSE_DSN="http://default:@localhost:8123/default"
npx -y @modelcontextprotocol/inspector uvx mcp-clickhousex
# Option 2: Run from source (clone repo, then)
export MCP_CLICKHOUSE_DSN="http://default:@localhost:8123/default"
npx -y @modelcontextprotocol/inspector uv run main.py
All settings use the MCP_CLICKHOUSE prefix. Flat environment variables (e.g. MCP_CLICKHOUSE_DSN) are the straightforward way to configure the default profile when you have a single connection. For multiple profiles, the user-scoped config.json file is recommended.
Single connection: Configure via environment variables.
# Connection DSN (required).
export MCP_CLICKHOUSE_DSN="http://user:password@host:8123/database"
# Optional description for the default profile (tooling/AI discovery).
export MCP_CLICKHOUSE_DESCRIPTION="Primary cluster"
# Optional max rows per interactive query (default 500; hard ceiling 1000).
export MCP_CLICKHOUSE_QUERY_MAX_ROWS="500"
# Optional interactive query timeout in seconds (default 30; hard ceiling 300).
export MCP_CLICKHOUSE_QUERY_COMMAND_TIMEOUT_SECONDS="30"
# Optional max rows for snapshot queries (default 10000; hard ceiling 50000).
export MCP_CLICKHOUSE_SNAPSHOT_MAX_ROWS="10000"
# Optional snapshot query timeout in seconds (default 120; hard ceiling 300).
export MCP_CLICKHOUSE_SNAPSHOT_COMMAND_TIMEOUT_SECONDS="120"
Multiple connections: Use the user-scoped config.json file (recommended). Env vars also work via the MCP_CLICKHOUSE_PROFILES_<NAME>_ prefix (e.g. MCP_CLICKHOUSE_PROFILES_WAREHOUSE_DSN).
~/.config/mcp-clickhousex/config.json%USERPROFILE%\.config\mcp-clickhousex\config.jsonExample (config.json):
{
"profiles": {
"default": {
"dsn": "http://default:@localhost:8123/default",
"description": "Primary",
"query_max_rows": 500,
"query_command_timeout_seconds": 60,
"snapshot_max_rows": 10000,
"snapshot_command_timeout_seconds": 120
},
"warehouse": {
"dsn": "http://user:pass@warehouse:8123/analytics",
"description": "Warehouse"
}
}
}
Special characters in credentials: If the username or password contains URL-reserved characters, percent-encode them in the DSN:
| Character | Encoding |
|---|---|
# | %23 |
? | %3F |
/ | %2F |
@ | %40 |
% | %25 |
For example, username admin@org and password p#ss? become admin%40org:p%23ss%3F in the DSN: http://admin%40org:p%23ss%3F@host:8123/database.
Tool descriptions match server.py tool docstrings except the [ClickHouse] prefix is omitted here (it remains in MCP-exposed metadata). Parameter text matches each Field(description=…) on the same tool.
| Tool | Description | Key params |
|---|---|---|
list_profiles | List configured profiles. Each entry includes name and optional description. | — |
| **`get_cluste |