Lone Pair for AI agents and scripts
An agent or a script can ask Lone Pair for a figure without a person drawing it: send a structure, a reaction or a file, and get back an image or an editable file. The figure is drawn by the editor's own code, so it looks the same and follows the same rules. This page is for the people and programs that set that up.
Four ways in
| Way in | Where it runs | How to get it |
|---|---|---|
Hosted MCP server, https://mcp.lonepair.app/mcp | On Cloudflare | Nothing to install. Add the address as a custom connector in Claude, ChatGPT (developer mode), Cursor, Gemini CLI or Copilot Studio. No account or key. |
Page API, window.lonepair | In the editor at lonepair.app, or in the downloaded single file | Nothing to install. Works today for any agent that can run script in a browser page. |
Command-line tool, lonepair | On your computer, with Node 22 or later | Part of the Lone Pair source code. It is not yet published as a package. |
| MCP server on your computer | Your agent starts it over standard input and output, or you run the HTTP server yourself | Part of the Lone Pair source code, as above. |
The hosted server keeps nothing: each call reads its input, draws and answers. It reads and writes no files, draws figures of up to 500 atoms and schemes of up to 12 structures, and writes PNGs at up to 600 dpi. Every request counts toward a limit of 120 a minute for each caller's address (an IPv6 address by its /64 block); people using claude.ai share an allowance of 600 a minute, since their calls all come from Anthropic's servers. Name lookups have their own limit of 20 a minute for each address, which claude.ai’s users also share. Every tool is marked read-only, so clients need not ask before using it.
What goes in
SMILES, reaction SMILES (reactants>agents>products), InChI, molfiles (V2000 and V3000), RXN, SD files (the first record), ChemDraw CDXML and CDX, CML, Marvin, and Lone Pair's own drawings: the JSON, or an SVG or PNG that Lone Pair wrote. A compound name works only when the caller asks for a lookup; the name is then sent to PubChem, which is the only network call.
What comes back
- Figures: SVG, PNG (300 dpi unless asked otherwise), PDF and EPS, in ACS 1996, RSC, Nature Reviews or slide style, cropped to the drawing.
- Structure files: ChemDraw CDXML and CDX, molfile, SD file, RXN, SMILES, InChI, InChIKey, CML and Marvin.
- Numbers: formula, molecular weight, exact mass, elemental analysis, SMILES, InChI and InChIKey for each structure; for a reaction, each structure's role and whether atoms and charge balance, or "Not checked" when a structure cannot be read.
- The drawing itself, with every result. Pass it back to add a structure, change the style or add a caption. SVG and PNG figures also hold it, so they reopen in the editor.
- Notes: anything that was changed on reading, or that the chosen format cannot keep, in words.
What is refused
Lone Pair does not guess. These come back as an error with the reason, and no figure:
- a SMILES that cannot be read, with the place it goes wrong;
- an aromatic ring that cannot alternate single and double bonds (
c1cccc1), which would otherwise be drawn as a radical; - an atom with too many bonds, unless the caller asks for it as written;
- a SMILES over 3,000 characters, or any input over 5 MB.
Page API
Every method returns a promise and acts on the page that is open.
await lonepair.load('CC(=O)Oc1ccccc1C(=O)O') // adds, like a paste; {replace: true} clears first
await lonepair.svg() // SVG text
await lonepair.png({dpi: 300}) // a PNG Blob
await lonepair.export('cdxml') // {data, note}; also mol, molV3, sdf, rxn, smiles, inchi, inchikey, cml, mrv
await lonepair.analyze() // {structures: [{formula, molecular_weight, exact_mass, smiles, inchi, inchikey}], reaction}
await lonepair.drawing() // the drawing as JSON
Command line
lonepair draw 'CC(=O)Oc1ccccc1C(=O)O' -o aspirin.png --dpi 600 lonepair draw aspirin --name -o aspirin.svg # looks the name up at PubChem lonepair reaction --reactant CCO --reactant 'CC(=O)O' --product 'CC(=O)OCC' --product O --above H2SO4 -o ester.pdf lonepair convert scheme.cdxml --to molV3 lonepair analyze 'CCO.CC(=O)O>>CC(=O)OCC.O' --json lonepair edit aspirin.svg --caption 'Aspirin' --style rsc -o aspirin-rsc.svg
Results go to standard output or to -o; notes and errors go to standard error. Exit code 0 means done, 1 means the input was refused, 2 means the command was wrong. An existing file is not replaced without --force.
MCP server
The hosted server is at https://mcp.lonepair.app/mcp. On your own computer the stdio server is started with node agent/mcp.mjs from the source folder. Tools: draw, render_reaction, convert, analyze and edit_drawing. A PNG comes back as an image, text formats as text, and the drawing and notes as structured content. The server reads only structure and figure files, writes a file only when given output_path, and does not replace an existing file unless told to.
The same tools over HTTP, for a chat agent on another computer: node agent/http.mjs. It listens on this computer only, at port 8788, path /mcp. It does not read or write files, draws structures of up to 500 atoms, and marks every tool read-only. With LONEPAIR_MCP_EDITOR_LINKS=1, a draw result also carries a link that opens the structure in the editor (?s= on the page).
An interactive card in the chat
In chat apps that show MCP Apps (claude.ai, Claude Desktop, VS Code Copilot and others), a drawing from the hosted server comes as a card in the conversation. In the card you can change the journal style, add a structure or a caption, see the formula and mass, download PNG, SVG, ChemDraw or molfile, and send the structure back to the chat. Apps that do not show cards, such as Claude Code in a terminal, get the picture as before.
What it does not do
- NMR, pKa, bond-energy and mass-spectrum estimates are in the editor, not in these tools.
- No moving or deleting atoms in an earlier drawing: draw the structure again.
- One drawing per call: of a file with several records, the first is drawn and a note says so.
- No 3D output, and no JPEG, WebP or GIF from the command line or the server.
Lone Pair is not affiliated with ChemDraw. About · Licence · Terms · Privacy · llms.txt