Skip to content

CLI Reference

MolForge ships dedicated command-line tools for scripting, the desktop workbench, AI chat, MCP integration, studio path tracing, collaboration relays, and plugin verification.


molforge — Headless & Interactive Runner

molforge [files ...] [--headless | -q] [-d COMMANDS] [-c PYTHON] \
         [--log FILE.pml] [--gui] [--verbose | -v] [--version] [--check]
Flag Description
files ... Structure files (.pdb, .cif, .sdf, …), .pml/.cmd scripts, or .py scripts executed in order.
--headless, -q Run without GUI or interactive prompt; exit when finished.
-d COMMANDS Run semicolon-separated PyMOL commands (repeatable).
-c CODE Execute Python code with cmd and session in scope (repeatable).
--log FILE.pml Save the complete replayable .pml transcript on exit.
--gui Launch the desktop app (molforge-app) if installed on PATH.
--verbose, -v Keep PyMOL console feedback enabled.
--version Print MolForge, engine, and PyMOL API versions.
--check Diagnose installation: engine type, PYMOL_DATA, _cmd count, PyMOL conflicts, and fragment smoke test.

Examples:

molforge --check
molforge --headless -d "fetch 1ubq; show cartoon; bg_color white; png 1ubq.png, ray=1"
molforge --headless analysis.py --log replay.pml

molforge-app — Desktop Workbench

molforge-app [files ...] [-d "pymol command"] [--chat "prompt"] \
             [--screenshot out.png [--frames N]] [--check]
Flag Description
files ... Load structures, maps, scenes, or run .pml/.py scripts on startup.
-d COMMAND Run PyMOL command(s) after startup (repeatable).
--chat MESSAGE Send an initial prompt to the AI Assistant panel.
--screenshot PATH Render --frames N frames, capture the workbench window to PNG, and exit.
--check Run embedded-Python & engine self-check without opening a GUI window.

molforge-ai — Terminal AI Chat REPL

Equivalent to python -m molforge.ai:

molforge-ai [--load FILE] [--log session.pml] [--provider anthropic|openai] \
            [--model NAME] [--policy auto|ask|trust|deny] [-c "message"] [--thinking]

Interactive REPL shortcuts:

  • ! <pymol cmd> — execute a raw PyMOL command (also logged)
  • /save FILE.pml, /log, /tools, /policy MODE, /reset, /help, /quit

molforge-mcp — MCP Stdio Server

Equivalent to python -m molforge.mcp:

molforge-mcp [--load FILE] [--policy auto|ask|trust|deny] [--allow-install]

Exposes all 120 typed tools over newline-delimited JSON-RPC 2.0 stdio, plus the live replayable log resource molforge://session/log.pml.


mf-pathtrace — GPU Path Tracer & AR Exporter

# Path-traced figure from a MolForge scene (.mfscene.json / .json.gz)
mf-pathtrace scene.json -o out.png --width 1920 --height 1080 --spp 256 \
    --preset publication|cinematic|goodsell|glossy \
    [--dof 0.02] [--focus DEPTH | --focus-point x,y,z] \
    [--transparent] [--bg r,g,b] [--exposure E] [--outline PX] \
    [--no-denoise] [--no-clip] [--bounces N] [--ortho | --perspective] [--cpu | --gpu] [--json]

# 360-degree turntable frames (+ optional ffmpeg MP4)
mf-pathtrace turntable scene.json -o frames/ --frames 72 [--degrees 360] [--mp4 spin.mp4 --fps 30]

# 3D / AR export & structural validation
mf-pathtrace export-glb  scene.json -o model.glb  [--scale 0.01 | --size 0.5] [--no-view] [--no-ground]
mf-pathtrace export-usdz scene.json -o model.usdz [--scale 0.01 | --size 0.5] [--no-view] [--no-ground]
mf-pathtrace validate model.glb|model.usdz
mf-pathtrace info scene.json

Module CLIs (python -m ...)

Command Purpose
python -m molforge.collab --host 127.0.0.1 --port 8765 [--data-dir DIR] [--fsync] Standalone multiplayer WebSocket relay server
python -m molforge.collab.bridge --url ws://... --token TOKEN --port 8790 Browser scene bridge for WASM multiplayer participants
python -m molforge.plugins check\|install\|list ... Scan legacy PyMOL plugins for compatibility and install safely
python -m molforge.provenance.replay --bundle DIR Reproduce a provenance figure bundle offline
python -m molforge.traj.benchmark --atoms 50000 --frames 200 Benchmark XTC/DCD decoders