
Vmd Hydrate Mcp
io.github.wjgoarxiv由 GitHub 帳號 wjgoarxiv 發布v0.2.0更新於 Oct 24, 2026
Drive VMD for GROMACS/LAMMPS analysis + clathrate-hydrate cage science (needs a local VMD)
概覽
一個本機 MCP 伺服器,驅動 VMD 工作階段載入分子動力學結構、算繪影像並分析籠形水合物籠。
- 可以做什麼
- 在持續存在的 VMD 工作階段中載入並檢視 GROMACS、LAMMPS、PDB、DCD、mmCIF 等結構與軌跡,列出已載入分子並檢查選取與原子數。設定、疊加與清除呈現方式,並透過旋轉、縮放、重設控制視角。以無介面方式將目前視圖算繪為 PNG 影像。量測距離、角度、二面角與迴轉半徑等幾何量。計算水合物序參數(F3/F4)與水分子氫鍵網路。辨識並分類籠形水合物籠(5¹²、5¹²6⁴ 等),判定 sI/sII/sH 結構,並依要求篩選或改色算繪籠。
- 適用情境
- 適合分子動力學工作:透過對話檢視 GROMACS 或 LAMMPS 軌跡、量測幾何量,並分析籠形水合物的結構與有序度。適合已在本機安裝 VMD、希望不必寫腳本就能取得可重現的無介面算繪或籠分析的研究人員。
- 執行需求
- 以本機 Python 程序執行(Python 3.10+),通常透過 uvx 從 PyPI 套件啟動。視覺化與算繪需要本機安裝 VMD(2.0b1 或 1.9.4+);若 vmd 不在 PATH 中需設定 VMD_BIN。量測與選取工具需要 MDAnalysis。需設定 VMD_HYDRATE_MCP_ALLOW_DIR 指定可讀取的目錄。可選 VMD_HYDRATE_MCP_DISPLAY=gui 開啟可見的 VMD 視窗。TGA 轉 PNG 需要 sips、ImageMagick 或 Pillow。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Vmd Hydrate Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
vmd-hydrate-mcp
Drive VMD from any LLM — render GROMACS/LAMMPS trajectories and analyze clathrate-hydrate cages through the Model Context Protocol.
Quick Start · Features · MCP Tools · Usage · 한국어
[!NOTE] An MCP server that lets Claude (or any MCP client) control VMD 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
[vmd-hydrate-mcp identifying and rendering sII hydrate cages in VMD]
Every frame is a real headless VMD (Tachyon) render, driven entirely through the MCP server. The sII cages — 128 × 5¹² + 60 × 5¹²6⁴ — are identified by this repo, not mocked. · ▶ full-quality MP4
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
[!IMPORTANT] 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 setVMD_BINifvmdisn't on yourPATH. (The pure hydrate/measure tools still work without VMD.)
Install
Zero-install via uvx (recommended):
Or from source:
Register with an MCP client
Claude Code — one command:
Claude Desktop / any client — add to the mcpServers config (or commit a project .mcp.json):
[!IMPORTANT] Set
VMD_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:
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
Usage
1. Analyze hydrate order in a trajectory frame
Returns f4_overall, f3_overall, water count, and a plain-language interpretation (crystalline / hydrate-like / liquid / ice).
2. Render a structure
Produces an inline PNG rendered headlessly with CPU Tachyon.
3. Inspect the H-bond network
Returns bond count and average coordination (≈4 for a well-formed clathrate).
4. Style hydrate cages by prompt
Renders 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.
Expected output:
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
Numeric 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
[!WARNING] On macOS, VMD ships as a
.appand its CLI binary lives inside the bundle. Ifvmdis not on yourPATH, setVMD_BINto 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.
來源:README.md,提交 1a477e7
工具
0版本歷史
1- v0.2.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分