chai-ground
Validates and builds Chai-1 FASTA/restraint inputs, and audits Chai-1 output directories for ranking, single-chain ipTM caveats, steric clashes, dropped restraints, and log errors.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@chai-ground Validate my Chai-1 FASTA and restraint CSV for chain and residue numbering errors."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
chai-ground
Pre-flight input verification, restraint grounding, and output-honesty auditing for Chai-1 (chaidiscovery/chai-lab), shipped as an MCP server with a preregistered agent failure-mode eval.
> Validate a Chai-1 restraint putting haemoglobin beta Glu6 on full UniProt P68871
validate_chai_inputs(fasta_text=..., restraints_csv="r1,hbb,E6,ligand,,contact,1.0,0.0,6.0,")
→ valid: false
issues:
- [CHAIN_ID_NOT_SEQUENTIAL] Unknown chain 'hbb' — 'hbb' is a FASTA entity name,
not a chai-lab chain letter; use 'A' instead
- [RESIDUE_LETTER_MISMATCH] Chain A (hbb) position 6 is 'P', not 'E'.
Check for PDB-author vs 1-based FASTA numbering offset.
> Audit a single-chain monomer fold directory
inspect_chai_outputs(output_dir="chai_out/")
→ best_model_idx: 2 model_idx_0_is_best: false trustworthy: true
single_chain_iptm_caveat: "Single-chain monomer: ipTM is not applicable
(Chai-1 sets aggregate_score = 0.2*pTM + 0.8*0). Report pTM rather than ipTM."Why this exists
When an AI agent drives a structure-prediction tool like chai-lab, the dangerous failures aren't crashes — they are runs that finish with exit code 0 and plausible numbers while silently doing the wrong thing:
Silent restraint drop on FASTA entity names (
chai-lab#413 / #434): An agent writessequence_1instead of sequential chain letterAin.restraints.chai-labcatches the error, logs it, and runs unconstrained.Author vs. 1-based FASTA residue drift (#435): Papers and PDB files use author numbering (e.g., sickle-cell haemoglobin beta
Glu6is position 7 in full UniProtP68871, while position 6 isPro). PassingE6on the UniProt sequence misplaces or silently drops the restraint.Malformed modified-residue brackets & SMILES (#439):
(SEP]or unbalanced SMILES strings break parsing or corrupt conformers.Single-chain
ipTMdistortion (#431): For monomers,chai-labcomputesaggregate_score = 0.2 * pTM + 0.8 * 0.0, making a high-confidencepTM = 0.92monomer look like0.184unless you rank bypTMand suppressipTM.Steric-clash, sample-index & log traps: Reporting
model_idx_0whenmodel_idx_3ranked higher, reporting highpTMon a sample whosehas_inter_chain_clashesflag isTrue, or claiming a fold was restraint-guided whenchai.loglogged dropped restraints or failed template loads.
chai-ground puts deterministic checks at both boundaries — before you burn GPU dollars and after chai-lab writes .npz + .cif + logs — and pairs them with a 24-case preregistered eval (11 valid specs, 13 planted traps, deterministic graders, no LLM-as-a-judge).
Related MCP server: Chai-1 MCP Server
The MCP tools
Defined once in src/chai_ground/tools.py and exposed read-only over stdio by src/chai_ground/server.py. Every tool returns a typed Cited[T] object (found, data, note, warnings, sources):
Tool | What it does |
| Validates entity types ( |
| Builds a |
| Pre-flight validator catching non-sequential chain IDs, residue letter mismatches, out-of-bounds indices, invalid SMILES, malformed brackets, swapped pocket sides, invalid distance/confidence bounds, and missing covalent |
| Audits a |
Install
Add it to Claude Code:
claude mcp add chai-ground -- uvx --from git+https://github.com/shnksi/chai-ground chai-ground-mcpOr to an MCP client config:
{
"mcpServers": {
"chai-ground": {
"command": "uvx",
"args": ["--from", "git+https://github.com/shnksi/chai-ground", "chai-ground-mcp"]
}
}
}For local development:
git clone https://github.com/shnksi/chai-ground && cd chai-ground
uv sync
uv run chai-ground-mcp # MCP over stdioPair it with proteinground (uvx proteinground) to fetch canonical UniProt sequences and translate PDB author residue numbering into 1-based sequence coordinates before passing specs to chai-ground.
Optional: real GPU fold on Modal (~$0.05/complex on L40S)
scripts/modal_fold.py runs validate_chai_inputs locally before spinning up a GPU, runs chai-lab fold remotely on an L40S (chai_lab==0.6.1) capturing full stdout/stderr to chai.log, pulls down .npz/.cif/chai.log, and runs inspect_chai_outputs locally:
pip install modal && modal setup
modal run scripts/modal_fold.py --fasta path/to/complex.fasta --restraints path/to/complex.restraintsPreregistered eval
24 deterministic cases across 6 failure families (11 valid specs, 13 planted traps): chain_id_trap (4), numbering_offset_trap (6), fasta_syntax_trap (6), output_ranking_honesty (2), single_chain_iptm_trap (2), and clash_and_log_audit (4).
Bars, arms, decoys, and spend caps are frozen in evals/PREREG.md. Zero-cost offline verification (evals/dry-run/DRY_RUN_REPORT.md):
Arm | Valid correct (11) | Traps caught (13) | False alarms | Overall | Grounded | Cost |
| 100.0% | 100.0% | 0.0% | 100.0% | 100.0% | $0.00 |
| 54.5% | 0.0% | 0.0% | 25.0% | 0.0% | $0.00 |
| 0.0% | 100.0% | 100.0% | 0.0% | 0.0% | $0.00 |
Paid LLM arms (tools vs raw_files) are preregistered in evals/PREREG.md and have not yet been run; the CLI currently implements the offline verification commands (check-gold and dry-run).
Development
uv sync
uv run pytest # 9 tests, offline
uv run mypy # strict
uv run ruff check .
uv run chai-ground-eval check-gold
uv run chai-ground-eval dry-runLimits
Syntactic SMILES checking only:
validate_smileschecks character set, balanced parentheses/brackets, and atom symbols without an RDKit dependency; it will not catch chemically invalid valences or unkekulizable rings.No direct database lookups:
chai-groundvalidates FASTA and restraints against each other offline. Use proteinground to retrieve canonical sequences and verify PDB-to-UniProt numbering offsets first.Log auditing requires captured logs: Silent restraint drops and template errors are detected by scanning
chai.log(orrun.log/stderr.log, or an explicitlog_path) against knownchai-lablog messages; runs whose stderr was discarded cannot be audited for log-only drops.Eval status: The 24 offline cases, deterministic graders, and decoy brackets are verified at $0; a live LLM comparison (
toolsvsraw_files) has not yet been run.
MIT License. Sibling project to proteinground.
Available Tools
4 toolsbuild_chai_fastaARead-onlyIdempotent
Build and validate a Chai-1 FASTA from structured entity dicts.
Each entity dict requires: entity_type ('protein'|'ligand'|'dna'|'rna'|'glycan'), name (str), sequence (str). Returns sequential chai-lab chain letters (A, B, C...) or found=false with the exact validation failure.
Inputs: entities (required). Returns: data, note, found, sources, +1 more
build_chai_restraintsARead-onlyIdempotent
Build and pre-flight validate a Chai-1 .restraints CSV against a FASTA.
Maps FASTA entity names to sequential chain IDs (A, B, ...) with an explicit warning, verifies 1-based residue positions and exact wild-type residue letters, and refuses specs that chai-lab would silently drop.
Inputs: fasta_text (required), restraints (required). Returns: data, note, found, sources, +1 more
inspect_chai_outputsARead-onlyIdempotent
Audit a Chai-1 output directory (scores.model_idx_*.npz + optional chai.log).
Ranks all diffusion samples properly, flags single-chain ipTM caveats (#431), detects inter-chain steric clashes, and scans run logs for silently dropped restraints or failed template loads.
Inputs: output_dir (required), log_path. Returns: data, note, found, sources, +1 more
validate_chai_inputsARead-onlyIdempotent
Validate a Chai-1 FASTA and optional restraints CSV before GPU inference.
Catches sequential chain-ID bugs (#413/#434), residue-letter mismatches and author-vs-FASTA numbering drift (#435), mismatched modified-residue brackets (#439), invalid SMILES, and malformed pocket/contact/covalent rules.
Inputs: fasta_text (required), restraints_csv. Returns: data, note, found, sources, +1 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The four tools map to distinct pipeline stages: FASTA construction, restraints construction, combined pre-flight validation, and output auditing. The only blurring is that both builders perform their own validation while validate_chai_inputs also validates, so an agent may wonder which validation entry point to use for a given check.
All names follow a strict verb_chai_noun pattern (build_chai_fasta, build_chai_restraints, validate_chai_inputs, inspect_chai_outputs), using snake_case and a predictable prefix. No stylistic deviations.
Four tools is lean but well-matched to a focused build/validate/inspect pipeline; each earns its place. It sits near the thin end of the range, though the tight domain justifies it.
Covers the full pre-inference input path (FASTA + restraints), a validation gate, and post-run output auditing, which is solid lifecycle coverage. Minor gaps exist around editing/mutating existing entities or specifying run configuration, but these are workable around by rebuilding inputs.
Maintenance
Related MCP Connectors
Preflight QA for AI-agent deliverables with structured verdicts and repair guidance.
Deterministic validation for AI-generated artifacts: JSON Schema, OpenAPI response, SQL syntax.
CSV structural checks and keyed diffs, SRT formatting, MCP result checks and review discovery.
Deterministic PASS/FAIL deliverable checks with objective evidence and repair instructions.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables protein modeling and design using the Rosetta suite via Docker, including structure refinement, mutation stability analysis, docking, and loop modeling through natural language commands.-
- FlicenseNot gradedqualityCmaintenanceEnables protein structure prediction using the Chai-1 model via Docker, with tools for small peptides, FASTA-based predictions, MSA-enhanced predictions, batch processing, and job management.-
- AlicenseBqualityBmaintenanceEnables MCP-capable AI clients to characterize proteins end to end: PDB/mmCIF validation, sequence extraction and typing, pLDDT confidence summaries, metal-site geometry with bidentate chelate detection, GROMACS trajectory metrics and plots, and live UniProt, AlphaFold DB, and RCSB lookups. Also ships a point-and-click Protein Lab web UI (and a persistent run registry) so students and wet-lab biologists can get the same results without any client setup.31MIT
- AlicenseNot gradedqualityBmaintenanceEnables LLM agents to route bioinformatics tool calls through pre-run checks that block known silent-error traps and return one-line fixes before commands execute.Apache 2.0