mlmm MCP server¶
mlmm-mcp is an MCP server that lets any
MCP-compatible agent run every mlmm CLI subcommand via JSON-RPC over stdio
— including Claude Desktop / Claude Code / Cursor / Codeium, and any custom
agent built on the official Python or TypeScript MCP SDKs.
Install¶
pip install "mlmm-toolkit[mcp]"
This adds the mcp[cli] dependency and registers the mlmm-mcp console
script.
Tools¶
22 tools, one per CLI subcommand. Each tool returns a structured dict (SubcmdResultDict in mlmm.mcp._runner) with:
schema_version: envelope version. Live value:mlmm.mcp._runner.MCP_SUBCMD_RESULT_SCHEMA_VERSION. A version bump signals a field-set or value-type change; pin to the constant rather than the literal value in this doc.status:ok|failed|summary_missing|summary_parse_errorexit_code: subprocess exit codeout_dir: working directory the CLI wrote tosummary: parsedsummary.json(CLI output schema; see JSON Output Reference for the per-stage shape)stderr_tail/stdout_tail: last ~60 lines of process outputhint: parsed; recover: <hint>suffix from CLI error messages, if anyargv: the full argv that was executed (for reproducibility)
For typed-Python consumers, mlmm.mcp._runner also exposes SubcmdResultDict (a TypedDict mirroring the runtime payload) and MCP_SUBCMD_RESULT_STATUSES (the enum tuple of allowed status strings).
Structured error envelope¶
When a subcommand fails, the parsed summary (or sibling result.json) carries an extended error envelope so agents can pattern-match the exception class hierarchy without parsing text:
error:str(exc)of the original exceptionerror_type: exception class name (e.g."OptimizationError")error_class_chain: MRO class names (e.g.["OptimizationError", "RuntimeError", "Exception", "BaseException"])error_module: defining module of the exception classerror_label: the high-level CLI stage label (e.g."opt","tsopt-stage")
Topology / layer prep (mlmm-specific)¶
MCP tool |
CLI subcmd |
Purpose |
|---|---|---|
|
|
Generate AMBER parm7/rst7 via AmberTools |
|
|
Assign ML / MM-movable / MM-frozen B-factor layers |
|
|
Cut a sphere around a ligand to make an active-site model |
Stage runners (ONIOM-aware)¶
MCP tool |
CLI subcmd |
Purpose |
|---|---|---|
|
|
ONIOM geometry opt (microiter macro / micro) |
|
|
ONIOM TS search (RS-I-RFO / Dimer / TRIM / RS-P-RFO) |
|
|
ONIOM IRC integration from a TS geometry |
|
|
ONIOM vibrational analysis + thermochemistry |
|
|
ONIOM single-point energy + forces (+optional Hessian) |
Scans / paths / pipeline¶
MCP tool |
CLI subcmd |
Purpose |
|---|---|---|
|
|
ONIOM restraint scans |
|
|
Two-endpoint ONIOM MEP optimization |
|
|
Recursive ONIOM pathway search |
|
|
End-to-end: extract → MEP → TS → IRC → freq → DFT |
|
|
ONIOM-embedded single-point DFT via gpu4pyscf |
ONIOM I/O (Gaussian / ORCA)¶
MCP tool |
CLI subcmd |
Purpose |
|---|---|---|
|
|
Write a Gaussian g16 / ORCA ONIOM input deck |
|
|
Read a Gaussian / ORCA ONIOM input back to XYZ / layered PDB |
Structure / I/O helpers¶
MCP tool |
CLI subcmd |
Purpose |
|---|---|---|
|
|
Repair PDB element columns |
|
|
Resolve PDB alternate locations |
|
|
Energy profile PNG / HTML / SVG / PDF |
|
|
Categorical energy diagram |
|
|
Bond-change diff between two PDBs |
Opt-in IRC convergence guard¶
run_irc accepts irc_pos_def: bool — IRC convergence then additionally
requires a positive-definite mass-weighted Hessian, blocking the IRC
“shoulder” false-convergence where the rms-only criterion declares success
before reaching the local minimum. Defaults to None (rms-only, legacy).
find_transition_state accepts opt_mode="trim" (Helgaker 1991) /
opt_mode="rsprfo" (Banerjee 1985) as alternative TS optimizers; the
server passes --no-microiter automatically since those modes are not
microiter-capable.
Client configuration¶
Every MCP client takes the same mcpServers schema. Drop the snippet below
into your client’s MCP config file (Claude Desktop’s
~/Library/Application Support/Claude/claude_desktop_config.json on macOS,
Cursor’s ~/.cursor/mcp.json, etc.):
{
"mcpServers": {
"mlmm": {
"command": "mlmm-mcp",
"args": []
}
}
}
See examples/mcp_client_config.json
for a full example with explicit env-var overrides (PATH / AMBERHOME /
CUDA_VISIBLE_DEVICES).
Sandbox / safety notes¶
The MCP server inherits the calling environment’s PATH, conda env, CUDA setup, and AmberTools path. Each tool spawns the
mlmmCLI as a subprocess, so long-running tools (opt / tsopt / irc / scan) run out-of-process — settimeout_secondson each call to bound them.Output files land under the
out_dirkwarg (defaults to a uniquetempfile.mkdtemp("mlmm_mcp_<subcmd>_…")).The server does not modify
~/.bashrc/ login env, install software, or write outsideout_dir. Required inputs (PDBs, parm7, ML weights) must already exist on disk.