The sketch tool

excalix mcp is an MCP server over stdio with exactly one tool. An agent passes an architecture topology to sketch, and gets back the paths it wrote and the picture itself.

Register the server

In Claude Code:

Terminal
claude mcp add excalix --scope user -- npx -y excalix mcp

Any other client that launches stdio servers takes this entry:

MCP client configuration
{"mcpServers":{"excalix":{"command":"npx","args":["-y","excalix","mcp"]}}}

The server needs Chromium, like the CLI; see getting started. It opens one browser on the first call and reuses it until the client disconnects. A sketch finishes inside the call, so the tool declares execution.taskSupport as "forbidden".

What the agent reads

First the server's instructions, which the client receives when it connects. With tool search on, as Claude Code has it by default, they are the only excalix text an agent sees at the start of a session, so they say when to reach for the tool:

excalix draws architecture, system and topology diagrams in Excalidraw's hand-drawn style. Use its sketch tool whenever someone asks for one, or for an Excalidraw diagram of a system: you give the nodes, edges and groups, and it picks every shape, colour and route. It writes .excalidraw, .svg and .png files and returns their paths and the image, which you should look at before reporting back. Past about twenty nodes, draw an overview and a detail diagram instead of one. The .svg and .png carry the editable scene, and the result has markdown to put the diagram in a README; set animate for an SVG that draws itself.

Then the tool description, the whole guide the agent gets unless the skill is installed too. It is served verbatim from tools/list:

Draws an architecture diagram. You give the topology, what exists and what talks to what; excalix picks every shape, colour, size and route. A node's kind and its optional icon both name what the node is, and excalix decides how either is drawn, so there is nothing visual to configure.

A node sits in exactly one group: name the group it runs in, and let an edge across the boundary carry any other relationship.

List nodes in reading order, sources first. Where edges form a loop, order decides which arrow runs backwards: the one from a node listed later to one listed earlier. Among siblings it is a preference and no more, and the layout reorders some of them when that keeps arrows from crossing. It never steers where an arrow is routed; what moves a layout is the direction of an edge, which nodes share a group, and direction itself.

Look at the returned image, and act on the notes when the result has any; call again with an adjusted spec if labels overlap or the flow reads wrong.

Those are excerpts. Between them the description defines the six node kinds, the icon catalog and the two edge styles, gives the sizing advice from the spec reference, says what animate adds, and says the SVG and PNG carry the scene. The full text and both schemas live in the contract snapshot, and the instructions in their own; the test suite keeps both in step with the server.

Input

The input schema is the spec, unchanged, plus three optional fields:

fieldmeaning
the spectitle, direction, groups, nodes and edges, as in the spec reference. Only nodes is required.
outOutput basename without extension; writes <out>.excalidraw, <out>.svg and <out>.png. Relative paths resolve against the first root the client declares through MCP roots, usually the project directory. When the client declares no roots, or the request fails or takes over two seconds, the server's working directory stands in, which is the project directory when Claude Code launches the server. The server asks once per connection and keeps the answer until the client sends notifications/roots/list_changed, so a client that never answers costs the two seconds once. Absolute paths are used as given. Defaults to diagrams/<title slug>, or diagrams/diagram with no title.
theme"light" by default. "dark" draws <out>.svg and <out>.png in Excalidraw's dark mode, light lines on an opaque #121212. "both" writes the light files and adds <out>.dark.svg and <out>.dark.png, for a page that follows the reader's colour scheme. The .excalidraw is the same either way, and a dark image reopens in Excalidraw as the light scene, since dark mode is how it is shown, not what it holds.
animateAbsent by default. "story" or "layers" also writes <out>.animated.svg, and <out>.dark.animated.svg beside the dark pair for theme both: the same SVG building itself in a loop. "story" brings in the title, then each edge in the order the spec lists them, its source first, then its target, then the arrow; nodes no edge reaches come last. "layers" brings in the layout one layer at a time along the flow, each followed by the arrows whose ends are both in. <out>.svg stays static, and the image block stays the finished diagram. Getting started has the timing.

Every object in the schema sets additionalProperties: false, and each field carries a description written for the model reading it.

A successful result

A call with the order pipeline spec and no out comes back as structured content and two content blocks. The paths are absolute; here the project lives in /path/to/project.

Structured content

The written paths as fields, plus the PNG's size, matching the tool's output schema:

