Skip to main content
Glama
truong128

pymol-cursor-mcp

by truong128

pymol-cursor-mcp

通过 模型上下文协议 (MCP) 从 Cursor 控制 PyMOL。用通俗语言描述结构和样式;助手通过 XML‑RPC (run_command, run_python, pymol_get) 调用 PyMOL。

本项目封装并记录了一个 以 Cursor 为中心 的工作流。如果你更喜欢 CLI,同一个 MCP 服务器也适用于 Claude Code。

上游灵感: nagarh/pymol-claude-code (用于 Claude Code 的 PyMOL + MCP)。本仓库通过便携式 Cursor 配置、检查、脚本和安装文档扩展了该理念。


架构 (动画)

与 上游 flow.svg 相同的图表样式,针对 Cursor (青色节点) 进行了更新。使用 SVG/CSS 动画 (animateMotion, keyframes)。如果你的 Markdown 预览看起来是静态的,请直接在 GitHub 上打开 flow.svg 查看完整动画。

Related MCP server: vmd-mcp

你将获得

组件

用途

pymol_mcp_server.py

MCP 服务器 (stdio) → PyMOL XML‑RPC

.cursor/mcp.json

使用 ${workspaceFolder} 注册 pymol MCP 服务器

.cursor/rules/*.mdc

针对 PyMOL 工具使用的智能体提示词

scripts/start_pymol_for_mcp.sh

启动带有 -R 参数的 PyMOL (macOS/Linux)

verify_stack.py

健康检查:venv + MCP 导入 + 到 PyMOL 的 RPC

examples/restore_pocket_labels.pml

PyMOL 脚本示例 (标签 / 口袋)

flow.svg

动画架构图 (与上游仓库样式相同)


快速安装

git clone https://github.com/truong128/pymol-cursor-mcp.git
cd pymol-cursor-mcp

python3 -m venv venv
source venv/bin/activate          # Windows: venv\Scripts\activate
pip install -U pip
pip install -r requirements.txt
deactivate

安装 PyMOL (推荐使用 conda‑forge),然后启动 RPC:

conda activate pymol_mcp          # your env with pymol-open-source
pymol -R

或者:./scripts/start_pymol_for_mcp.sh (执行 chmod +x 后)。

在 Cursor 中:打开文件夹 → 本仓库 → 设置 → MCP → 确认 pymol 已连接 → 如有必要,重启 Cursor。

python3 verify_stack.py

应该打印:OK: MCP import + PyMOL RPC at http://localhost:9123

完整分步指南: INSTALL.md


日常使用

  1. 终端: pymol -R 或 VS Code/Cursor 任务: “PyMOL: start with XML-RPC”。

  2. Cursor: 在打开此文件夹的情况下使用聊天 / 智能体。

  3. 提示词: 例如 “Fetch 1hvr, cartoon on protein, sticks on ligand.”


与“仅限 Claude Code”上游相比的变更摘要

主题

本项目

IDE

以 Cursor 为主;包含 .cursor/mcp.json、规则、任务

RPC URL

PYMOL_RPC_URL 环境变量 (默认 http://localhost:9123)

路径

${workspaceFolder} — 可克隆到任何位置

Windows

.cursor/mcp.json.windows.example

验证

verify_stack.py

PyMOL 启动

scripts/start_pymol_for_mcp.sh + 运行任务


故障排除

  • MCP 已断开: 查看 Cursor 输出 → MCP 日志;重新创建 venv;将仓库根目录重新打开为工作区。

  • PyMOL 错误 / 缺少 .dylib: 将 PyMOL 从 conda-forge 安装到专用环境中 (参见 INSTALL.md)。

  • 远程/HPC: 在编辑器运行的地方运行 MCP;隧道转发 RPC (PYMOL_RPC_URL, SSH -R) — 详情见 INSTALL.md。


致谢

许可证

MIT — 参见 LICENSE。

Related MCP Connectors

  • Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.

  • Remote data science agents for Snowflake, Databricks & BigQuery in Claude/Cursor via MCP

  • Run, debug, and triage tests from your IDE using natural language, no dashboard switching, no manual data transfers. The TestMu AI (formerly LambdaTest) MCP Server is a single remote server exposing four tool suites: HyperExecute — analyze your project, generate YAML configs and test runner commands, then monitor jobs and sessions. Automation — pull a TestID's details plus command, network, and console logs into one chat for instant root-cause analysis. Includes mobile app upload. SmartUI — explain pixel, layout, DOM, and perceptual changes in a visual regression run, with context-aware React/HTML/CSS fixes. Accessibility — audit any public URL or a local React app against WCAG and get ready-to-apply remediation steps. Connects over https://mcp.lambdatest.com/mcp using OAuth 2.1 — no API keys in your config. One-click install in Cursor; works with Claude, GitHub Copilot, Cline, and any MCP client. Tests execute on the TestMu AI cloud: 3,000+ browsers and 10,000+ real devices.

  • Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.

Related MCP Servers