Headless-first 2D vector design and animation MCP server for local coding agents.
pica gives AI coding agents (OpenCode, Claude Code, Cursor, and any MCP client) a lightweight, local blackboard to create, inspect, animate, and export 2D graphics without paid cloud APIs, rate limits, or heavy GUI suites.
Every canvas is a standard, standalone .pica.svg file. Agents mutate it cleanly by element #id, verify layouts visually through PNG snapshots with optional coordinate grids and bounding-box labels, and export to static or animated formats locally.
Opening hook from the pica launch ad, a 64 second spot authored as .pica.svg and exported with pica_export.
| Capability | pica | Cloud Design MCPs | Whiteboard MCPs | Video-in-React Frameworks |
|---|---|---|---|---|
| Cost and rate limits | Free, local, unlimited | Paid plans, rate limited | Free | Free |
| Runtime dependencies | 5 packages (Bun only) | Cloud account required | Moderate | Heavy ( node_modules bloat) |
| Precision 2D vectors | Native SVG + <defs> |
Yes | Rough diagrams only | DOM/Canvas |
| Keyframe animations | CSS @keyframes + WAAPI |
Limited | No | Code-heavy |
| Vision feedback loop | Built-in pica_inspect with grid and#id overlay |
Limited | No | Manual |
| Exports | SVG, PNG, JPG, WebP, animated WebP, MP4 | Cloud exports | PNG/SVG | MP4/WebM |
Coding Agent (OpenCode / Claude Code / MCP Client)
│ JSON-RPC over stdio (MCP SDK v2)
▼
pica MCP Server (Bun + TypeScript)
├── File Engine (.pica.svg atomic read/patch/animate + fast bbox math)
├── Static Renderer (@resvg/resvg-js for fast PNG snapshots & exports)
├── Media Engine (lazy system Chromium CDP + ffmpeg stdin pipes)
└── Live Preview (optional Hono HTTP + WebSocket viewer on :4173)
-
Zero heavy JS media deps: No Playwright, Puppeteer, Sharp, Canvas, React, or Vite.
-
Pure stdio protocol: All logs route to
stderrsostdoutstays clean JSON-RPC. -
Deterministic animation capture: Headless Chromium s
document.getAnimations(), steps exact frame timestamps, and pipes raw PNG frames straight intoffmpegstdin. -
Bun (v1.2+)
-
Optional: System
chromium(orgoogle-chrome) inPATHforbboxMode: "exact", animatedpica_inspect, and MP4 / animated WebP export. -
Optional: System
ffmpeginPATHfor JPG, WebP, and MP4 export.
If chromium or ffmpeg is missing, static SVG and PNG workflows still work and media-dependent tools return actionable error messages.
git clone https://github.com/nadeeshafdo/pica.git
cd pica
bun install
Or run without cloning:
bunx pica-mcp
Add pica to ~/.config/opencode/opencode.json. With a local clone:
{
"mcp": {
"servers": {
"pica": {
"type": "local",
"command": ["bun", "/absolute/path/to/pica/src/index.ts"],
"environment": {}
}
}
}
}
Or without cloning:
{
"mcp": {
"servers": {
"pica": {
"type": "local",
"command": ["bunx", "pica-mcp"],
"environment": {}
}
}
}
}
With a local clone:
claude mcp add pica -- bun /absolute/path/to/pica/src/index.ts
Or without cloning:
claude mcp add pica -- bunx pica-mcp
bunx @modelcontextprotocol/inspector bun src/index.ts
Open http://127.0.0.1:4173 in your browser to watch live updates, then ask your agent:
Design an animated minimalist logo reveal for pica in 1280x720, inspect it at 0ms and 1200ms with the debug grid on, and export it as an MP4.
Initializes a .pica.svg canvas and broadcasts it to live preview clients.
path(string, required): Output.pica.svgfile path.width(int, default800, max8192): Canvas width in pixels.height(int, default600, max8192): Canvas height in pixels.background(string, default"#ffffff"): Canvas background CSS color.fps(number, default30, max120): Default frames per second for animated exports.durationMs(int, default2000, max600000): Timeline duration in milliseconds.
Parses a .pica.svg file and returns canvas dimensions, metadata, animations, and element nodes with bounding boxes { x, y, w, h }.
path(string, required): Input.pica.svgfile path.bboxMode("fast" | "exact", default"fast"):"fast"computes geometry bboxes locally (shapes, full SVG path commands, group unions,text-anchoralignment);"exact"queries ChromiumgetBBox().tree(boolean, defaultfalse): Include nested node hierarchy alongside the flat list.includeRaw(boolean, defaultfalse): Include raw SVG XML in the response.
Applies atomic batch DOM mutations by #id. Rejects <script> elements, on* event handlers, javascript: URLs, invalid XML, and cyclic group reorders.
path(string, required): Target.pica.svgfile path.ops(array, min 1, required): Operations applied in order:add:{ op: "add", id, tag, attrs?, textContent?, parentId?, position? }update:{ op: "update", id, attrs?, textContent? }(passnullas an attribute value to remove it)remove:{ op: "remove", id }reorder:{ op: "reorder", id, parentId?, newIndex?, beforeId? }setDefs:{ op: "setDefs", defsSvg }
Adds, updates, or removes @keyframes and #id animation rules inside <style id="pica-anim">. Automatically emits transform-box: fill-box and transform-origin so rotations and scales anchor to the element instead of (0, 0), and recalculates metadata durationMs from all remaining animations plus baseDurationMs. Multiple animations stack as comma-separated animation: entries per #id; re-applying the same @keyframes name updates only that entry, and removing a name strips only its entry.
path(string, required): Target.pica.svgfile path.name(string, required): Keyframes identifier (e.g.fadeUp,spin).keyframes(string, optional): CSS keyframe body (e.g."0%{opacity:0}100%{opacity:1}"). Required when creating a new animation.animations(array, optional): Target bindings{ id, durationMs?, delayMs?, easing?, iterations?, direction?, fill?, transformOrigin? }.remove(boolean, defaultfalse): Delete the@keyframesblock and surgically remove only matching entries from comma-separatedanimation:declarations.
Updates canvas-level properties on an existing .pica.svg file and notifies live preview clients.
path(string, required): Target.pica.svgfile path.width(int, optional): Canvas width in pixels.height(int, optional): Canvas height in pixels.background(string, optional): Canvas background CSS color (syncs#pica-bgand#pica-meta).fps(number, optional): Frames per second for animated exports.durationMs(int, optional): Timeline duration in milliseconds. SetsbaseDurationMsand recalculatesdurationMs.
Renders a PNG preview and returns an MCP image block plus a short text summary for visual verification.
path(string, required): Input.pica.svgfile path.timeMs(number, default0): Timestamp in milliseconds. Static designs attimeMs = 0render viaresvg. Animated designs (and anytimeMs > 0) render via headless Chromium CDP when available, falling back to staticresvgattimeMs = 0if Chromium is absent.showGrid(boolean, defaultfalse): Overlay a temporary 100px coordinate grid (never saved to disk).showIds(boolean, defaultfalse): Overlay temporary#idbounding boxes and labels (never saved to disk).scale(number, default1, max4): Render scale factor.maxWidth(int, default1024, max8192): Caps output PNG width so large canvases do not flood agent context windows.
Exports clean assets (debug overlays are always stripped).
path(string, required): Input.pica.svgfile path.format("svg" | "png" | "jpg" | "jpeg" | "webp" | "mp4", required): Output format.outPath(string, required): Destination file path (parent directories are created automatically). Rejectsffmpegflag-like (-...) and protocol (://) paths.scale(number, default1, max4): Output scale multiplier.quality(number, default90,0-100): Compression quality for JPG, WebP, and MP4 (-crfmapped, with+faststart).fps(number, optional): Override document FPS for animated exports.animated(boolean, defaultfalse): Settruefor animated WebP; MP4 is always animated.timeMs(number, default0): Static frame timestamp in ms. When> 0requires Chromium; animated docs use Chromium attimeMsfor accurate state even at0. Falls back toresvgfor static docs at0.
Every file is valid standalone SVG with five reserved skeleton elements:
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="600" viewBox="0 0 800 600">
<metadata id="pica-meta">{"version":1,"fps":30,"durationMs":2000,"background":"#ffffff"}</metadata>
<defs id="pica-defs"></defs>
<style id="pica-anim"></style>
<rect id="pica-bg" width="100%" height="100%" fill="#ffffff"/>
<g id="pica-root"></g>
</svg>
All disk writes are atomic (.tmp write followed by rename). Because the source of truth is plain SVG and CSS, any browser, vector editor, or git diff tool works with it natively. Set PICA_ROOT to sandbox all file access to one directory tree.
When the MCP server starts, it opens an optional local preview server at http://127.0.0.1:4173 (port failures log to stderr and never crash the MCP transport). If PICA_PORT is busy, it automatically falls back to an OS-assigned ephemeral port on 127.0.0.1 and logs the actual URL.
- Checkerboard artboard with wheel zoom, drag pan, and fit-to-screen.
- Live WebSocket reload on every
pica_create,pica_patch,pica_animate, andpica_configurewhile preserving your current zoom and pan across patches./wsupgrades require same-origin (127.0.0.1/localhost) or missingOrigin. - Bottom timeline scrubber ( + time slider) synced with
document.getAnimations().
| Variable | Default | Description |
|---|---|---|
PICA_PORT |
4173 |
Port for the local Hono live preview server ( 127.0.0.1 ). Falls back to ephemeral0 when busy. |
PICA_ROOT |
Unset | When set, all path /outPath inputs must resolve inside this directory tree. |
CHROME_PATH /CHROMIUM_PATH |
Auto-detected | Explicit path to a Chromium or Google Chrome executable. |
PICA_CHROME_NO_SANDBOX |
Unset | Set to 1 to launch Chromium with--no-sandbox . By default the sandbox is kept and only retried without it when the first launch does not start. |
bun run typecheck # Strict TypeScript check (noEmit)
bun test # Integration tests (skips Chromium/FFmpeg cases if absent)
bun run build # Bundle CLI to ./dist