vmd-hydrate-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@vmd-hydrate-mcp Load trajectory from /data/sim.gro and render hydrate cages in blue"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
An MCP server that lets Claude (or any MCP client) controlVMD directly — load GROMACS/LAMMPS trajectories, identify clathrate-hydrate cages (sI/sII/sH), script headless renders, and compute order parameters (F3/F4) and H-bond networks — turning molecular-dynamics analysis into a conversation. Unlike the existing VMD MCP, it keeps a stateful VMD session, is secure by default, and owns the one thing no other MCP does: hydrate cage science.
See it in action
Related MCP server: vmd-mcp
Features
Clathrate Cage Identification -- find and classify hydrate cages (5¹², 5¹²6², 5¹²6⁴, …) from the H-bond network and label the crystal structure (sI/sII/sH). Validated on the sII benchmark (128 small cages, exact).
Photorealistic, Style-by-Prompt Cage Rendering -- cages render with ambient occlusion + shadows, orthographic by default, each cage type in ONE unified color (a curated palette: 5¹²=cyan, 5¹²6⁴=red, …). Just ask: "show only the sII large cages in magenta with emphasized width" and the MCP filters, recolors, and thickens them.
Stateful VMD Session -- a persistent VMD process (Tcl socket server) keeps your molecules, selections, and camera alive across tool calls -- no reloading on every command.
Hydrate Order Parameters -- F3 (tetrahedrality) and F4 (⟨cos 3φ⟩) computed in pure NumPy, validated to the reference to 6 decimals (F4 = 0.926698 on the sII benchmark).
H-bond Networks -- water–water hydrogen-bond graph with coordination stats, the substrate for cage identification.
Headless Rendering -- CPU Tachyon ray-traced PNGs with no display or GPU, returned inline as images. Works on laptops, servers, and HPC.
Attended (GUI) Mode -- run fully offscreen (default), or set
VMD_HYDRATE_MCP_DISPLAY=guito open a visible VMD window and watch Claude load, color, rotate, and render your system live.GROMACS + LAMMPS -- one server ingests
.gro/.xtc/.trr, LAMMPS.data/dump, PDB, DCD, mmCIF.Secure by Default -- filesystem allowlist + a Tcl command allowlist (not a bypassable denylist) + a loopback, token-gated control socket. No
run_tclfoot-gun exposed.MCP-Native -- clean English tool names and typed outputs; works in Claude Desktop, Claude Code, and any MCP client.
Quick Start
Requires a local VMD install (2.0b1 or 1.9.4+) — this server drives your VMD; no registry or package ships it. On macOS, VMD lives inside a .app, so set VMD_BIN if vmd isn't on your PATH. (The pure hydrate/measure tools still work without VMD.)
Install
Zero-install via uvx (recommended):
uvx vmd-hydrate-mcp # run the server
uvx --from 'vmd-hydrate-mcp[mda]' vmd-hydrate-mcp # + MDAnalysis for measures/selectionOr from source:
git clone https://github.com/wjgoarxiv/vmd-hydrate-mcp.git
cd vmd-hydrate-mcp && uv pip install -e ".[mda]"Register with an MCP client
Claude Code — one command:
claude mcp add vmd-hydrate -- uvx vmd-hydrate-mcpClaude Desktop / any client — add to the mcpServers config (or commit a project .mcp.json):
{
"mcpServers": {
"vmd-hydrate": {
"command": "uvx",
"args": ["vmd-hydrate-mcp"],
"env": { "VMD_HYDRATE_MCP_ALLOW_DIR": "/path/to/your/data" }
}
}
}SetVMD_HYDRATE_MCP_ALLOW_DIR (os-path-separated) to the directories the server may read. All file arguments are realpath-checked against this allowlist — paths outside it are refused.
Attended (GUI) mode
By default the server drives VMD headless (offscreen). To instead open a real VMD window you can watch while Claude controls it live, add VMD_HYDRATE_MCP_DISPLAY=gui to the server's env:
{ "mcpServers": { "vmd-hydrate": {
"command": "uvx", "args": ["vmd-hydrate-mcp"],
"env": { "VMD_HYDRATE_MCP_DISPLAY": "gui", "VMD_HYDRATE_MCP_ALLOW_DIR": "/path/to/data" }
}}}Then ask things like "load prod.gro, show water as points and the surfactant as VDW, then slowly rotate it" — the window updates in real time via load_structure → add_representation → rotate_view. (Requires a local desktop session; the same Tcl socket drives both modes.)
MCP Tools
Tool | Purpose | Backend |
| VMD version + molecules loaded in the live session | VMD |
| Load a structure/trajectory (returns a | VMD |
| List loaded molecules | VMD |
| Style/color/material/selection for a molecule (replaces reps) | VMD |
| Layer another representation (multi-rep views) | VMD |
| Remove all representations | VMD |
| Live camera control (visible in GUI mode) | VMD |
| Headless PNG of the current view | VMD + Tachyon |
| Atom count for a selection (catches the 0-atom | MDAnalysis |
| Distance / angle / dihedral by atom index | MDAnalysis |
| Rg of a selection | MDAnalysis |
| F3 + F4 water order parameters | NumPy |
| Water H-bond network + coordination | NumPy |
| Cage counts (5¹²/5¹²6⁴/…) + sI/sII/sH structure | NumPy |
| Photorealistic cage render (AO+shadows, ortho); filter / recolor / emphasize cages by prompt | VMD + NumPy |
Usage
1. Analyze hydrate order in a trajectory frame
Compute the F3/F4 order parameters for hydrate.groReturns f4_overall, f3_overall, water count, and a plain-language interpretation (crystalline / hydrate-like / liquid / ice).
2. Render a structure
Load hydrate.gro, show the water oxygens as VDW spheres, and render itProduces an inline PNG rendered headlessly with CPU Tachyon.
3. Inspect the H-bond network
Build the water hydrogen-bond network for hydrate.gro at frame 0Returns bond count and average coordination (≈4 for a well-formed clathrate).
4. Style hydrate cages by prompt
Load hydrate.gro and show only the sII large cages in magenta with emphasized widthRenders a photorealistic, orthographic image of just the 5¹²6⁴ cages in magenta with thicker edges — the MCP maps this to render_cages(cage_types=["51264"], highlight_color="magenta", emphasis=True). Omit the filters and every cage type is drawn in its palette color (5¹²=cyan, 5¹²6⁴=red, …).
Does it really drive VMD?
Yes — and you can confirm it in one command. examples/verify.py runs the same code the MCP server exposes on a bundled sII CO₂-hydrate example: it pings the real VMD binary, identifies the cages, and renders them headlessly.
python examples/verify.pyExpected output:
[1] VMD found : /Applications/VMD2b1.app/.../vmd_MACOSXARM64
ping : pong 2.0b1 MACOSXARM64
[2] Identifying cages in a real sII CO2 hydrate (1088 waters)...
cage counts : {'51264': 60, '512': 128}
structure : sII (confidence 0.93)
F4 order : 0.965 (highly ordered (crystalline hydrate / ice-like))
[3] Rendering cages headlessly (blue = 5^12, red = 5^12 6^4)...
saved : examples/output/cages.png (362495 bytes)
OK — vmd-hydrate-mcp drove VMD and identified the cages above.The images below are real, unretouched VMD renders from that pipeline (not illustrations):
The demo video at the top is assembled from frames like these — see video/build_frames.py (drives VMD) and video/remotion/ (Remotion compositing). Rebuild it with python video/build_frames.py && cd video/remotion && npm i && npm run gif.
How It Works
[.gro / .xtc / LAMMPS dump]
|
v
MCP client (Claude) --stdio--> vmd-hydrate-mcp (FastMCP)
| |
numbers <------+ +------> visualization
MDAnalysis + NumPy persistent VMD session
(F3/F4, H-bonds, Rg) (Tcl socket, 127.0.0.1)
| |
v v
structured JSON Tachyon --> PNG imageNumeric science runs in Python (no display, unit-testable in CI). Visualization and rendering run in a long-lived, token-gated VMD process. The two never mix units: hydrate math is nanometers, VMD/MDAnalysis measures are Ångström.
Requirements
Dependency | Required | Purpose |
VMD 2.0b1 or 1.9.4+ | for viz/render | the visualization engine |
Python 3.10+ | yes | the server |
| yes | Model Context Protocol SDK |
MDAnalysis ( | for measures/selection | topology-aware loading |
| for render | TGA→PNG conversion |
On macOS, VMD ships as a.app and its CLI binary lives inside the bundle. If vmd is not on your PATH, set VMD_BIN to the binary (e.g. /Applications/VMD*.app/Contents/vmd*/vmd_MACOSXARM64). Pure hydrate/measure tools work without VMD.
Contributing
Fork and branch (
git checkout -b feature/x).uv pip install -e ".[dev,mda]"and keeppytestgreen (science tests need no VMD).Commit, push, open a PR. Found a bug? Open an issue.
License
MIT — see LICENSE.
Available Tools
17 toolsadd_representationA
Add a representation WITHOUT clearing existing ones — layer several reps
(e.g. water as Points + solute as VDW). color is a coloring METHOD
(Name, ResName, ResType, Chain, Beta, ...); style is VDW/Lines/Points/
NewCartoon/Licorice/etc.
Inputs: molid (required), color, style, material, +1 more.
clear_representationsA
Remove all representations from a molecule (start a fresh view).
Inputs: molid (required).
hbond_networkA
Build the water-water hydrogen-bond network for a frame and report bond count and average coordination (the substrate for cage identification). rcut is the O-O cutoff (nm), theta the H-O...O angle cutoff (degrees).
Inputs: path (required), rcut, frame, theta, +1 more.
hydrate_order_paramsA
Compute clathrate-hydrate water order parameters F3 (tetrahedrality) and F4 (<cos 3phi>) for a frame. F4 ~ 0.7-0.95 indicates hydrate/crystalline order, ~0 liquid, negative ice-Ih. Units are nm; for .gro the native nm parser is used. This is the differentiating capability no other MCP offers.
Inputs: path (required), frame, cutoff, topology.
identify_cagesA
Identify clathrate-hydrate cages (5^12, 5^12 6^2, 5^12 6^4, ...) from the water H-bond network and classify the crystal structure (sI/sII/sH). Returns per-type cage counts, the structure label, and a confidence. method="TRACE" (all rings) or "HTR" (primitive rings). GROMACS .gro input.
Inputs: path (required), rcut, frame, theta, +1 more.
list_moleculesA
List molecules currently loaded in the VMD session (molid, path, atoms, frames).
Inputs: no named parameters.
load_structureA
Load a structure/trajectory into the persistent VMD session for
visualization. Supports PDB, GROMACS (.gro/.xtc/.trr), LAMMPS (.data/dump),
DCD. Coordinate-only formats (.xtc/.trr/.dcd) require a topology. Returns
the molid used to reference this molecule in later calls.
Inputs: path (required), filetype, topology.
measure_geometryB
Measure a distance (2 atom indices), angle (3), or dihedral (4) at a frame. Distances are in Angstrom, angles in degrees.
Inputs: path (required), indices (required), frame, topology.
radius_of_gyrationC
Radius of gyration (Angstrom) of an atom selection at a frame.
Inputs: path (required), frame, topology, selection.
renderB
Render the current view of a loaded molecule headlessly (CPU Tachyon) and return a PNG image. Resolution is capped for safety.
Inputs: molid (required), width, height.
render_cagesA
Render clathrate cages photorealistically (ambient occlusion + shadows, orthographic by default). Each cage type is drawn in ONE unified color for both its water-oxygen vertices and its O-O framework, using a curated palette (512=cyan, 51262=violet, 51264=red, 435663=lime, 51268=blue).
Natural-language styling maps directly to the arguments:
"show only the sII large cages" -> cage_types=["51264"]
"... in magenta" -> highlight_color="magenta" (name or #rrggbb)
"emphasize / thicker width" -> emphasis=True (thicker edges + bigger spheres)
per-type colors -> colors={"512": "cyan", "51264": "magenta"} cage_types are internal codes: 512, 51262, 51263, 51264, 51268, 435663, ... (sI = 512+51262, sII = 512+51264, sH = 512+435663+51268). Returns a PNG.
Inputs: path (required), frame, width, colors, +8 more.
reset_viewC
Reset/fit the camera to the loaded molecule.
Inputs: molid.
resolve_selectionB
Report how many atoms an MDAnalysis selection matches — use this to catch the common 0-atom trap on bare .gro files before running measurements.
Inputs: path (required), selection (required), topology.
rotate_viewA
Rotate the camera by degrees about an axis ('x'/'y'/'z'). In GUI/attended
mode (VMD_HYDRATE_MCP_DISPLAY=gui) the visible window updates live.
Inputs: axis, degrees.
set_representationC
Set the visual representation of a loaded molecule (e.g. style=NewCartoon, Licorice, VDW, Lines; color=Name, ResType, Beta; selection is a VMD atom-selection string like "water" or "name CA").
Inputs: molid (required), color, style, material, +1 more.
vmd_statusA
Report whether VMD is available, its version, and the molecules currently loaded in the persistent session.
Inputs: no named parameters.
zoom_viewA
Zoom the view by a multiplicative factor (>1 zoom in, <1 zoom out).
Inputs: factor.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Each tool targets a specific operation—loading, selection, measurement, rendering, or hydrate-specific analysis—with no functional overlap. Even similar tools like set_representation and add_representation are clearly differentiated by whether they clear existing representations.
Most tool names follow a verb_noun pattern (load_structure, list_molecules, set_representation, etc.), but a few nouns (radius_of_gyration, vmd_status, hbond_network) break the pattern. This is a minor inconsistency that does not impede understanding.
With 17 tools covering loading, visualization, analysis, and rendering specifically for clathrate hydrates, the count feels well-scoped. Each tool earns its place, and the set is neither bloated nor sparse.
The surface covers core lifecycle: load, list, select, measure, analyze (hydrate-specific), and render. Minor gaps like trajectory manipulation or file export are absent, but the focus on hydrate analysis is fully covered, so agents can accomplish their goals without dead ends.
Maintenance
Related MCP Connectors
MD workbench for agents: 13 analysis tools, renders, hosted GPU runs; LAMMPS + OpenMM.
Agent-to-Agent (A2A) + Model Context Protocol (MCP) hub for peptides.
Stateless agentic tools over MCP: concept extraction, long-context, knowledge graph, planning.
AI orchestration for computational chemistry and HPC workflows.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA Model Context Protocol server that enables AI assistants to interact with LAMMPS for molecular dynamics simulations through natural language commands.13Apache 2.0
- FlicenseNot gradedqualityDmaintenanceEnables control of VMD2 for molecular dynamics analysis through natural language, allowing users to load structures, set representations, measure distances, compute RMSD, and render images without Tcl scripting.7-
- AlicenseNot gradedqualityCmaintenanceIntegrates GROMACS molecular dynamics simulations with VMD visualization, enabling setup, execution, analysis, and 3D visualization of molecular dynamics workflows through natural language.24MIT
- AlicenseBqualityCmaintenanceEnables running GROMACS molecular dynamics simulations through natural language, with tools for topology building, solvation, simulation management, and trajectory processing via the Model Context Protocol.314MIT