drawionotator
by oberbichler
README.md
<p align="center">
<img src="assets/icon.png" width="112" height="112" alt="drawionotator">
</p>
<h1 align="center">drawionotator</h1>
<p align="center">Pair-design draw.io diagrams with your AI agent – point at the shape, the agent fixes the file.</p>
<p align="center">
<img alt="Platforms" src="https://img.shields.io/badge/macOS%20%7C%20Windows%20%7C%20Linux-grey">
<img alt="MCP" src="https://img.shields.io/badge/MCP-server%20%2B%20tasks-7c3aed">
<a href="LICENSE"><img alt="License: ISC" src="https://img.shields.io/badge/license-ISC-blue"></a>
</p>

[Watch in full quality (MP4)](docs/demo.mp4)
drawionotator is a desktop viewer for `.drawio` files that sits next to your coding agent (Claude Code, GitHub
Copilot, …). Click a shape and type what should change – the comment goes to the agent over the
[Model Context Protocol](https://modelcontextprotocol.io) with the cell's **id, label, style, bounds and line in
the file**. The agent edits the XML, and the diagram reloads by itself. It is the draw.io sibling of
[PDFnotator](https://github.com/oberbichler/pdfnotator) and shares its architecture.
## Quick start
1. **Build & install** (see [Development](#development)), or run `npm run tauri dev`.
2. **Connect your agent once** – click the agent chip in the title bar and copy the ready-made command, or:
```sh
# macOS
claude mcp add --scope user drawionotator -- /Applications/drawionotator.app/Contents/MacOS/drawionotator --mcp
code --add-mcp '{"name":"drawionotator","type":"stdio","command":"/Applications/drawionotator.app/Contents/MacOS/drawionotator","args":["--mcp"]}'
copilot mcp add drawionotator -- /Applications/drawionotator.app/Contents/MacOS/drawionotator --mcp
```
3. **Say “open in drawionotator”** in your agent chat. That's it.
### Drawing and commenting
One tool palette on the left does both:
- **Draw** – rectangle, rounded rectangle, ellipse, diamond, triangle, hexagon, parallelogram, cylinder, cloud,
document, note, person, container, text, and **line, arrow, double arrow, elbow connector, curved
connector**. Drag on the canvas to draw (`⇧`: square / 45°), click for the default size. A line that starts or
ends on a shape is connected to it. Double-click a tool (or `Q`) to keep it.
- **Agent** (bottom of the palette) – **comment on a shape** (`C`, then click; `⇧`-click adds shapes; with a
selection `C` comments on it right away), **comment on an area** (`⇧C`, drag; the agent gets a screenshot and
the cells inside), **sketch** (`P`, from PDFnotator: draw freehand, arrows, rectangles and typed notes in red
over the diagram, then just start typing; `⇥` switches the shape, `⌘Z` takes back a stroke; the agent gets the
screenshot with and without the sketch and, per stroke, the cells it circles, crosses or points at),
**message to the agent** (`/`). In the comment box `⇥` switches to **Rename** or **Delete** (asks the agent to
do it).
- **Style bar** on top – line colour, fill colour (or none), line width, line pattern, arrow heads, rounded
corners, opacity, font size and colour. With a selection it changes the selection; without one it sets the
style of the next shapes you draw.
- **draw.io's handles** to move, resize, rotate and reconnect, the blue **hover arrows** to connect and clone,
in-place text editing, and a **format panel** (Style · Text · Arrange · Diagram) for the details.
- **Groups** like in draw.io: `⌘G` groups the selection (`⇧`-click adds shapes), a click selects the group, a
second click the shape inside; `⇧⌘U` ungroups. Comments on a group tell the agent what it contains.
- Context menus and the page bar (add, rename, duplicate, move, delete). Right-click a tab to copy its path
(`⌥⌘C`), file name or a ready prompt for the agent, reveal it in Finder, open it in the default app (e.g.
draw.io desktop), or close it, the others, the ones to the right or all.
| Keys | Action |
| ----------------------------- | -------------------------------------------------- |
| `V` `H` | Select · hand |
| `R` `O` `D` `T` | Rectangle · ellipse · diamond · text |
| `L` `A` `E` | Line · arrow · elbow connector |
| `C` · `⇧C` · `P` · `/` | Comment on a shape · on an area · sketch · message |
| `Enter` · `F2` · double-click | Edit the label |
| `⌘Z` · `⇧⌘Z` | Undo · redo |
| `⌘C` `⌘X` `⌘V` · `⌘D` | Copy, cut, paste (draw.io compatible) · duplicate |
| `⌫` · `⌘⌫` | Delete · delete with connections |
| `⌘G` · `⇧⌘U` · `⇧⌘F` · `⇧⌘B` | Group · ungroup · to front · to back |
| Arrows (`⇧`: grid) | Move |
| `⌘B` `⌘I` `⌘U` · `⌘E` | Bold, italic, underline · edit style |
| `⌥⇧L/C/R/T/M/B` | Align |
| Space + drag · scroll | Pan |
| Pinch · `⌘`-scroll · `⌘0` | Zoom · fit |
| `PgUp` / `PgDn` · `⌘1…9` `⌘W` | Pages · tabs |
Changes are **saved automatically** (like draw.io desktop), uncompressed with one cell per line. If the agent
changes the file while you have unsaved edits, drawionotator asks whether to keep your version or reload. The
agent is told which cells you changed (“The user edited the diagram themselves (cells …) — re-read the file”)
with its next result, so it never overwrites your work from memory.
The status chip shows who is listening (“Claude Code listening”). Comment badges sit on the shapes until the
agent resolves them; the cells the agent changed flash green after each reply. If an edit breaks the file
(invalid XML, duplicate ids, edges pointing nowhere), the viewer keeps showing the last valid version and the
agent is told what to fix.
## What the agent sees
```text
## [c3] page 1 "Overview" · 1 cell(s)
- vertex `orders` "Order Service ⏎ Java 21" (line 22) at (610, 150) 140×60 in cluster "Kubernetes cluster"
· style: rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;
Make this bigger and blue
```
### MCP tools
| Tool | Purpose |
| ------------------- | ------------------------------------------------------------------------------------------ |
| `open_diagram` | Open a `.drawio` file (`uncompress: true` rewrites compressed pages as editable XML) |
| `wait_for_feedback` | Block until the user comments; returns compact comments (+ small screenshots for areas) |
| `get_comments` | Full details of delivered comments (complete styles, all cells of an area, full-res image) |
| `reply` | Show a message, resolve comment ids, flash `changed_cells`; reports file problems |
| `viewer_status` | Validity, pages, current page, queued comments and all open diagrams |
Plus a `review` prompt. Clients that declare the **MCP Tasks extension** (`io.modelcontextprotocol/tasks`) get
`wait_for_feedback` as a task (`taskSupport: "required"`): the wait runs in the background for up to 9 minutes
and the client polls `tasks/get`, so no request timeout cuts the review loop short. Everyone else gets a normal
blocking call (50 s by default, with `notifications/progress` keep-alives). Supported protocol revisions:
2024-11-05 … 2025-11-25 via `initialize`, and the stateless 2026-07-28 revision (`server/discover`).
## Development
Requirements: Rust (stable), Node ≥ 20, and the [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/).
```sh
npm install # also fetches draw.io's viewer into public/vendor (Apache-2.0)
# (run `node scripts/fetch-viewer.mjs` if your npm skips install scripts)
npm run tauri dev # run the app
npm run dev # UI only, in a browser, with a scripted demo agent (src/demo.ts)
npm run check # typecheck, lint, vitest, rustfmt, clippy, cargo test
npm run test:ui # UI tests in WebKit + Chromium (npx playwright-core install chromium webkit)
npm run coverage # unit + UI test coverage
npm run demo:record # re-record docs/demo.mp4 and docs/demo.gif (needs ffmpeg)
npm run tauri build # bundle
```
Diagrams are rendered by draw.io's own `Graph` from `viewer-static.min.js`, so shapes look exactly like in draw.io.
The script is downloaded by `scripts/fetch-viewer.mjs` on install and bundled with the app; only rare stencils
are loaded from `viewer.diagrams.net` on demand.
| Variable | Meaning |
| -------------------- | -------------------------- |
| `DRAWIONOTATOR_PORT` | Local HTTP port (4757) |
| `DRAWIO_VIEWER_URL` | Other draw.io viewer build |
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for how the pieces fit together.
## License
ISC. draw.io's viewer (fetched at install time) is © JGraph Ltd, Apache License 2.0.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues