Skip to main content
Glama
agent-canvas
by arvsrn

agent-canvas

A shared canvas where agents put images and people leave comments on them.

  • Agents use the MCP server to make files and sections, add images and read comments.

  • People pan and zoom the canvas, then click (point) or drag (area) on an image to comment.

  • The canvas is the source of truth. Any agent session can read what's open and mark comments as addressed.

Run

bun install
bun run dev          # API + MCP on :4400, web app on :4401
bun scripts/seed.ts  # optional demo canvases

Open http://localhost:4401.

Production: bun run build && AGENT_CANVAS_PUBLIC_URL=https://… bun run start serves the web app and API from one port (PORT, default 4400). Data lives in ./data (AGENT_CANVAS_DATA to change).

Related MCP server: Napkin

Connect an agent

MCP endpoint: http://localhost:4400/mcp (streamable HTTP, no auth).

OpenCode (~/.config/opencode/opencode.json):

{ "mcp": { "agent-canvas": { "type": "remote", "url": "http://localhost:4400/mcp" } } }

The agent guide is in skill/agent-canvas/SKILL.md. Short instructions are also sent by the MCP server itself.

Images can also be uploaded without MCP:

curl -F image=@shot.png -F title="Settings dialog, dark mode" -F section=dialogs -F scale=2 \
  http://localhost:4400/api/files/desktop-audit/images

How it's built

  • shared/layout.ts: section grid layout and relative section placement, used by server and client.

  • server/: Bun, SQLite (bun:sqlite), sharp. Images are stored by content hash with 256px and 1024px versions, plus 32, 128 and 512px squares (the image stretched to fill) that the client packs into texture atlases. /thumbs/<size>?h=<hash>,… returns many squares in one response.

    • mcp.ts: tools and instructions. Every call is logged to the mcp_log table for reviewing how agents use it.

    • render.ts: server-side rendering for view, get_image and view_comments.

    • index.ts: HTTP, assets, and the per-file WebSocket (changes, presence, cursors).

  • web/: Svelte 5. Three layers:

    • Scene (canvas/scene.ts): the layout packed into flat arrays with a uniform grid over the images, rebuilt only when the document changes. Culling and hit testing cost what's on screen, not what's in the file.

    • WebGPU (canvas/renderer.ts): sections, images, pixel grid at 800%+. Images up to 640 device pixels draw from atlas pages of square thumbnails (32, 128 or 512px slots by on-screen size), one instanced draw call per page. Bigger ones get their own texture at the server tier they need, with nearest sampling when magnified. Loads go nearest-to-centre first, and atlas slots and textures are evicted least recently drawn first.

    • Canvas 2D (canvas/labels.ts): section chips and image titles at a fixed screen size.

    • DOM: comments, clusters, cursors, menus. Pins sit at world positions and are placed in CSS from --cx, --cy and --s on the canvas, so panning doesn't rerender them. Only pins near the viewport are in the DOM.

Performance: press Shift+P (or add ?perf to the URL) for frame times, draw calls and texture memory. bun scripts/bulk.ts 30000 fills a file with 30,000 images from existing assets, and scripts/bench.browser.js drives a fixed pan and zoom path in the page and reports per-frame main-thread time.

Reviewing agent behaviour:

sqlite3 data/agent-canvas.sqlite "select datetime(ts/1000,'unixepoch'), tool, ok, args from mcp_log order by id desc limit 50"

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables agents to present an interactive drawing canvas to users, allowing them to sketch and send drawings back into the conversation as images.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables agents to draw on a self-hosted canvas by creating and editing frames, text, shapes, images, and SVGs with auto-layout, then inspecting, exporting, and sharing the results. Also supports live viewing of agent edits, pinned comments, screenshots, and revision history so people and agents can collaborate on boards.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables an AI agent to read and write a product's design screens on a shared, versioned canvas: creating and editing HTML screens and shared parts, taking screenshots, linking flows, posting comments and annotations, and opening or approving proposals. Every drawing is returned with its screenshot so the agent can see what it produced, letting screens persist and evolve across chats instead of starting from zero.
      1
      MIT