← Open Lone Pair

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 inWhere it runsHow to get it
Hosted MCP server, https://mcp.lonepair.app/mcpOn CloudflareNothing 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.lonepairIn the editor at lonepair.app, or in the downloaded single fileNothing to install. Works today for any agent that can run script in a browser page.
Command-line tool, lonepairOn your computer, with Node 22 or laterPart of the Lone Pair source code. It is not yet published as a package.
MCP server on your computerYour agent starts it over standard input and output, or you run the HTTP server yourselfPart 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

What is refused

Lone Pair does not guess. These come back as an error with the reason, and no figure:

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

Lone Pair is not affiliated with ChemDraw. About · Licence · Terms · Privacy · llms.txt