pymol-hyperpowers
An MCP server and PyMOL plugin that let agents in Claude Code, Codex and Antigravity control any open PyMOL session.
Each PyMOL that runs the plugin announces itself under a scientist's name when it starts:
pymol-hyperpowers: this session is "Franklin" (127.0.0.1:50123)
The window title shows the same name. An agent lists the open sessions (newest first) with list_sessions and picks one with use_session; the listing also shows which other agent conversations are using each session. With one session open, tools use it without asking, unless another conversation is already using it, in which case the call asks the agent to call use_session to share it or to ask you. With several open and none chosen, a tool call fails with the list and asks the agent to choose or to ask you.
The package contains no prescriptive science. It gives an agent PyMOL's commands and data, and leaves the science to the agent and to you.
Install
Requires uv and PyMOL 3 (which embeds Python 3.10 or newer).
uv tool install pymol-hyperpowers
pymol-hyperpowers install-plugin
The first command installs the MCP server and the plugin together. install-plugin adds a marked block to ~/.pymolrc.py that loads the plugin from that installation whenever PyMOL starts; restart PyMOL afterwards. Re-running it rewrites the block in place. uninstall-plugin removes the block and leaves the rest of the file alone. Your ~/.pymolrc is not touched; PyMOL reads every ~/.pymolrc* file. Both commands take --pymolrc PATH to edit another file.
To start the plugin in one PyMOL without the rc block, run pymol -r "$(pymol-hyperpowers plugin-path)".
Updating
uv tool upgrade pymol-hyperpowers
This one command updates both halves: PyMOL loads the plugin file inside the installed package, so upgrading the package replaces the plugin too. Then restart PyMOL so it loads the new plugin, and restart your agent sessions so their servers load the new code. list_sessions and pymol-hyperpowers sessions add a note to any session whose plugin version differs from the server's, saying which of the two to restart.
The plugin's path includes the tool's Python version, so reinstalling the tool on another Python moves the file. When the server starts and finds that the block in ~/.pymolrc.py loads a file that no longer exists, it points the block at its own plugin and says so; restart PyMOL once more to load it. A block that loads a file that still exists, such as a development checkout, is left alone.
Register the server with your agent
claude mcp add --scope user pymol -- ~/.local/bin/pymol-hyperpowers
codex mcp add pymol -- ~/.local/bin/pymol-hyperpowers
agy mcp add pymol ~/.local/bin/pymol-hyperpowers
pymol-hyperpowers sessions prints the sessions the server can see, newest first, with the conversations using each and their process IDs, for checking from a terminal.
Agents running without prompts
codex exec and agy -p cannot ask you to approve a tool call, so a pymol tool that needs approval fails instead of running. Approve the pymol tools beforehand. This includes run, which executes arbitrary Python inside PyMOL with your permissions.
- Codex: add
default_tools_approval_mode = "approve"under[mcp_servers.pymol]in~/.codex/config.toml, or pass it for one run withcodex exec -c 'mcp_servers.pymol.default_tools_approval_mode="approve"' .... To approve only some tools, setmcp_servers.pymol.tools.<tool>.approval_mode = "approve"for each. - Antigravity: add
"mcp(pymol/*)"topermissions.allowin~/.gemini/antigravity-cli/settings.json, and remove anypermissions.askrule that matches the pymol tools. An ask rule wins over an allow rule, andagy -pcannot answer it. For one run, passagy --settings '{"permissions":{"allow":["mcp(pymol/*)"],"ask":[]}}' -p ...: each list given there replaces the saved one, so the emptyasklist lifts every saved ask rule for that run, not only the pymol ones.
Coexistence with agentic-pymol
The two plugins use different rc files, ports and state directories, so both can run in one PyMOL. They clash only on the MCP server name pymol: when switching, remove agentic-pymol's registration first (for example claude mcp remove pymol), or register this server under another name, such as pymol-hp, while you try it.
Tools
| Group | Tools |
|---|---|
| Sessions | list_sessions, use_session, status |
| Commands | do (PyMOL command language, one command per line), run (Python inside PyMOL) |
| Query | iterate, alter, get_model, get_fastastr, get_coords, get_chains, get_names, get_object_list, count_atoms, count_states, get_extent, select |
| Geometry | get_distance, get_angle, get_dihedral, get_area |
| Alignment | align, cealign, rms |
| View | get_view, set_view |
| Files | fetch, load, save |
| Images | render (PNG file), screenshot (PNG returned to the agent) |
Display work (show, color, label, settings, scenes, movies) goes through do. run executes arbitrary Python inside PyMOL with your permissions.
PyMOL commands
mcp_status: the session name, port, state file and connected clients.mcp_stop: stop listening and revoke every agent's access to this PyMOL.mcp_start: listen again, under a new name.
The plugin listens on 127.0.0.1 only, and every request must carry the session's token, which is stored in a file only your user can read.
Configuration
| Variable | Side | Default | Effect |
|---|---|---|---|
PYMOL_HP_STATE_DIR |
both | $XDG_STATE_HOME/pymol-hyperpowers or ~/.local/state/pymol-hyperpowers |
parent of sessions/ |
PYMOL_HP_AUTOSTART |
plugin | 1 |
0 loads without listening |
PYMOL_HP_MAIN_THREAD_START_TIMEOUT |
plugin | 120 s |
how long a do or run waits for the main thread to start it |
PYMOL_HP_MAX_OUTPUT_CHARS |
plugin | 8000 |
output kept from do and run |
PYMOL_HP_APP_NAP_IDLE_S |
plugin | 900 s |
App Nap guard idle release; 0 disables |
PYMOL_HP_TIMEOUT |
server | 60 s |
default per-call timeout |
PYMOL_HP_SLOW_TIMEOUT |
server | 600 s |
timeout for do, run, render, save, fetch, load and ray-traced screenshots |
PYMOL_HP_MAX_IMAGE_BYTES |
server | 3500000 |
largest inline screenshot |
PYMOL_HP_PYMOL |
live tests | ~/Applications/PyMOL.app/Contents/MacOS/MacPyMOL |
PyMOL executable for live tests |
Development
To run the server and plugin from a checkout, install it editable and point PyMOL at the checkout:
uv tool install --editable /path/to/pymol-hyperpowers
pymol-hyperpowers install-plugin
Re-run install-plugin if the checkout moves. With the editable install, pymol-hyperpowers --version keeps reporting the version from install time; the version notes use the version in the checkout.
uv sync
uv python install 3.10 # a test compiles and runs plugin.py under PyMOL's Python version
uv run pytest # unit tests; no PyMOL needed
uv run pytest -m live # starts headless PyMOLs; set PYMOL_HP_PYMOL if PyMOL is elsewhere
uv run pytest -m live --run-network # adds a fetch from RCSB
uv run ruff format src tests && uv run ruff check src tests && uv run mypy
pytest -m live fails when no live test passed, so a run that found no PyMOL does not look like a pass.
Bump versions with vrzn bump patch (or minor, major); it keeps pyproject.toml and the plugin's PLUGIN_VERSION in step. Bump whenever the plugin's behaviour changes: the server compares its PLUGIN_VERSION with each session's to tell users which side to restart, and an unbumped change goes unnoticed. Change PROTOCOL_VERSION (in both protocol.py and plugin.py) only when the wire format changes.
Publishing
uv run inv publish --dry-run # every step except the upload and the tag
uv run inv publish # upload to PyPI and tag the commit v<version>
uv run inv publish --test # upload to TestPyPI instead; no tag
publish runs only on a clean main whose version is not yet on the index or tagged, so bump with vrzn first. It runs the format, lint, type and unit checks, builds the sdist and wheel into dist/, and refuses a wheel whose plugin.py carries a different PLUGIN_VERSION, since that file is the plugin users get. uv publish reads the token from UV_PUBLISH_TOKEN or asks for it. The tag stays local; push it with git push origin v<version>.
Manual GUI checklist
The live tests run headless PyMOL. Check these by hand in the GUI before a release:
- PyMOL started normally after
install-pluginprints its session name in the console, and the window title shows it. - From an agent,
dowith a window-touching command (for exampleviewport 800, 600) andscreenshotwithray=Falseboth work while the GUI is open. - A ray-traced
renderwith PyMOL in the background finishes in roughly the time it takes in the foreground (the App Nap guard). - Two GUI PyMOLs started seconds apart get distinct names, and both appear in
list_sessions. - In each of Claude Code, Codex and Antigravity,
list_sessionsshows the open PyMOLs.
Metadata
Release files for pymol-hyperpowers 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pymol_hyperpowers-0.2.0.tar.gz | 65.6 kB | Without provenance | Details for pymol_hyperpowers-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymol_hyperpowers-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pymol_hyperpowers-0.2.0-py3-none-any.whl |
Total release size: 139.0 kB
Release files / pymol_hyperpowers-0.2.0.tar.gz
| Download URL | pymol_hyperpowers-0.2.0.tar.gz |
|---|---|
| Size | 65.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b5b08059ea8a15ef80ea98f99f28ed36754660438fdcfba5d0894489e52b734
|
|
BLAKE2b-256 checksum How to use checksums |
1f6cdaf9ac4d8668e0e10bb5440d9f2858991b8839cccf74c99972ffb24427f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pymol_hyperpowers-0.2.0-py3-none-any.whl
| Download URL | pymol_hyperpowers-0.2.0-py3-none-any.whl |
|---|---|
| Size | 73.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4cf30b03bda5fa00d388cd18f73578fe5f74a87b855305eb11c686629201839e
|
|
BLAKE2b-256 checksum How to use checksums |
23f6857cfad8dde8eef37f1847525c67fbb7e12cdc47b384a7450884322d19fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for pymol-hyperpowers 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.