Skip to main content
Glama
Biomolecule Modeling MCP Server

Biomolecule Modeling MCP Server

Biomolecule Modeling MCP Server

An MCP (Model Context Protocol) server that lets AI assistants (Claude, etc.) clean PDB structures and run initial-stage energy relaxation — the preparation step before production MD or coarse-graining (e.g. Martini) pipelines.


Quickstart (Claude Code)

The easiest way to use this server is via uvx — no manual dependency management needed:

claude mcp add "biomolecule-modeling" --scope user -- \
  uvx --from git+https://github.com/YOUR_USERNAME/biomolecule-modeling-mcp biomodeling

That's it. uvx installs the package and all its Python dependencies into an isolated environment automatically. After running this command, restart Claude Code and the server will be listed under active MCP servers.

OpenMM note: uvx installs the PyPI wheel of OpenMM (CPU-only). If you need GPU acceleration, install OpenMM via conda first (conda install -c conda-forge openmm pdbfixer) and use the manual registration method instead.


Related MCP server: MCP-GMX-VMD

What It Does

The server exposes a set of tools that guide an LLM through a structured workflow:

query_pdb_structure          # inspect chains, sequences, gaps, structural breaks
  └─ split_pdb               # separate protein / nucleic acid / ligands
       └─ fix_pdb_structure  # clean structure (PDBFixer): residues, hydrogens, heavy atoms
            └─ assemble_pdb_structures  # recombine components after separate fixing
                 └─ relax_pdb_structure # energy minimise ± short restrained MD (OpenMM)

At any point get_workflow_report returns a Markdown summary of every decision the LLM made, with its reasoning, which can be saved to disk.


Tools

Tool

Description

query_pdb_structure

Chain-level inspection: type, sequence, residue range, numbering gaps, backbone breaks

split_pdb

Split a multi-component PDB into per-type files (protein, nucleic, ligands)

fix_pdb_structure

PDBFixer wrapper: remove heterogens, replace non-standard residues, add missing atoms/hydrogens

assemble_pdb_structures

Merge multiple PDB files back into one, with conflict resolution

relax_pdb_structure

OpenMM energy minimisation + optional short backbone-restrained MD

query_ff_presets

List available force-field presets and their parameters

get_workflow_report

Return and/or save a Markdown report of all tool calls and LLM reasoning

reset_workflow_report

Clear the session log for a new structure

set_working_directory

Change the working directory for relative path resolution


Force-Field Presets

Preset

Solvent

Notes

amber14_implicit

GBn2 implicit

Default. No periodic box needed. Fast.

amber14_explicit

TIP3P-FB explicit

Requires pre-solvated periodic box

amber99sb_implicit

OBC2 implicit

Older AMBER, implicit solvent

charmm36_explicit

CHARMM TIP3P explicit

Requires pre-solvated periodic box


Manual Installation

Use this method if you want GPU-accelerated OpenMM or prefer a local checkout.

conda install -c conda-forge openmm pdbfixer

2. Clone and install dependencies

git clone https://github.com/YOUR_USERNAME/biomolecule-modeling-mcp
cd biomolecule-modeling-mcp
uv sync

3. Register with Claude Code

claude mcp add "biomolecule-modeling" --scope user -- \
  /path/to/uv run --directory /path/to/biomolecule-modeling-mcp python main.py

Replace /path/to/uv with which uv and use the absolute path to the cloned repo.

Important: use --directory (not --project). --project sets the virtualenv but leaves cwd wherever the caller is, which breaks relative utils/ imports.

Standalone scripts (no MCP client needed)

uv run utils/pdb_query.py structure.pdb        # inspect structure
uv run utils/pdb_fix.py input.pdb              # fix structure
uv run utils/openmm_relax.py input.pdb         # minimise structure

Example Sessions

The following examples show real natural-language prompts you can give Claude, and the sequence of tool calls the server will drive in response.


Case 1 — Download, inspect, clean, and relax a PDB from RCSB

Your prompt to Claude:

Download PDB 1UBQ, query its structure information, clean the protein part, and relax the structure.

What Claude does:

Step 1 — Download the file

