Skip to main content
Glama

fairchem-mcp

An agent-steerable MCP server for FAIRChem and ASE simulations.

Most LLM-driven simulation today is batch: the agent writes a script, runs it, waits, and reads the output. fairchem-mcp makes it interactive. The model is loaded once and kept resident; relaxations and MD run in the background; and the agent can watch a simulation as it runs and steer it mid-flight — switch the optimizer when it stalls, tighten fmax, change temperature, pause, or abort.

Why

  • Resident model. Load a UMA/eSEN model once; reuse it across every call. No reloading the model (seconds–minutes) on each run.

  • Live monitoring. get_status returns step, energy, max force, and a trend verdict (decreasing / plateaued / stuck / diverging) so the agent can decide whether to intervene.

  • Mid-flight steering. steer can pause / resume / abort, set_fmax, switch_optimizer, or set_temperature on a running job. Switching optimizer carries the atomic positions over — it just rebuilds the driver.

  • Hybrid namespace. High-level tools (start_relaxation, …) and the execute / inspect_expr escape hatch share one Python namespace, so the agent can drop to raw Python on the very same live Atoms.

  • Code awareness. introspect reads the installed API (real signatures and docstrings) and live objects via jedi — not possibly-stale docs.

Related MCP server: MOF Tools MCP Server

Install

pip install -e .              # core: mcp + ase + jedi + numpy (works with EMT)
pip install -e ".[fairchem]"  # add FAIRChem (torch + models) for UMA/eSEN
pip install -e ".[lammps]"    # add LAMMPS as a classical force engine
pip install -e ".[saddles]"   # add Sella + POUNCE for transition-state searches

ASE, numpy, jedi and mcp are core dependencies (installed automatically) — the server is fully usable out of the box with the built-in EMT calculator.

FAIRChem (optional)

pip install -e ".[fairchem]" pulls in fairchem-core (PyTorch + models). To actually load a UMA model you also need:

  • a Hugging Face account with approved access to the facebook/UMA model repository, and huggingface-cli login (or HF_TOKEN) set;

  • PyTorch for your platform (CUDA build for GPU; CPU works but is slower).

Everything except load_model works with a plain ASE calculator (attach_emt), so you can develop and test without a GPU or model.

LAMMPS (optional)

pip install -e ".[lammps]" installs the lammps Python package. LAMMPS is used as a force engine (classical potentials) while ASE drives the dynamics, so attach_lammps works with every steerable job (MD, relaxation, NEB, phonons, EOS, minima search).

macOS note (Homebrew MPICH): the PyPI lammps wheel links @rpath/libmpi.12.dylib and libpmpi.12.dylib, which the dynamic loader can't find by default. If you have Homebrew's mpich (brew install mpich), attach_lammps auto-symlinks those libs into the lammps package directory on first use. If that can't be applied (read-only install, non-Homebrew MPI), either symlink them yourself or export before launching the server:

export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_FALLBACK_LIBRARY_PATH

Verify with: python -c "from lammps import lammps; lammps(cmdargs=['-log','none','-screen','none']).close(); print('ok')".

Transition-state searches (optional)

pip install -e ".[saddles]" adds two extra saddle-point backends: sella (a rational-function ASE optimizer) and pounce-solver (multistart eigenvector following). The dimer method (start_saddle_search) is pure ASE and needs neither. See examples/saddles/ for all three.

Install with knowhow

This repo is a knowhow source. It provides the fairchem MCP server (mcp/fairchem.json) and a fairchem-mcp skill (skills/fairchem-mcp/), which teaches the agent how to use the tools: the start/poll/steer loop, how to respond to each trend label, and which job to use for which question. One command installs both, with no clone needed:

uvx knowhow add jkitchin/fairchem-mcp --skill fairchem-mcp --mcp fairchem
# add -g for all projects, -a vscode / -a cursor / -a codex for other agents

The server is launched with uvx --from git+https://github.com/jkitchin/fairchem-mcp fairchem-mcp, which is the core install (EMT and ASE). To load UMA models, edit the installed config so the --from argument is fairchem-mcp[fairchem] @ git+https://github.com/jkitchin/fairchem-mcp (likewise [lammps] or [saddles]). The first launch downloads PyTorch, so run that uvx command once in a terminal before starting the agent. Otherwise the MCP startup can time out.

Register with Claude Code manually

Add to your MCP config (see examples/claude_mcp_config.json):

{
  "mcpServers": {
    "fairchem": { "command": "fairchem-mcp" }
  }
}

Tools

Tool

Purpose

list_models

List FAIRChem pretrained models

load_model

Load a UMA/eSEN model as a resident calculator

attach_emt

Attach a fast EMT calculator (no GPU/model)

attach_lammps

Attach LAMMPS (classical potentials) as the force engine

build_structure / load_structure

Make/register an ASE structure

start_relaxation / start_md

Launch a background relaxation / MD (returns a job_id)

start_neb

Launch a steerable nudged-elastic-band (reaction barrier)

start_saddle_search

Transition state via the dimer method (Hessian-free)

start_sella_search

Transition state via Sella (RFO + approximate Hessian)

