cd /news/ai-agents/pica-local-2d-vector-design-and-anim… · home › topics › ai-agents › article
[ARTICLE · art-177655] src=github.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Pica: Local 2D vector design and animation MCP server (Bun, SVG, raw CDP)

A developer released pica, a free local MCP server built on Bun and TypeScript that gives AI coding agents such as OpenCode, Claude Code and Cursor a headless 2D vector design and animation workspace, with each canvas stored as a standalone .pica.svg file. Pica runs on 5 packages with no Playwright, Puppeteer, Sharp, Canvas, React or Vite dependencies, renders PNG snapshots via @resvg/resvg-js, and uses a system Chromium over CDP plus ffmpeg to export SVG, PNG, JPG, WebP, animated WebP and MP4; it installs via `bunx pica-mcp` and requires Bun v1.2+.

key takeaway

Pica exposes canvas creation, #id-based SVG patching, grid-overlay PNG inspection and MP4 export as MCP tools over stdio, letting coding agents iterate on 2D graphics locally without cloud design APIs.

read8 min views2 publishedNov 28, 2026
Pica: Local 2D vector design and animation MCP server (Bun, SVG, raw CDP)
Image: Michielbdejong (auto-discovered)

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 tostderr sostdout stays clean JSON-RPC.

  • Deterministic animation capture: Headless Chromium sdocument.getAnimations() , steps exact frame timestamps, and pipes raw PNG frames straight intoffmpeg stdin.

  • Bun (v1.2+)

  • Optional: Systemchromium (orgoogle-chrome ) inPATH forbboxMode: "exact" , animatedpica_inspect , and MP4 / animated WebP export.

  • Optional: Systemffmpeg inPATH for 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.svg file 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.svg file path.
  • bboxMode ("fast" | "exact" , default"fast" ):"fast" computes geometry bboxes locally (shapes, full SVG path commands, group unions,text-anchor alignment);"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.svg file 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? } (passnull as 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.svg file 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@keyframes block 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.svg file path.
  • width (int, optional): Canvas width in pixels.
  • height (int, optional): Canvas height in pixels.
  • background (string, optional): Canvas background CSS color (syncs#pica-bg and#pica-meta ).
  • fps (number, optional): Frames per second for animated exports.
  • durationMs (int, optional): Timeline duration in milliseconds. SetsbaseDurationMs and recalculatesdurationMs .

Renders a PNG preview and returns an MCP image block plus a short text summary for visual verification.

  • path (string, required): Input.pica.svg file path.
  • timeMs (number, default0 ): Timestamp in milliseconds. Static designs attimeMs = 0 render viaresvg . Animated designs (and anytimeMs > 0 ) render via headless Chromium CDP when available, falling back to staticresvg attimeMs = 0 if Chromium is absent.
  • showGrid (boolean, defaultfalse ): Overlay a temporary 100px coordinate grid (never saved to disk).
  • showIds (boolean, defaultfalse ): Overlay temporary#id bounding 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.svg file path.
  • format ("svg" | "png" | "jpg" | "jpeg" | "webp" | "mp4" , required): Output format.
  • outPath (string, required): Destination file path (parent directories are created automatically). Rejectsffmpeg flag-like (-... ) and protocol (:// ) paths.
  • scale (number, default1 , max4 ): Output scale multiplier.
  • quality (number, default90 ,0-100 ): Compression quality for JPG, WebP, and MP4 (-crf mapped, with+faststart ).
  • fps (number, optional): Override document FPS for animated exports.
  • animated (boolean, defaultfalse ): Settrue for animated WebP; MP4 is always animated.
  • timeMs (number, default0 ): Static frame timestamp in ms. When> 0 requires Chromium; animated docs use Chromium attimeMs for accurate state even at0 . Falls back toresvg for 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_configure while preserving your current zoom and pan across patches./ws upgrades 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
── more in #ai-agents 4 stories · sorted by recency
── more on @pica 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/pica-local-2d-vector…] indexed:0 read:8min 2026-11-28 · —