While we can provide more examples in the website, I think a lot of people are using LLM for “simple script” processing. So I’ve been thinking a bunch about providing a tool to help expose the current JSON-RPC automation to Codex, Claude Code, Cursor, etc.
To be up-front, I have some Claude Fable credits and was curious what it would do. (That, and the MCP protocol has been changing - the newest version uses JSON-RPC so it makes it much easier to implement.)
Key points:
Current gaps that matter for MCP:
- No way to read anything back: no command list, no molecule contents, no atom count, no camera state, no “is a basis set loaded”. A client is blind as to what Avogadro can do or the current state.
saveGraphicrenders at the on-screen widget size only and writes to disk.- Command descriptions are one translated sentence; no parameter names, types, or defaults anywhere machine-readable. The docs page is the only schema.
- Python command scripts (
Commandextension,InterfaceScript) are menu-only; not reachable over RPC even though they already carry auserOptionsJSON schema. - No graceful
quit, no way to start Avogadro from a client.
Create a new avogadro-mcp project:
- MCP’s standard local transport is stdio: the client spawns the server process. A GUI app cannot be that process. Avogadro would have to serve Streamable HTTP over
QTcpServerinstead, and then every client needs a URL and a running app before it can connect at all. - The MCP spec moves fast (transports, auth, elicitation, structured output). A pure-Python server updates with
pip; the C++ app ships a few times a year. - The bridge is where “help me write a script” lives anyway: it can hand out docs, examples, and the command catalogue without Avogadro running.
- Avogadro’s job stays small and stable: answer JSON-RPC, describe itself.
Cost: the user needs Python and avogadro-mcp installed. Mitigated by letting Avogadro itself install the MCP client config and, later, by running the server from Avogadro’s bundled pixi environment.
Open decisions
- Schema source of truth: start with the Python catalogue and migrate to
commandSchema()(recommended), or go straight to C++ and accept that the MCP server has untyped tools until all plugin PRs land? - Auto-launch: should the MCP server start Avogadro when it is not running (default on, with an env var to disable), or always require the user to have it open?
- Headless: is offscreen batch rendering in scope? It changes the “every .xyz in this directory” story from “with Avogadro open” to “from a cron job”, but needs a spike and may not work on Windows.
quitgating: accept--testing(matches the docs) or add a clearer--allow-rpc-quit?- Command script naming (§4.4):
script:<Display Name>vs a slug; does a slug need to be stable across translations? (InterfaceScript::displayNameis translatable; the script’s file stem is not.) - Scene-plugin settings (labels, colours, radii): defer, or design a
setDisplaySettingbuiltin now so the MCP tools can make publication figures without the mouse?