structuredContent
{
  "excalidraw": "/path/to/project/diagrams/order-pipeline.excalidraw",
  "svg": "/path/to/project/diagrams/order-pipeline.svg",
  "png": "/path/to/project/diagrams/order-pipeline.png",
  "pixels": { "width": 2330, "height": 992 },
  "preview": { "width": 2000, "height": 851 },
  "markdown": "![order pipeline: Web app, Order API, Fulfilment, orders.created, Postgres, Redis, Stripe](diagrams/order-pipeline.svg)"
}

With animate set, an animatedSvg field after png names .../order-pipeline.animated.svg. With theme set to "both", a dark field after those names the dark pair: { "svg": ".../order-pipeline.dark.svg", "png": ".../order-pipeline.dark.png" }, with its own animatedSvg when animated. pixels is the size of the PNG on disk, and preview the size of the image block. A very wide pixels.width usually means a long node label stretched the layout. When there is something to act on before the diagram is shown, such as a size too big to read, a notes array holds one line per thing; see large diagrams. Without anything to say, the field is absent.

markdown shows the diagram in a README or doc. It points at the SVG, which stays crisp at any size, carries the editable scene and renders on GitHub, and its alt text is the title followed by every node label. The path is relative to the directory a relative out resolves against, usually the project root, with no leading slash, so it is right as it stands for a README there; the tool description asks the agent to rewrite it relative to the .md file it goes into. A file outside that directory gets its absolute path, which GitHub would read from the repository root; the description says the path can be absolute, so the agent knows to rewrite it. With animate set it is a picture of the animated SVG, which shows the finished diagram wherever animation does not run, and its first source is the still SVG for a reader who asks for reduced motion: an SVG shown as an image is not reliably told of that setting, so the rule inside it cannot be counted on. With both set, the two still SVGs come first. With theme set to "both" alone it is a picture that follows the reader's colour scheme, which GitHub renders:

structuredContent.markdown, theme both
<picture><source media="(prefers-color-scheme: dark)" srcset="diagrams/order-pipeline.dark.svg"><source media="(prefers-color-scheme: light)" srcset="diagrams/order-pipeline.svg"><img alt="order pipeline: Web app, Order API, Fulfilment, orders.created, Postgres, Redis, Stripe" src="diagrams/order-pipeline.svg"></picture>

A text block

The structured content again, serialized as JSON on one line. Claude Code shows the model the image and the structured content and drops text blocks, while some clients read only the content, so each carries the whole answer.

An image block

The diagram as a PNG, base64 encoded with mimeType image/png, so the agent can look at it without a separate read and call again if a label collides or the flow reads backwards. It is exported again at whatever scale up to the file's own fits 2000 pixels a side, the most Claude Code passes to a model whole, so the payload stays small and what the model sees is the image the size note judges. A diagram that already fits gets the file itself. The .png on disk stays the full 2x export, for people and for cropping: opening it whole in Claude Code gets the same 2000-pixel copy, so to judge a detail an agent crops that region out of it, scaling coordinates by pixels.width / preview.width. With theme set to "dark" the image is dark too; with "both" it is the light one.

Errors

A spec that fails validation does not throw a protocol error. The result has isError: true and one text block with every problem on its own line, the same lines excalix validate prints:

content[0], with isError true
nodes[0].kind: got "gateway", expected one of "client", "service", "datastore", "queue", "cache", "external"
edges[0].to: unknown node "apy", did you mean "api"?

Anything else that goes wrong while drawing comes back the same way, as a single line starting error:. The one most people meet first:

content[0], with isError true
error: Chromium is not installed. Run: npx -y playwright@1.63.0 install chromium

After an error of that kind the server closes its browser and opens a fresh one on the next call. A call to any tool name other than sketch gets a protocol error instead.

Large diagrams

When the copy of the image a model reads would shrink edge labels below about 11 pixels, the result carries a note. That copy is what Claude Code hands over, fitted into 2000 pixels a side, and then what the model's high-resolution tier keeps of it, about 4784 tiles of 28 by 28 pixels; a long strip is shrunk by its edge and a dense square by its area:

structuredContent.notes[0]
note: a model reads this diagram at 2000x383 px, where its edge labels are about 7px tall, too small to read. Split it into an overview and a detail diagram, or shorten the longest labels; the PNG on disk keeps the full 9124x1748.

Past that point thin lines and small labels go missing from what the model sees, even though the PNG on disk is sharp. The usual answer is two diagrams: an overview that collapses each region to one node, and a detail diagram of the part under discussion.