start_pounce_saddles

Enumerate saddles by Morse index (POUNCE eigenvector following)

start_phonons

Launch a finite-displacement phonon calculation

start_eos_scan

Scan cell strain → fit equation of state (V0, E0, bulk modulus)

start_elastic_scan

Stress-vs-strain → elastic tensor (C_ij), VRH moduli, Born stability

start_convex_hull

Formation energies + convex hull (phase stability, energy above hull)

start_minima_search

Find multiple distinct relaxed geometries via deflation/flooding

get_status / get_trajectory

Observe a running job

get_results

Final results: NEB barrier/energies, phonon frequencies & stability, distinct minima, EOS fit

steer

pause/resume/abort/set_fmax/switch_optimizer/set_temperature/set_climb

introspect

Signatures/docstrings/members of installed code or live objects

execute / inspect_expr

Run/eval Python in the shared session namespace

Resources: sim://models, sim://job/{id}/status, sim://job/{id}/trajectory.

Example flow

attach_emt()                      -> calc_1
build_structure({"kind":"bulk","name":"Cu","crystalstructure":"fcc",
                 "a":3.6,"repeat":[2,2,2],"rattle":0.2})  -> struct_1
start_relaxation("struct_1","calc_1",optimizer="FIRE",fmax=0.01)  -> job_1
get_status("job_1")               -> {status:"running", trend:{label:"stuck", ...}}
steer("job_1","switch_optimizer",optimizer="LBFGS")
get_status("job_1")               -> {status:"converged", ...}
introspect("atoms", live=True)    -> live object signature/docstring

Finding multiple relaxed geometries

start_minima_search finds several distinct local minima of the PES — useful for surface adsorption sites, cluster isomers, or conformers. It relaxes repeatedly from the starting structure on a PES biased to repel the minima already found, then polishes each escape on the true PES:

  • kernel="flooding" (default) adds Gaussian bumps (sigma Å, amplitude eV); kernel="deflation" adds inverse-distance poles (eta, power). Both are best for fixed-frame problems (an adsorbate on a frozen slab, an anchored conformer).

  • kernel="basinhopping" (random kick + relax + Metropolis accept) is the right tool for free clusters / nanoparticles, whose rigid-body rotation defeats a spatial bias. Pair it with comparator="fingerprint" (see below).

  • New minima are deduplicated by energy (energy_tol) plus a structure comparator: "rmsd" (raw coords, frame-dependent — fine for a fixed frame) or "fingerprint" (sorted pairwise distances; rotation/translation/permutation invariant — use for free clusters and molecules, or rotated copies get miscounted as distinct). Each accepted minimum is registered as its own structure.

This reuses the escape mechanism from POUNCE's find_minima (deflation / flooding) but drives it with ASE's gradient optimizers — the right inner solver for a PES — so each escape relaxation is a normal steerable job (watch the trend, switch_optimizer, set_fmax, pause/abort). POUNCE's interior-point solver is deliberately not used as the inner relaxer.

Examples

examples/catalysis/ has four end-to-end catalysis workflows — adsorption energy, adsorption-site search, diffusion-barrier NEB, and surface-stability phonons — each as a runnable script and an MCP tool-call walkthrough. They run on EMT out of the box; set FAIRCHEM_MCP_EXAMPLE_MODEL for UMA.

examples/saddles/ covers the three single-ended transition-state routes — dimer, Sella, and POUNCE eigenvector following — on one shared system so you can compare them.

examples/alloys/ builds up to alloy design: the elastic stiffness tensor (start_elastic_scan), the formation-energy convex hull (start_convex_hull), and a design loop that gates candidates on stability then ranks the survivors by a mechanical property.

Safety

execute / inspect_expr run arbitrary Python in-process. This is a trusted local developer tool — do not expose it to untrusted input or over a network.

Notes

  • Only one job runs at a time (serializes model/GPU access).

  • All optimizers/integrators use logfile=None; the stdio transport reserves stdout for the MCP protocol.

Available Tools

17 tools
attach_emtA

Attach a fast EMT calculator (no GPU/model needed). Useful for quick tests on Cu/Ag/Au/Ni/Pd/Pt/Al/Pb and method development.

Inputs: no named parameters.

build_structureA

Build an ASE structure from a declarative spec and register it.

Examples: {"kind":"bulk","name":"Cu","crystalstructure":"fcc","a":3.6,"repeat":[2,2,2]} {"kind":"molecule","name":"H2O"} {"kind":"surface","name":"Pt","size":[2,2,4],"vacuum":10.0} Add "rattle": 0.1 to perturb positions (good for testing relaxation).

Inputs: spec (required).

executeA

Execute Python in the persistent session namespace (escape hatch).

The namespace is shared with all tools: structures, calculators and jobs are bound by id (struct_1, calc_1, job_1) plus aliases (atoms, calc, job). Trusted local-dev use only. Captured stdout is returned.

Inputs: code (required).

get_resultsA

Return a job's final results, if any: NEB barrier/energies, or phonon gamma frequencies and stability. None until the job finishes.

Inputs: job_id (required).

