MCP-GMX-VMD
Integrates GROMACS molecular dynamics simulations with VMD visualization, enabling setup, execution, analysis, and 3D visualization of molecular dynamics workflows through natural language.
README
MCP-GMX-VMD
MCP-GMX-VMD is a service that integrates GROMACS molecular dynamics simulations with VMD (Visual Molecular Dynamics) visualization through a microservice architecture. This tool facilitates molecular dynamics simulation setup, execution, analysis, and visualization.
Features
- Molecular Dynamics Simulations: Setup and run GROMACS simulations with an easy-to-use interface
- Trajectory Analysis: Analyze simulation trajectories (RMSD, RMSF, etc.)
- 3D Visualization: Visualize molecular structures and simulation trajectories using VMD
- Custom Workflow Directories: Create and manage simulation workflows in user-specified directories
- Modular Architecture: Built on MCP (Model Context Protocol ) for flexible integration with other tools
Prerequisites
- Python 3.9+
- GROMACS (installed and accessible in PATH)
- VMD (Visual Molecular Dynamics, installed and accessible in PATH)
- (Optional) Python VMD module for enhanced visualization capabilities
Installation
-
Clone the repository:
git clone https://github.com/yourusername/mcp-gmx-vmd.git cd mcp-gmx-vmd -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install dependencies:
pip install -r requirements.txt -
Install the package (development mode):
pip install -e .
Configuration
The service uses a configuration file (config.json) for VMD path, search paths, and other settings. If this file doesn't exist, create one with the following structure:
{
"vmd": {
"path": "/path/to/vmd/executable",
"search_paths": ["/path/to/search"]
},
"gmx": {
"path": "/path/to/gromacs/executable"
}
}
For macOS users, the VMD path is typically:
/Applications/VMD.app/Contents/MacOS/startup.command
Starting the Server
To start the MCP-GMX-VMD server:
python mcp_server.py
The service will start and listen for requests.
Usage Examples
Creating a simulation workflow:
import requests
# Create a new workflow
response = requests.get(
"http://localhost:8000/gmx-vmd://workflow/create?name=my_simulation"
)
workflow_id = response.json()["workflow_id"]
# Prepare a simulation with custom directory
custom_dir = "/path/to/custom/directory"
response = requests.get(
f"http://localhost:8000/gmx-vmd://simulation/prepare?workflow_id={workflow_id}&pdb_file=protein.pdb&workspace_dir={custom_dir}"
)
Analyzing trajectories:
# Analyze RMSD
analysis_params = {
"analysis_type": "rmsd",
"trajectory_file": "md/md.xtc",
"structure_file": "md/md.gro",
"selection": "protein",
"output_prefix": "rmsd_analysis"
}
response = requests.get(
f"http://localhost:8000/gmx-vmd://analysis/trajectory?workflow_id={workflow_id}¶ms={json.dumps(analysis_params)}"
)
Visualizing structures:
# Load and visualize trajectory
response = requests.get(
f"http://localhost:8000/gmx-vmd://visualization/load-trajectory?workflow_id={workflow_id}&trajectory_file=md/md.xtc&structure_file=md/md.gro"
)
LLM Integration
This service can be integrated with LLM assistants like Claude or used with Cursor IDE for a more interactive experience. The integration allows you to perform molecular simulations and analysis directly through natural language commands.
Connect to the MCP Server
- Copy the below JSON and replace the path placeholders with your actual system paths:
{
"mcpServers": {
"gmx_vmd": {
"command": "{{PATH_TO_UV}}",
"args": [
"--directory",
"{PATH_TO_SRC}/mcp-gmx-vmd",
"run",
"mcp",
"run",
"mcp_server.py"
],
"env": {
"PYTHONPATH": "{PATH_TO_SRC}/mcp-gmx-vmd",
"MCP_DEBUG": "1",
"PYTHONUNBUFFERED": "1"
}
}
}
}
-
Save the configuration file to the appropriate location:
- For Claude Desktop: Save as
claude_desktop_config.jsonin:~/Library/Application Support/Claude/claude_desktop_config.json - For Cursor IDE: Save as
mcp.jsonin:~/.cursor/mcp.json
- For Claude Desktop: Save as
-
Restart your application (Claude Desktop or Cursor)
- For Claude Desktop, you should now see GMX-VMD as an available integration
- For Cursor, the integration will be available after restart
Using MCP-GMX-VMD with LLMs
Once configured, you can interact with the MCP-GMX-VMD service through natural language:
- "Set up a protein simulation in water environment"
- "Analyze the RMSD of my protein trajectory"
- "Visualize this protein structure showing secondary structure"
- "Calculate hydrogen bonds in my MD trajectory"
The LLM will translate your requests into appropriate API calls to the MCP-GMX-VMD service.
Advanced Configuration
Custom Workflow Directories
To create workflows in custom directories, specify the workspace_dir parameter when creating a workflow:
response = requests.get(
f"http://localhost:8000/gmx-vmd://workflow/create?name=custom_workflow&workspace_dir=/path/to/custom/directory"
)
VMD Visualization Templates
The service provides several built-in visualization templates for common tasks. You can apply these templates using:
response = requests.get(
f"http://localhost:8000/gmx-vmd://visualization/apply-template?workflow_id={workflow_id}&template_name=protein_cartoon"
)
Troubleshooting
VMD Display Issues
If VMD GUI closes immediately after launch, try using one of these approaches:
- Launch VMD in a separate terminal window (service default behavior)
- Use
vmd -dispdev textfor command-line operation without GUI - Check VMD installation and permissions
Permission Issues
If you encounter permission issues with custom directories:
# Set appropriate permissions for the directory
chmod -R 755 /path/to/your/custom/directory
License
YouTube Overview
Acknowledgments
- VMD is developed by the Theoretical and Computational Biophysics Group at the University of Illinois at Urbana-Champaign
- GROMACS is a versatile package for molecular dynamics simulation
- MCP (Model Context Protocol ) provides the underlying communication framework
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
