MCP orchestrator for reproducible ClickHouse workload diagnostics
Project description
ch_play
ch_play coordinates a reproducible ClickHouse experiment: it activates a declarative
ch_stand, optionally installs ch_workload profiles, runs the workload, and collects
ch_diag snapshots at the same time. The result is a durable run directory with JSON/HTML
diagnostic reports, the reviewed plan, component versions, state, and append-only events.
The MCP server exposes only typed experiment operations. It does not expose arbitrary SQL, shell, SSH, or Docker commands.
Requirements
- Linux and Docker supported by
ch_stand; ssh-keyscanforcollection_mode: remote;- Python 3.10 or newer;
- compatible
ch_stand,ch_workload, andch_diagconsole commands from the same Python environment.
Install from PyPI after publication:
python3 -m pip install ch-play
For a source checkout:
python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'
Experiment manifest
The initial imdb_cluster workload requires the 4 shards x 2 replicas profile from
ch_stand. Paths are resolved relative to the experiment manifest.
api_version: ch_play/v1
kind: ClickHouseExperiment
metadata:
id: imdb-diagnostics
spec:
artifact_root: .ch_play/experiments/imdb-diagnostics
stand:
config: stand/configs/sharded-replicated-8.yaml
project: stand
timeout_seconds: 600
workload:
project: workload
profiles: [imdb_cluster]
database: ch_workload
scale: 0.1
seed: 20260802
duration_seconds: 60
install: true
recreate: false
resource_monitor: true
diagnostics:
collection_mode: remote
target_scope: cluster
interval_seconds: 5
report_name: during-workload
The ClickHouse user, cluster name, HTTP/native/SSH ports, password file, and SSH key are derived
from the resolved ch_stand configuration. spec.workload.database is the database created and
loaded by the workload profile; it defaults to ch_workload. Passwords are forbidden in the
manifest and are never passed in process arguments or returned by MCP.
Safe execution flow
Validate and review the exact deterministic plan first:
ch-play validate experiment.yml
ch-play plan experiment.yml
Pass the returned plan_hash unchanged. A detached run is the preferred mode for MCP clients:
ch-play start experiment.yml --plan-hash sha256:... --run-id run-001
ch-play status experiment.yml --run-id run-001
ch-play events experiment.yml --run-id run-001
For a foreground terminal run, use ch-play run with the same arguments. A cancellation request
is cooperative and is bound to the recorded experiment processes:
ch-play cancel experiment.yml --run-id run-001 --reason "enough samples"
The stand remains available after a completed or failed run so that it can be inspected. Removal is always explicit:
ch-play teardown experiment.yml --run-id run-001
ch-play teardown experiment.yml --run-id run-001 --clear-data --force
--clear-data permanently removes stand data and therefore additionally requires --force.
Reports
By default the run directory contains:
during-workload.jsonandduring-workload.htmlfromch_diag;state.jsonwith the plan, versions, workload result, diagnostics summary, and artifacts;events.jsonlwith ordered lifecycle events;- diagnostic and detached-worker logs.
Reports can be inspected or compared without connecting to ClickHouse:
ch-play inspect-report path/to/report.json
ch-play compare-reports baseline.json candidate.json
The comparison explicitly marks reports non-comparable when their content version, report ID,
ClickHouse version, or collection mode differs. Profile hashes, topology, scale, and seed should
also be checked in state.json.
MCP server
Start the stdio server with:
ch-play-mcp
It provides these high-level tools:
component_capabilitiesvalidate_experiment,plan_experimentstart_experiment,run_experimentexperiment_status,experiment_events,cancel_experimentteardown_experimentinspect_diagnostic_report,compare_diagnostic_reports
The server also publishes the experiment, run-state, run-event, and component-contract schemas as
chplay:// resources.
Component contract
ch_play invokes the three tools through ch_play/component/v1 machine envelopes. Each component
advertises the hidden interface through:
ch-stand --machine --request-id probe --component-capabilities
ch-workload --machine --request-id probe --component-capabilities
ch-diag --machine --request-id probe --component-capabilities
Every response contains exactly contract_version, component, component_version, command,
request_id, status, result, artifacts, warnings, and error.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ch_play-0.1.1.tar.gz.
File metadata
- Download URL: ch_play-0.1.1.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06bb487bd85ee566d0b7f20610416caa727ab205947de2a5538a99059f52cbcd
|
|
| MD5 |
b06ebf3205b94b1234d3cc43fc2c03d3
|
|
| BLAKE2b-256 |
aed80cff028b36dd4460fb18e11c761edefeffc253e08125222363dc06793640
|
Provenance
The following attestation bundles were made for ch_play-0.1.1.tar.gz:
Publisher:
publish.yml on O2eg/ch_play
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ch_play-0.1.1.tar.gz -
Subject digest:
06bb487bd85ee566d0b7f20610416caa727ab205947de2a5538a99059f52cbcd - Sigstore transparency entry: 2328358610
- Sigstore integration time:
-
Permalink:
O2eg/ch_play@a52c94af02eac0b0376a329bc82a27920ef73a5f -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/O2eg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a52c94af02eac0b0376a329bc82a27920ef73a5f -
Trigger Event:
push
-
Statement type:
File details
Details for the file ch_play-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ch_play-0.1.1-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d7dc1eac8bf40bbe73f60d5579478d987f3837a127e3aac97c163c6edb39677
|
|
| MD5 |
7d3ffa79fe1e61e05af9a12432b6e774
|
|
| BLAKE2b-256 |
b2adc0591ec1c7ccec04256c72215ad8e0548530c500f24af42a060b677fc248
|
Provenance
The following attestation bundles were made for ch_play-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on O2eg/ch_play
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ch_play-0.1.1-py3-none-any.whl -
Subject digest:
6d7dc1eac8bf40bbe73f60d5579478d987f3837a127e3aac97c163c6edb39677 - Sigstore transparency entry: 2328358735
- Sigstore integration time:
-
Permalink:
O2eg/ch_play@a52c94af02eac0b0376a329bc82a27920ef73a5f -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/O2eg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a52c94af02eac0b0376a329bc82a27920ef73a5f -
Trigger Event:
push
-
Statement type: