Connection mode Decide connection mode first and verify connectivity then: select hostName ( ) as hostname , version ( ) as version , getMacro ( 'cluster' ) as cluster_name , formatReadableTimeDelta ( uptime ( ) ) as uptime_human , getSetting ( 'max_memory_usage' ) as max_memory_usage , ( select value from system . asynchronous_metrics where metric = 'OSMemoryTotal' ) as os_memory_total MCP mode (preferred) If multiple ClickHouse MCP servers are available, ask the user which one to use. When executing queries by the MCP server, push a single SQL statement to the MCP server (no multy query!) Exec mode (clickhouse-client) try to run clickhouse-client . Don't rely on env vars. On failure, ask how to run it properly. Prefer running queries from a .sql file with --queries-file and forcing JSON output ( -f JSON ) when capturing results to files. Cluster selection for clusterAllReplicas('{cluster}', ...) Verify from the query results above if a cluster_name (cluster macro var) is not empty. If defined - leave macro as-is. if not, ask the user to choose from: SELECT DISTINCT cluster FROM system.clusters where not is_local and replace '{cluster}' placeholders in the queries in all .sql files. if the query above returns nothing, consider single-server mode and automatically rewrite clusterAllReplicas('{cluster}', system.
altinity-expert-clickhouse-connection
安装
npx skills add https://github.com/altinity/skills --skill altinity-expert-clickhouse-connection