Using it from Claude Code

The desktop app is one way in. The other is to plug the MCP server straight into Claude Code, so you can ask for a diagram in the middle of doing something else.

Register it

claude mcp add diagram-builder --scope user -- \
  diagram-builder mcp --allow-dir ~/courses

--allow-dir is repeatable, and it confines every path the server will touch. Set it to the folders you actually keep diagrams in; there is no reason to give it your home directory.

Then just ask, in plain language. The assistant builds the diagram, renders it, looks at the result, and fixes what it got wrong.

The ten tools

ToolWhat it does
create_diagramStart a new file
apply_opsBuild or edit a whole diagram in one atomic call
add_shapeOne shape
add_connectorOne connector, optionally labelled
add_labelFree-standing text
update_elementChange a shape or connector in place
delete_elementRemove one
list_elementsIds, kinds and bounding boxes
describe_diagramThe whole scene in prose
renderPNG, PDF or clean SVG — and the image comes back

apply_ops is the one that matters

It builds a whole diagram in a single call, with later operations naming elements earlier ones created:

{ "path": "arch.svg", "ops": [
  { "op": "add_shape", "kind": "rect", "id": "gw", "text": "Gateway",
    "place": { "x": 60, "y": 250 }, "style": { "fill": "blue" } },
  { "op": "add_shape", "kind": "cylinder", "id": "db", "text": "Orders",
    "place": { "below": "gw", "gap": 70 }, "style": { "fill": "teal" } },
  { "op": "connect", "from": "gw", "to": "db", "label": "SQL" }
]}

Either every operation lands or none does. If one fails, nothing is written and the error names the index that broke, so a failure never leaves half a diagram behind.

What comes back

Every reply carries what a caller who cannot see the canvas needs: resolved ids and boxes, the anchor points on each shape, how much page is free on each side, what is nearby, and every warning with a concrete suggested fix — set width >= 200 or font-size <= 9, not "text may overflow".

And render hands back an actual image. That closes the loop, and it is the reason this exists rather than a declarative diagram language.

One thing that will bite you

Placement resolves when the call runs. { "below": "gw" } computes an absolute position from where gw is at that moment — moving gw later does not drag anything along. This keeps the file a plain description of what is where, with no constraint solver to debug, but it does mean order matters.