This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Amber MCP is a Model Context Protocol (MCP) server wrapping AmberTools25/Amber24 for molecular dynamics simulations. It exposes three MCP tools (amber_run_protein_md, amber_prepare_system, amber_generate_input_files) that allow AI assistants to drive full protein MD workflows over stdio.
MCP Client (stdio)
→ src/server.py FastMCP("amber_mcp") entrypoint, mounts simulation sub-server
→ src/tools/simulation.py Core logic: SimulationConfig, InputFileGenerator, SimulationRunner
→ env/bin/ Amber binaries (pmemd.cuda, pmemd, sander, tleap)
→ results/ Timestamped output directories
src/tools/simulation.py (~760 lines) contains everything: config validation, input file generation, subprocess execution of Amber binaries, and all three MCP tool functions. SimulationRunner sources env/amber.sh into subprocess environment and auto-detects the best MD engine (pmemd.cuda > pmemd > sander).
scripts/single_protein_simulation.py is a standalone CLI mirror of the MCP tools (same logic, argparse interface, no fastmcp dependency).
./env/bin/python src/server.pyOr install into Claude Code:
fastmcp install claude-code src/server.py --name amber_mcp --python ./env/bin/python./quick_setup.sh # full build with CUDA
./quick_setup.sh --no-cuda # CPU-only
./quick_setup.sh --cuda-path /usr/local/cuda --jobs 8quick_setup.sh creates a conda env at ./env, installs all build dependencies, applies source patches (CMake fixes, TFE GBSA Fortran declarations, numpy<2.0 for parmed), builds with CMake+make, and verifies key binaries.
docker build -t amber_mcp . # CPU-only multi-stage build
docker run -i amber_mcp # runs src/server.py on stdioCI pushes to ghcr.io on every push to main and version tags via .github/workflows/docker.yml.
No automated test suite exists. Manual testing is done via the example workflow:
source ./env/amber.sh
export OPAL_PREFIX=$(dirname $(which pmemd))/..
cd example && ./quick_test.sh # fast integration check
cd example && ./run_all.sh # full pipeline on 1l2y.pdb- Python deps:
fastmcp,loguru,numpy<2.0(pinned for parmed compatibility). No pyproject.toml; deps installed byquick_setup.sh. - Python version: 3.11 (pinned in setup script and Dockerfile)
- Production timestep: 2 fs. Step count =
sim_time_ns * 500_000. - Simulation stages: tleap → minimization with restraints → minimization without restraints → NVT heating (50 ps) → NPT equilibration (500 ps) → NPT production.
- Force fields: ff14SB, ff19SB (default). Water models: tip3p, opc (default), tip4pew.
- GPU selection:
SimulationConfigparsesgpu_device(e.g."cuda:1"or"1") and setsCUDA_VISIBLE_DEVICES. - Environment activation:
SimulationRunnerreadsenv/amber.shand injects all exported variables into subprocessenvdict — it does not use shell sourcing.