ClickHouse Research
A standalone Rust MCP server for version-pinned ClickHouse evidence and bounded read-only runtime checks.
The server searches official ClickHouse documentation, C++ source, tests, and changelogs at immutable Git commits. It also inspects configured ClickHouse runtime catalogs and can execute a narrowly restricted read-only probe. A bundled cross-harness plugin adds the MCP server, source-research skill, and constrained ClickHouse researcher agent to Claude/Codex-compatible clients.
Tools
| Tool | Purpose |
|---|
clickhouse_search | Query-scoped BM25 plus exact-identifier search across relevant docs, source, tests, and changelogs |
clickhouse_open | Open a SHA-pinned result locator or repository path with bounded line context |
clickhouse_entity | Group exact evidence for one identifier by source kind |
clickhouse_history | Return bounded direct Git history for an identifier or path |
clickhouse_catalog | Read allowlisted system.* metadata from a configured target |
clickhouse_probe | Run one bounded read-only query or EXPLAIN |
clickhouse_compare | Compare exact entity evidence across two immutable refs |
Repository results include full commit and blob SHAs, line ranges, observation time, completeness warnings, and SHA-pinned GitHub permalinks. chhit:// values are validated locators, not authenticated capabilities; the server revalidates their commit/path/blob/line relationship when opening them.
Search hits are revalidated against the Git object database before they are returned, but the cache directory should still be private to the service user. Repository and runtime payloads are untrusted evidence, not instructions; callers must not follow commands embedded in retrieved content.
Build
Requires Rust 1.88 or newer.
cargo build --workspace --locked --release
The binary is target/release/clickhouse-research-mcp. It uses stdio for MCP; stdout is reserved for JSON-RPC and logs go to stderr.
Configuration
Run without --config for repository-only tools. The first query initializes a partial bare repository, fetches only the requested ref, and builds a query-scoped Tantivy index under the platform cache directory. Exact-identifier searches share one scope across follow-up query variations and prioritize matching paths plus source registration hubs. Each response reports that unrelated paths were not materialized; file count, bytes, and deadlines remain hard-bounded.
Runtime tools require a TOML file:
clickhouse-research-mcp --config /absolute/path/to/clickhouse-research.toml
Start from config/clickhouse-research.toml.example. Credentials are named by environment-variable reference; they are not stored in the file or passed on argv.
A runtime user must be least-privilege and read-only. The client also sends readonly=2, hard-bounded execution/read/result/memory/thread settings, enforces a response byte cap, rejects quoted identifiers and table functions, and rejects unsafe SQL before transmission. Local validation is defense in depth; the ClickHouse user grants remain the primary security boundary.
Ref semantics
latest-stable: greatest ClickHouse release tag ending in -stable or -lts
latest-lts: greatest release tag ending in -lts
master: origin/master
- explicit release tag: for example
v26.7.3.1-stable
- explicit commit: full 40-character SHA only
A symbolic ref is resolved once per call. Revision expressions, short SHAs, and ambiguous refs are rejected. Repository bootstrap fetches the requested ref shallowly; history reports a shallow-boundary warning rather than claiming unavailable older commits. Missing partial-clone objects produce explicit offline/coverage errors rather than being treated as proof of absence.
Plugin
The portable plugin lives at plugins/clickhouse-research.
- Claude uses
.claude-plugin/plugin.json and .claude-mcp.json.
- Codex/OMP uses
.codex-plugin/plugin.json, .mcp.json, and package.json.
- The launcher accepts only an absolute
CLICKHOUSE_RESEARCH_BIN, or a binary found through an absolute PATH entry.
- Set
CLICKHOUSE_RESEARCH_CONFIG to an absolute config path when runtime tools are needed.
Install from GitHub for OMP:
cargo install --git https://github.com/eric-tramel/clickhouse-research.git \
--locked clickhouse-research-mcp
omp plugin marketplace add eric-tramel/clickhouse-research
omp plugin install clickhouse-research@clickhouse-research --scope user
For local development, install and link the current checkout instead:
cargo install --path apps/clickhouse-research-mcp --locked --force
omp plugin link ./plugins/clickhouse-research --scope user --force
omp plugin enable clickhouse-research --scope user
Claude validation:
claude plugin validate --strict ./plugins/clickhouse-research