MCP server to drive a running PyKeko (Moorhen-based Coot) desktop app
PyKekoMCP has well-structured tool definitions with consistent naming (moorhen_* prefix), clear descriptions (avg ~150 chars), and complete Zod schemas for all 17 tools. However, several tools lack parameter descriptions (moorhen_get_state, moorhen_screenshot have empty schemas), and error handling is minimal, most tools simply propagate raw HTTP/JSON errors without recovery guidance. Output schemas are not documented. The moorhen_eval tool is particularly risky: it accepts arbitrary JavaScript with minimal guardrails. Overall solid foundation but missing production-grade error messaging and output documentation.
Add a terminal residue at a residue CID. Requires an active map.
Auto-add waters into positive density peaks. Requires an active map.
Auto-fit a residue's rotamer to density (CID e.g. //A/45). Requires an active map.
Delete atoms matching a literal CID (e.g. /1/A/45/* deletes residue 45 of chain A).
Evaluate JavaScript inside the PyKeko renderer's global scope and return a printable summary of the result. Scope is the renderer (window, document, MoorhenControlApi, all loaded React/Redux state) — same access as Chrome DevTools, NO main-process / Node / fs access. Use this to introspect live state, test hypotheses, drive the bridge directly. Single expressions (e.g. `MoorhenControlApi.listMolecules?.()`) and statement blocks (e.g. `const m = ...; m.atomCount`) both work; `await` is supported. The returned `repr` is a JSON-stringified, depth- and length-capped summary (`undefined` for void, the value itself for primitives, type-tagged + key-listed object skeleton for objects). Errors come back as `kind: 'error'` with the stack in `error`.
moorhen_eval accepts arbitrary JavaScript with minimal guardrails. Description warns of scope but does not explain validation, sandboxing, or error recovery. Poses injection risk if LLM is tricked into malicious payloads.
No output schemas documented for any tool. LLMs cannot predict response structure, forcing them to parse unstructured JSON. Increases hallucination risk and wastes tokens on discovery.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 61 | 2026-07-28+ | v2 |
Flip the peptide bond at an atom CID (e.g. //A/45/CA).
List loaded molecules and maps (with atom counts) and the active map.
Recenter the 3D view on a residue/atom CID (e.g. //A/45 or /1/A/45/CA).
Load a structure into Moorhen from a local file path or a PDB accession id.
Load a map from a local .mtz (reflections; auto structure factors) or .ccp4/.map/.mrc file, and set it as the active (refinement) map.
Redo the last undone edit on a molecule.
Real-space refine around a residue CID. mode: SINGLE | TRIPLE | SPHERE | CHAIN | ALL. Requires an active map.
Spawn CCP4's dimple auto-pipeline (rigid-body / MR + restrained refinement + optional ligand fit) end-to-end. Inputs: model PDB path, MTZ path, optional ligand CIF path or SMILES. Refined model lands at <outDir>/final.pdb and is loaded back into PyKeko automatically. Typical runtime 2-10 minutes; progress streams to the in-app log console. Requires CCP4 installed locally.
Capture a PNG screenshot of the current Moorhen 3D view.
Set which loaded map (by molNo) is active for refinement.
Change PyKeko's active working directory. Files saved by PyKeko's in-app save handlers (covalent link, save-text-file, save-augmented-cif, native save-dialog defaults) all route to this directory after the change. Accepts ~, $VAR, and relative paths.
Undo the last edit on a molecule.
Error handling is minimal. Tools propagate raw HTTP errors (e.g., 'Cannot reach the Moorhen control server') without recovery guidance. LLMs cannot determine if errors are retryable, user-fixable, or fatal.
moorhen_get_state and moorhen_screenshot have empty input schemas ({}). These tools lack parameter documentation.
Destructive tools (moorhen_delete, moorhen_run_dimple) lack confirmation or dry-run support. Agents can irreversibly delete atoms or overwrite models without safeguards.