get_statusA

Get a live snapshot of a job: status, step, energy, max_force, and a 'trend' verdict (decreasing / plateaued / stuck / diverging) so you can decide whether to intervene.

Inputs: job_id (required).

get_trajectoryA

Return the recent energy/force history of a job (last_n snapshots).

Inputs: job_id (required), last_n.

inspect_exprA

Evaluate an expression in the session namespace and return its repr.

e.g. 'atoms.get_potential_energy()' or 'np.linalg.norm(atoms.get_forces(),axis=1).max()'.

Inputs: expr (required).

introspectA

Introspect installed code or live objects.

Static (live=False): dotted path, e.g. 'fairchem.core.calculate.ase_calculator.FAIRChemCalculator'. Live (live=True): an expression over the session namespace, e.g. 'atoms'. A trailing '.' (e.g. 'atoms.' or 'ase.build.') lists members/completions. Returns signature, docstring and members.

Inputs: target (required), live.

list_modelsA

List FAIRChem pretrained models (UMA, eSEN, ...) if FAIRChem is installed.

Inputs: no named parameters.

load_modelA

Load a FAIRChem model as an ASE calculator, kept resident in memory.

task is the prediction domain: omat (inorganic), omol (molecules), oc20 (catalysis), odac (MOFs), omc (molecular crystals). Returns a calculator_id to pass to start_relaxation/start_md.

Inputs: model, task, device.

load_structureB

Load a structure from any ASE-readable file (cif, xyz, traj, POSCAR, ...).

Inputs: path (required), index.

start_mdA

Start molecular dynamics (NVT Langevin or NVE) in the background.

step_delay (seconds) throttles steps so you can observe/react between them.

Inputs: structure_id (required), calculator_id (required), ensemble, temperature_K, +3 more.

start_nebA

Start a nudged elastic band (reaction barrier) between two relaxed endpoints, in the background. nimages is the number of intermediate images.

Steerable like a relaxation (pause/resume/abort/set_fmax/switch_optimizer) plus steer set_climb to enable the climbing image near convergence. When done, get_results returns the forward/reverse barrier and image energies.

Inputs: initial_id (required), final_id (required), calculator_id (required), nimages, +6 more.

start_phononsA

Start a phonon (finite-displacement) calculation in the background.

Runs 1 + 6*natoms force evaluations; poll get_status for progress (done/total, fraction). When done, get_results returns gamma-point frequencies (THz), the count of imaginary modes, and a 'stable' flag. supercell defaults to [2,2,2].

Inputs: structure_id (required), calculator_id (required), supercell, delta, +1 more.

start_relaxationA

Start a geometry optimization in the background; returns immediately.

Poll get_status to watch progress, and steer() to change fmax, switch optimizer, pause or abort mid-run. Set relax_cell=True to also relax the cell. step_delay (seconds) throttles steps — useful with fast calculators so you have time to observe and react between steps.

Inputs: structure_id (required), calculator_id (required), optimizer, fmax, +3 more.

steerA

Steer a running job mid-flight.

command is one of: pause, resume, abort, set_fmax, switch_optimizer, set_temperature, set_climb. Use value for set_fmax / set_temperature, optimizer for switch_optimizer (FIRE / LBFGS / BFGS), and set_climb to enable the climbing image on a NEB (value 0/1, default on).

Inputs: job_id (required), command (required), value, optimizer.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 17 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose. Potential overlaps (e.g., attach_emt vs load_model) are resolved by descriptions specifying different types of calculators. Similarly, build_structure vs load_structure, and the various start_* tools are differentiated by their specific computational tasks.

    Naming Consistency4/5

    Tools mostly follow a verb_noun pattern (e.g., build_structure, load_model, start_relaxation). A few exceptions like execute and introspect are verb-only, but overall the naming is predictable and well-organized with prefixes like get_, start_, load_.

    Tool Count5/5

    With 17 tools, the server covers the essential workflows for computational chemistry (structure handling, calculator setup, multiple simulation types, monitoring, and introspection) without being bloated. Each tool earns its place.

    Completeness5/5

    The tool set provides complete lifecycle coverage: structure creation/loading, calculator attachment, running various simulations (relaxation, MD, NEB, phonons, minima search), job control (steering, status, results), and introspection. No obvious gaps for typical usage.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      F
      maintenance
      A Model Context Protocol server that enables AI assistants to interact with LAMMPS for molecular dynamics simulations through natural language commands.
      13
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      A specialized MCP server for Metal-Organic Framework research that provides tools for database searching, structural optimization, and energy calculations via ASE. It enables scientific workflows by allowing users to interact with MOF data and perform chemical simulations through a standard SSE interface.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server for quantum chemistry that enables LLMs to perform electronic structure analysis, parse calculation outputs, and generate 3D orbital visualizations. It integrates tools like PySCF, cclib, and py3Dmol to facilitate molecular structure manipulation and bonding analysis through natural language.
      BSD 3-Clause
    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server for discovering ColabFit materials science datasets and training MACE interatomic potentials on local hardware, enabling AI assistants to search, download, train, and validate models.
      3
      -