Claude fetches 1UBQ.pdb from RCSB (https://files.rcsb.org/download/1UBQ.pdb) and saves it locally.

Step 2 — Inspect the structure

query_pdb_structure(
    pdb_file="1UBQ.pdb",
    notes="Initial inspection before cleaning. Need to identify chain types, "
          "any non-standard residues, and structural gaps."
)
chains:
  A — protein, 76 residues (MET1–GLY76), no numbering gaps, no structural breaks
heterogens: HOH (58 water molecules)
non_standard_residues: []
missing_residues: []

Claude's reasoning: Single protein chain, no gaps, no non-standard residues. Waters present — will remove them. No ligands to worry about; can go straight to fix_pdb_structure.

Step 3 — Clean the structure

fix_pdb_structure(
    input_pdb="1UBQ.pdb",
    output_pdb="1UBQ_fixed.pdb",
    remove_heterogens=True,      # removes the 58 water molecules
    add_hydrogens=True,
    ph=7.0,
    fix_missing_residues=False,  # no gaps — nothing to fix
    notes="Removing waters, adding hydrogens at pH 7.0. No non-standard residues "
          "or gaps detected so no other fixing steps needed."
)
output_pdb: 1UBQ_fixed.pdb
n_residues: 76
n_atoms: 1231
heterogens_removed: 58
nonstandard_residues: []
missing_atoms_added: 0
hydrogens_added: true

Step 4 — Relax the structure

relax_pdb_structure(
    input_pdb="1UBQ_fixed.pdb",
    output_pdb="1UBQ_relaxed.pdb",
    preset="amber14_implicit",
    run_md=False,
    notes="Minimisation-only run. Structure is clean and small (76 residues); "
          "a full MD run is not needed for clash removal."
)
output_pdb: 1UBQ_relaxed.pdb
preset_used: amber14_implicit
n_atoms: 1231
energy_initial_kJ_mol: -18423.4
energy_final_kJ_mol:   -24817.9

Claude's summary: Energy dropped ~6400 kJ/mol during minimisation — typical for a crystal structure after hydrogen addition. Output 1UBQ_relaxed.pdb is ready for downstream MD or coarse-graining.


Case 2 — Clean a local multi-chain structure, keep only selected chains

Your prompt to Claude:

Query the PDB structure under ./structures/complex.pdb, clean it to keep only chain A and chain B, and relax the structure.

What Claude does:

Step 1 — Inspect the structure

query_pdb_structure(
    pdb_file="./structures/complex.pdb",
    notes="Inspecting the multi-chain complex before chain selection and cleaning."
)
chains:
  A — protein, 312 residues (SER5–LEU316), 2 numbering gaps (at 47–51, 203–208)
  B — protein, 289 residues (MET1–LYS289), no gaps
  C — protein, 145 residues (ALA1–GLU145), no gaps
  D — nucleic (DNA), 24 residues
heterogens: MG (3 ions), HOH (412 waters), ATP (1 molecule)
non_standard_residues: [MSE → MET in chain A (4 occurrences)]

Claude's reasoning: User wants chains A and B only. Chain A has two numbering gaps — these are likely short disordered loops in the crystal; will not attempt loop modelling. MSE (selenomethionine) in chain A will be converted to MET. ATP and ions must be removed before OpenMM relaxation.

Step 2 — Clean, keeping only chains A and B

fix_pdb_structure(
    input_pdb="./structures/complex.pdb",
    output_pdb="./structures/complex_AB_fixed.pdb",
    chains_to_keep=["A", "B"],
    replace_nonstandard_residues=True,   # converts MSE → MET
    remove_heterogens=True,              # removes ATP, Mg²⁺, waters
    add_missing_heavy_atoms=True,
    add_hydrogens=True,
    ph=7.0,
    fix_missing_residues=False,          # gaps are 4–5 residues; skipping loop modelling
    notes="Keeping chains A and B only per user request. Converting 4 × MSE → MET "
          "in chain A. Removing ATP, Mg ions, and waters — these cannot be "
          "parameterised with standard AMBER presets. Not fixing the two loops "
          "in chain A (gaps of 4–5 residues) to avoid poor loop geometry."
)
output_pdb: complex_AB_fixed.pdb
n_residues: 601   (312 + 289)
n_atoms: 9847
chains_kept: [A, B]
nonstandard_residues: [MSE→MET ×4 in chain A]
heterogens_removed: 416   (ATP ×1, MG ×3, HOH ×412)
missing_atoms_added: 12
hydrogens_added: true

Claude's warning to user: "Chain A still has two short gaps at residues 47–51 and 203–208 (missing from the crystal structure). These regions will be absent in the relaxed output. If you need complete loops for your downstream simulation, let me know and I can attempt loop modelling — though the geometry for gaps this size may be rough."

Step 3 — Relax the two-chain complex

relax_pdb_structure(
    input_pdb="./structures/complex_AB_fixed.pdb",
    output_pdb="./structures/complex_AB_relaxed.pdb",
    preset="amber14_implicit",
    run_md=True,
    restrain_backbone=True,
    restraint_k=1000.0,
    production_steps=25000,
    notes="Running short restrained MD (25 000 steps ≈ 100 ps) to relax side chains "
          "around the 12 newly added heavy atoms and the two gap termini in chain A. "
          "Backbone restrained at 1000 kJ/mol/nm² to preserve experimental fold."
)
output_pdb: complex_AB_relaxed.pdb
preset_used: amber14_implicit
n_atoms: 9847
energy_initial_kJ_mol: -71203.1
energy_post_min_kJ_mol: -89441.6
energy_post_md_kJ_mol:  -94308.2
energy_final_kJ_mol:    -95112.4

Claude's summary: Energy decreased steadily through minimisation → MD → final minimisation. The structure is converged and ready. Output: complex_AB_relaxed.pdb.


Project Structure

biomolecule-modeling-mcp/
├── main.py                  # MCP server entry point; all @mcp.tool() definitions
├── pyproject.toml           # dependencies + CLI entry point (biomodeling)
├── utils/
│   ├── pdb_query.py         # Structure inspection (BioPython)
│   ├── pdb_fix.py           # PDBFixer wrapper
│   ├── pdb_splitter.py      # Split multi-component PDB by chain type
│   ├── pdb_assemble.py      # Merge PDB files
│   └── openmm_relax.py      # OpenMM energy minimisation + restrained MD
└── data/                    # Example / test PDB files

Key Gotchas

  • Never fix large loops by default. fix_missing_residues=False is the safe default; loops > 5–10 residues produce poor geometry with PDBFixer.

  • Ligands break standard relaxation. Non-standard HETATM residues must be removed (or separately parameterised) before running OpenMM with AMBER/CHARMM presets.

  • OpenMM >= 8.x implicit solvent. The implicit solvent XML (e.g. implicit/gbn2.xml) goes into ForceField(), not createSystem().


License

MIT

Available Tools

9 tools
assemble_pdb_structuresA

Merge multiple PDB files into a single PDB file.

WHEN TO USE

Use after split_pdb + fix_pdb_structure when you have separately processed components (e.g. fixed protein + original ligand) that need to be recombined before relaxation. Also useful for building hetero-complexes from individual chain files.

WORKFLOW POSITION

Optional step between fix_pdb_structure and relax_pdb_structure.

DECISION GUIDANCE

chain_id_map: Always provide this if you have performed split → fix → assemble, because fix_pdb_structure may have altered chain IDs. Map by the basename of the input file (e.g. {"protein_A_fixed.pdb": "A"}).

handle_conflicts (default "rename"): Use "rename" (default) for most cases — it is safe and non-destructive. Use "merge" only when two files represent the same biological chain split across files (e.g. modelled N-terminal extension + crystal structure). Never use "error" in automated workflows.

renumber_residues (default False): Only set True if downstream tools require sequential numbering from 1. Renumbering loses the original residue IDs, which makes cross-referencing with the source PDB harder.

renumber_atoms (default False): Set True if the output PDB will be read by tools that expect strictly sequential atom serials.

OUTPUT — WHAT TO CHECK

Run query_pdb_structure on the assembled output to verify chain IDs, residue counts, and that no unexpected gaps were introduced by the merge.

Inputs: input_pdbs (required), output_pdb (required), notes, chain_id_map, +3 more. Returns: result

fix_pdb_structureA

Prepare a PDB file for OpenMM by correcting common structural problems.

WHEN TO USE

Run this after query_pdb_structure (and optionally split_pdb) and before relax_pdb_structure. It is required before relaxation because OpenMM needs: (a) standard residue names, (b) all heavy atoms present, (c) hydrogen atoms added.

WORKFLOW POSITION

Step 3 (or step 2 if no splitting is needed). Input is typically the raw PDB or the protein-only file produced by split_pdb.

DECISION GUIDANCE

chains_to_keep / chains_to_remove: Decide based on query_pdb_structure output. For a standard relaxation workflow keep only the biological unit (usually protein chains). Remove chains that are crystallographic symmetry mates or that lack force-field parameters.

ph (default 7.0): Controls protonation states of HIS, ASP, GLU, LYS, CYS. Use 7.4 for physiological simulation. Use the experimental pH if known from the paper. Histidine protonation is particularly sensitive — consider whether HID/HIE/HIP matters for your system.

remove_heterogens (default True): Set False only if ligands have been separately parameterised and the assembled structure is ready for a non-standard force field. For standard AMBER/CHARMM relaxation, ligands without parameters will cause createSystem() to fail.

keep_water (default False): Set True only when crystallographic waters are meaningful (e.g. active-site waters). Waters slow minimisation and are usually re-added during explicit-solvent solvation later.

fix_missing_residues (default False): Only enable for gaps ≤ ~5 residues or when the user explicitly requests loop modelling. Modelled loops have roughly-placed atoms and require extensive MD to be meaningful. Large gaps (> 10 residues) will produce severe clashes and should be left open.

fix_terminal_residues (default False): Disordered termini are almost never worth modelling; leave False unless specifically requested.

OUTPUT — WHAT TO CHECK

nonstandard_residues: List what was converted. Flag any unexpected conversions to the user (e.g. a bound cofactor being converted to a standard amino acid). missing_atoms_added: Review side-chains added. A large number (> 20) suggests significant disorder in the crystal structure. heterogens_removed: If this is 0 when ligands were present, something was misclassified — re-check with query_pdb_structure.

Inputs: input_pdb (required), ph, notes, keep_water, +9 more. Returns: object

get_workflow_reportA

Return a summary of all tool calls and LLM decisions made in this session.

WHEN TO USE

The report is written to a Markdown file automatically after every tool call — you do not need to call this to produce the file. Call it when you want to:

  • Tell the user where their report file is located.

  • Optionally copy the report to a different path via save_to.

  • Read the markdown string directly (e.g. to summarise it for the user).

Inputs: save_to. Returns: object

query_ff_presetsA

List available force-field presets for relax_pdb_structure.

WHEN TO USE

Call before relax_pdb_structure when you are unsure which preset to use or want to present the user with options.

Returns: dict mapping preset name → description string.

Inputs: no named parameters. Returns: object

query_pdb_structureA

Inspect a PDB file and return a detailed chain-level summary.

WHEN TO USE

Always call this FIRST before any fixing or relaxation. The output tells you what is actually in the file so you can make informed decisions about every subsequent step.

WORKFLOW POSITION

Step 1 of every session. Re-run after split_pdb if you need per-component details.

OUTPUT — WHAT TO CHECK

chains[*].type Confirm which chains are protein, DNA/RNA, ligand, or water. Ligand chains (type="ligand") cannot be directly relaxed with the built-in presets; they must be removed with fix_pdb_structure unless they have standard force-field parameters.

chains[*].numbering_gaps Each gap lists the flanking residues and the estimated number of missing residues. Gaps ≤ 5 residues are commonly modellable with fix_missing_residues=True. Larger gaps produce poor geometry and should be left open unless the user specifically requests loop modelling.

chains[*].structural_breaks A structural break that COINCIDES with a numbering gap is strong evidence for genuinely missing coordinates. A structural break WITHOUT a numbering gap may indicate a clashing insertion or bad crystal contact — flag this to the user.

chains[*].sequence Verify the sequence is complete and plausible. Unknown residues appear as [XXX].

Inputs: input_pdb (required), notes. Returns: object

relax_pdb_structureA

Energy-minimise and optionally run short restrained MD on a prepared PDB.

WHEN TO USE

Use as the FINAL step after fix_pdb_structure (and optionally assemble_pdb_structures). The input MUST have hydrogens and standard residue names — run fix_pdb_structure first.

Do NOT pass a raw PDB straight to this tool. OpenMM will fail if residues are missing heavy atoms or contain non-standard residue names.

WORKFLOW POSITION

Last step of the cleaning/preparation pipeline. Output is a relaxed PDB ready for production MD setup or coarse-graining.

DECISION GUIDANCE

preset (default "amber14_implicit"): amber14_implicit — use for typical protein relaxation; fast, no periodic box required. Best choice for most users. amber14_explicit — use when the input already has a periodic solvent box (added externally). More accurate but slower. amber99sb_implicit — an older force field; prefer amber14_implicit unless the user specifically requests AMBER99SB. charmm36_explicit — use when downstream simulation will use CHARMM36 and explicit solvent. Call query_ff_presets() to see the full list with descriptions.

run_md (default True): Set False for a minimisation-only run, which is much faster. Use minimisation-only when: (a) the structure is already well-relaxed, (b) a quick clash-removal pass is all that is needed, or (c) compute time is limited.

restrain_backbone (default True): Keep True unless the user wants full unrestrained relaxation. Backbone restraints preserve the experimental fold; without them a very short MD run can distort secondary structure.

restraint_k (default 1000 kJ/mol/nm²): Reduce to 100–200 for softer restraints that allow more backbone movement. Increase to 5000 for near-rigid backbone relaxation of side-chains only.

production_steps (default 25 000 ≈ 100 ps at 4 fs): Sufficient for side-chain relaxation and removal of clashes introduced by adding missing atoms. Increase to 250 000 (1 ns) for more thorough equilibration — note this takes substantially longer on CPU.

temperature (default 300 K): Use 300 K for room-temperature simulation. Some crystallographers prefer 277 K to match cryo conditions.

OUTPUT — WHAT TO CHECK

energy_initial_kJ_mol vs energy_final_kJ_mol: A drop of 10³–10⁶ kJ/mol after minimisation is normal for a raw crystal structure. If the final energy is still very large (> −10 000 kJ/mol for a 500-residue protein), the structure may have unresolved clashes — report to the user and suggest checking with query_pdb_structure. energy_post_md_kJ_mol: Should be more negative than energy_post_min_kJ_mol. If it is more positive, MD is diverging — reduce production_steps or timestep.

Inputs: input_pdb (required), notes, preset, run_md, +16 more. Returns: object

reset_workflow_reportA

Clear the session workflow report and start a fresh record.

WHEN TO USE

Call at the start of a new structure-preparation task when you want a clean report that covers only the current structure, not any previous work done in the same server session. Each reset starts a new timestamped report file.

Inputs: report_file. Returns: result

set_working_directoryA

Set the working directory for all subsequent file I/O.

WHEN TO USE

Call this first when the user's PDB files are in a specific directory and you want to avoid writing absolute paths in every subsequent call. After this call, relative paths in all other tools resolve against path.

Inputs: path (required). Returns: result

split_pdbA

Split a multi-component PDB into separate files by molecular type.

WHEN TO USE

Use when query_pdb_structure reveals a mix of protein, nucleic acid, and/or ligand chains that need to be processed differently. Common reasons:

  • You want to fix the protein chain but retain the ligand as-is.

  • The structure contains DNA/RNA that requires different force-field treatment from the protein.

  • You want to inspect or modify a single chain in isolation.

WORKFLOW POSITION

Optional step between query_pdb_structure (step 1) and fix_pdb_structure. After splitting, run fix_pdb_structure on the protein file, then use assemble_pdb_structures to recombine before relaxation.

OUTPUT — WHAT TO CHECK

Verify that the ligand list matches what you saw in query_pdb_structure. If a ligand is missing, it may have been classified as an ion (and silently dropped) or the HETATM record name was not in the ligand detection list.

DECISION GUIDANCE

output_prefix: Use a descriptive prefix so file names are clear, e.g. "my_protein" yields "my_protein_protein_A.pdb".

Inputs: input_pdb (required), notes, output_prefix. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.6/5.0

    Scored across 9 tools

    Disambiguation5/5

    Each tool has a clearly distinct role: working directory setup, structural analysis, force-field lookup, splitting, fixing, assembling, relaxing, and workflow reporting. There is no overlap or ambiguity about which tool to call for a given purpose.

    Naming Consistency5/5

    All tool names follow the consistent verb_noun pattern with lowercase and underscores (e.g., set_working_directory, query_pdb_structure, relax_pdb_structure). Minor plural variations like 'structures' vs 'structure' do not disrupt the pattern.

    Tool Count5/5

    The server has 9 tools, which is well within the ideal 3-15 range. Each tool covers a necessary step in the biomolecule preparation workflow, and none feel redundant or extraneous.

    Completeness5/5

    The workflow is fully covered: setup, inspection, force-field info, splitting, fixing, assembling, relaxing, and reporting. There are no obvious gaps for the stated purpose of preparing and relaxing PDB structures.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Integrates GROMACS molecular dynamics simulations with VMD visualization, enabling setup, execution, analysis, and 3D visualization of molecular dynamics workflows through natural language.
      24
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to execute computational chemistry and drug discovery workflows using Schrödinger Suites 2026, including protein preparation, docking, ADMET, QM/MM calculations, and job management.
      28
      4
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables running GROMACS molecular dynamics simulations through natural language, with tools for topology building, solvation, simulation management, and trajectory processing via the Model Context Protocol.
      31
      4
      MIT