Skip to main content
Glama
truong128

pymol-cursor-mcp

by truong128

pymol-cursor-mcp

Model Context Protocol (MCP) を介して、Cursor から PyMOL を制御します。構造やスタイルを平易な言葉で記述すると、アシスタントがXML‑RPC (run_command, run_python, pymol_get) を通じてPyMOLを呼び出します。

このプロジェクトは、Cursorファーストなワークフローをパッケージ化し、ドキュメント化したものです。同じMCPサーバーは、CLIを好む場合は 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. プロンプト: 例: “1hvrを取得して、タンパク質をカートゥーン表示、リガンドをスティック表示にして。”


アップストリーム(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 が見つからない: conda-forge から専用の環境にPyMOLをインストールしてください (INSTALL.mdを参照)。

  • リモート/HPC: エディタが実行されている場所でMCPを実行してください。RPCをトンネル接続 (PYMOL_RPC_URL, SSH -R) する必要があります — 詳細はINSTALL.mdを参照。


クレジット

  • PyMOL MCPのアイデアとオリジナルのサーバー: pymol-claude-code — Hemant Nagar氏。

  • パッケージングとCursor向けドキュメント: truong128。

ライセンス

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