fairchem-mcp

fairchem-mcp

An interactive MCP server for FAIRChem and ASE simulations that allows LLM agents to load a model once and steer relaxations, MD, NEB, phonons, and minima searches mid-flight, with live monitoring and code introspection.

Category
访问服务器

README

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.

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.

Register with Claude Code

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_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.

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选