endgame-canvas

A localhost tldraw canvas exposed over MCP — a shared visual medium
where an AI agent and a human draw and read the same canvas to align understanding and produce
diagrams, right from a chat.

The diagram above was not made in a design tool. An AI agent drew it directly on the
canvas using endgame-canvas's own MCP tools (create_frame, create_graph,
create_shape, create_arrow, create_note, export_image), then exported it to the PNG
you're looking at — from this prompt:
"Draw this system's architecture on the canvas as a top-down flow: an AI agent makes a
tool call to the MCP server, which forwards it by requestId to the WebSocket relay, which
runs it on the browser's tldraw editor. To the side, show the agent exporting the canvas to
a PNG/SVG file, and a human drawing and reading the same canvas. Caption it: the browser is
the source of truth — the server holds no canvas state."
The boxes are blue because that's the agent's attribution colour — the canvas colours each
agent's shapes so a human can see, at a glance, who drew what.
Why
Chat is linear; understanding often isn't. endgame-canvas gives an agent a real 2D surface it
can both read and draw on — including a human's freehand strokes. The agent can read a
scribbled note, tell which shape a hand-drawn circle encloses, connect boxes with bound arrows,
lay out a graph in one call, and export the result to a file you can drop into a document.
What it can do
29 MCP tools over one canvas:
- Read —
read_canvas (a raster the agent can read freehand off), get_snapshot (every
shape with position + text), read_frame (a frame cropped to a raster plus its shapes,
their arrow bindings, and issues — text that outgrew its box, boxes that overlap, arrows
bound at only one end).
- Draw —
create_shape (rectangle / ellipse / text + triangle, diamond, star, hexagon,
cloud, x-box, check-box), create_line, create_highlight, create_arrow (bound to both
shapes), create_note.
- Frames —
create_frame, list_frames — a named frame is the shared reference unit
("what's in frame X?").
- Edit —
update_shape (move / resize / relabel / recolour / text size), delete_shape.
- Arrange —
place_shape (put a shape beside another one, no coordinates), nudge_shapes,
align_shapes, distribute_shapes, stack_shapes, pack_shapes, flip_shapes — each over a
list of ids, each one undo step.
- Navigate —
zoom_to_frame, select — point the human's view and highlight shapes.
- Compose —
create_graph — any node-and-edge diagram (flowchart, org chart, dependency
graph…), laid out tree or grid, with bound arrows, in one call — plus create_connected.
- Wireframe —
create_screen — a whole UI screen in one call from a tree of elements
(input, select, button, checkbox, radio, image, divider, text, and column /
row / panel containers), laid out at a fixed spacing and type scale inside its own frame.
It draws what is on a screen and where, not what it should look like.
- Pages —
create_page, list_pages, switch_page.
- Export —
export_image writes a PNG or SVG to disk, so diagrams land in your docs.
- Attribution —
list_agents; set CANVAS_AGENT and an agent's shapes take a distinct
colour.
Quickstart
Requires Bun.
bun install
bun run start # runs the WS relay (:9910) + Vite (:5173) in one terminal
Open http://localhost:5173 and leave the tab open — that tab is the canvas.
Then register the MCP server with your client. For Claude Desktop / Claude Code, add to the MCP
config:
{
"mcpServers": {
"endgame-canvas": {
"command": "bun",
"args": ["/absolute/path/to/endgame-canvas/src/server.ts"],
"env": { "CANVAS_AGENT": "claude" }
}
}
}
CANVAS_AGENT is optional — set it to give this agent a distinct colour on the canvas; omit it
to draw in the default style. Now ask the agent to read or draw, and watch the tab.
The drawing skill
The tools alone don't make a diagram readable. This repo also ships
endgame-canvas-diagrams — the discipline that decides when a picture beats a paragraph, holds a
diagram to a complexity budget, and runs the read-back loop that catches what a coordinate plan
can't. Install it as a plugin so it loads in every project, not just this one:
/plugin marketplace add CodeCampusCo/endgame-canvas
/plugin install endgame-canvas@endgame-canvas