{"slug": "pica-local-2d-vector-design-and-animation-mcp-server-bun-svg-raw-cdp", "title": "Pica: Local 2D vector design and animation MCP server (Bun, SVG, raw CDP)", "summary": "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+.", "body_md": "Headless-first 2D vector design and animation MCP server for local coding agents.\n\n`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.\n\nEvery 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.\n\nOpening hook from the pica launch ad, a 64 second spot authored as `.pica.svg` and exported with `pica_export`.\n\n| Capability | pica | Cloud Design MCPs | Whiteboard MCPs | Video-in-React Frameworks | \n|---|---|---|---|---|\n| Cost and rate limits | Free, local, unlimited | Paid plans, rate limited | Free | Free | \n| Runtime dependencies | 5 packages (Bun only) | Cloud account required | Moderate | Heavy ( `node_modules` bloat) | \n| Precision 2D vectors | Native SVG + `<defs>` | Yes | Rough diagrams only | DOM/Canvas | \n| Keyframe animations | CSS `@keyframes` + WAAPI | Limited | No | Code-heavy | \n| Vision feedback loop | Built-in `pica_inspect` with grid and`#id` overlay | Limited | No | Manual | \n| Exports | SVG, PNG, JPG, WebP, animated WebP, MP4 | Cloud exports | PNG/SVG | MP4/WebM | \n\n```\nCoding Agent (OpenCode / Claude Code / MCP Client)\n        │  JSON-RPC over stdio (MCP SDK v2)\n        ▼\n  pica MCP Server (Bun + TypeScript)\n        ├── File Engine (.pica.svg atomic read/patch/animate + fast bbox math)\n        ├── Static Renderer (@resvg/resvg-js for fast PNG snapshots & exports)\n        ├── Media Engine (lazy system Chromium CDP + ffmpeg stdin pipes)\n        └── Live Preview (optional Hono HTTP + WebSocket viewer on :4173)\n```\n\n- **Zero heavy JS media deps:** No Playwright, Puppeteer, Sharp, Canvas, React, or Vite.\n- **Pure stdio protocol:** All logs route to`stderr` so`stdout` stays clean JSON-RPC.\n- **Deterministic animation capture:** Headless Chromium pauses`document.getAnimations()` , steps exact frame timestamps, and pipes raw PNG frames straight into`ffmpeg` stdin.\n\n- [Bun](https://bun.sh/) (v1.2+)\n- **Optional:** System`chromium` (or`google-chrome` ) in`PATH` for`bboxMode: \"exact\"` , animated`pica_inspect` , and MP4 / animated WebP export.\n- **Optional:** System`ffmpeg` in`PATH` for JPG, WebP, and MP4 export.\n\nIf `chromium` or `ffmpeg` is missing, static SVG and PNG workflows still work and media-dependent tools return actionable error messages.\n\n```\ngit clone https://github.com/nadeeshafdo/pica.git\ncd pica\nbun install\n```\n\nOr run without cloning:\n\n```\nbunx pica-mcp\n```\n\nAdd `pica` to `~/.config/opencode/opencode.json`. With a local clone:\n\n```\n{\n  \"mcp\": {\n    \"servers\": {\n      \"pica\": {\n        \"type\": \"local\",\n        \"command\": [\"bun\", \"/absolute/path/to/pica/src/index.ts\"],\n        \"environment\": {}\n      }\n    }\n  }\n}\n```\n\nOr without cloning:\n\n```\n{\n  \"mcp\": {\n    \"servers\": {\n      \"pica\": {\n        \"type\": \"local\",\n        \"command\": [\"bunx\", \"pica-mcp\"],\n        \"environment\": {}\n      }\n    }\n  }\n}\n```\n\nWith a local clone:\n\n```\nclaude mcp add pica -- bun /absolute/path/to/pica/src/index.ts\n```\n\nOr without cloning:\n\n```\nclaude mcp add pica -- bunx pica-mcp\nbunx @modelcontextprotocol/inspector bun src/index.ts\n```\n\nOpen `http://127.0.0.1:4173` in your browser to watch live updates, then ask your agent:\n\nDesign 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.\n\nInitializes a `.pica.svg` canvas and broadcasts it to live preview clients.\n\n- `path` (string, required): Output`.pica.svg` file path.\n- `width` (int, default`800` , max`8192` ): Canvas width in pixels.\n- `height` (int, default`600` , max`8192` ): Canvas height in pixels.\n- `background` (string, default`\"#ffffff\"` ): Canvas background CSS color.\n- `fps` (number, default`30` , max`120` ): Default frames per second for animated exports.\n- `durationMs` (int, default`2000` , max`600000` ): Timeline duration in milliseconds.\n\nParses a `.pica.svg` file and returns canvas dimensions, metadata, animations, and element nodes with bounding boxes `{ x, y, w, h }`.\n\n- `path` (string, required): Input`.pica.svg` file path.\n- `bboxMode` (`\"fast\" | \"exact\"` , default`\"fast\"` ):`\"fast\"` computes geometry bboxes locally (shapes, full SVG path commands, group unions,`text-anchor` alignment);`\"exact\"` queries Chromium`getBBox()` .\n- `tree` (boolean, default`false` ): Include nested node hierarchy alongside the flat list.\n- `includeRaw` (boolean, default`false` ): Include raw SVG XML in the response.\n\nApplies atomic batch DOM mutations by `#id`. Rejects `<script>` elements, `on*` event handlers, `javascript:` URLs, invalid XML, and cyclic group reorders.\n\n- `path` (string, required): Target`.pica.svg` file path.\n- `ops` (array, min 1, required): Operations applied in order:\n  - `add` :`{ op: \"add\", id, tag, attrs?, textContent?, parentId?, position? }`\n  - `update` :`{ op: \"update\", id, attrs?, textContent? }` (pass`null` as an attribute value to remove it)\n  - `remove` :`{ op: \"remove\", id }`\n  - `reorder` :`{ op: \"reorder\", id, parentId?, newIndex?, beforeId? }`\n  - `setDefs` :`{ op: \"setDefs\", defsSvg }`\n\nAdds, 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.\n\n- `path` (string, required): Target`.pica.svg` file path.\n- `name` (string, required): Keyframes identifier (e.g.`fadeUp` ,`spin` ).\n- `keyframes` (string, optional): CSS keyframe body (e.g.`\"0%{opacity:0}100%{opacity:1}\"` ). Required when creating a new animation.\n- `animations` (array, optional): Target bindings`{ id, durationMs?, delayMs?, easing?, iterations?, direction?, fill?, transformOrigin? }` .\n- `remove` (boolean, default`false` ): Delete the`@keyframes` block and surgically remove only matching entries from comma-separated`animation:` declarations.\n\nUpdates canvas-level properties on an existing `.pica.svg` file and notifies live preview clients.\n\n- `path` (string, required): Target`.pica.svg` file path.\n- `width` (int, optional): Canvas width in pixels.\n- `height` (int, optional): Canvas height in pixels.\n- `background` (string, optional): Canvas background CSS color (syncs`#pica-bg` and`#pica-meta` ).\n- `fps` (number, optional): Frames per second for animated exports.\n- `durationMs` (int, optional): Timeline duration in milliseconds. Sets`baseDurationMs` and recalculates`durationMs` .\n\nRenders a PNG preview and returns an MCP image block plus a short text summary for visual verification.\n\n- `path` (string, required): Input`.pica.svg` file path.\n- `timeMs` (number, default`0` ): Timestamp in milliseconds. Static designs at`timeMs = 0` render via`resvg` . Animated designs (and any`timeMs > 0` ) render via headless Chromium CDP when available, falling back to static`resvg` at`timeMs = 0` if Chromium is absent.\n- `showGrid` (boolean, default`false` ): Overlay a temporary 100px coordinate grid (never saved to disk).\n- `showIds` (boolean, default`false` ): Overlay temporary`#id` bounding boxes and labels (never saved to disk).\n- `scale` (number, default`1` , max`4` ): Render scale factor.\n- `maxWidth` (int, default`1024` , max`8192` ): Caps output PNG width so large canvases do not flood agent context windows.\n\nExports clean assets (debug overlays are always stripped).\n\n- `path` (string, required): Input`.pica.svg` file path.\n- `format` (`\"svg\" | \"png\" | \"jpg\" | \"jpeg\" | \"webp\" | \"mp4\"` , required): Output format.\n- `outPath` (string, required): Destination file path (parent directories are created automatically). Rejects`ffmpeg` flag-like (`-...` ) and protocol (`://` ) paths.\n- `scale` (number, default`1` , max`4` ): Output scale multiplier.\n- `quality` (number, default`90` ,`0-100` ): Compression quality for JPG, WebP, and MP4 (`-crf` mapped, with`+faststart` ).\n- `fps` (number, optional): Override document FPS for animated exports.\n- `animated` (boolean, default`false` ): Set`true` for animated WebP; MP4 is always animated.\n- `timeMs` (number, default`0` ): Static frame timestamp in ms. When`> 0` requires Chromium; animated docs use Chromium at`timeMs` for accurate state even at`0` . Falls back to`resvg` for static docs at`0` .\n\nEvery file is valid standalone SVG with five reserved skeleton elements:\n\n```\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"800\" height=\"600\" viewBox=\"0 0 800 600\">\n  <metadata id=\"pica-meta\">{\"version\":1,\"fps\":30,\"durationMs\":2000,\"background\":\"#ffffff\"}</metadata>\n  <defs id=\"pica-defs\"></defs>\n  <style id=\"pica-anim\"></style>\n  <rect id=\"pica-bg\" width=\"100%\" height=\"100%\" fill=\"#ffffff\"/>\n  <g id=\"pica-root\"></g>\n</svg>\n```\n\nAll 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.\n\nWhen 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.\n\n- Checkerboard artboard with wheel zoom, drag pan, and fit-to-screen.\n- Live WebSocket reload on every `pica_create` ,`pica_patch` ,`pica_animate` , and`pica_configure` while preserving your current zoom and pan across patches.`/ws` upgrades require same-origin (`127.0.0.1` /`localhost` ) or missing`Origin` .\n- Bottom timeline scrubber (Play/Pause + time slider) synced with `document.getAnimations()` .\n\n| Variable | Default | Description | \n|---|---|---|\n| `PICA_PORT` | `4173` | Port for the local Hono live preview server ( `127.0.0.1` ). Falls back to ephemeral`0` when busy. | \n| `PICA_ROOT` | Unset | When set, all `path` /`outPath` inputs must resolve inside this directory tree. | \n| `CHROME_PATH` /`CHROMIUM_PATH` | Auto-detected | Explicit path to a Chromium or Google Chrome executable. | \n| `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. | \n\n```\nbun run typecheck   # Strict TypeScript check (noEmit)\nbun test            # Integration tests (skips Chromium/FFmpeg cases if absent)\nbun run build       # Bundle CLI to ./dist\n```\n\n", "url": "https://wpnews.pro/news/pica-local-2d-vector-design-and-animation-mcp-server-bun-svg-raw-cdp", "canonical_source": "https://github.com/nadeeshafdo/pica", "published_at": "2026-11-28 09:07:23+00:00", "updated_at": "2026-11-28 09:42:40.897631+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "agent-protocols", "generative-ai"], "entities": ["pica", "Bun", "OpenCode", "Claude Code", "Cursor", "@resvg/resvg-js", "ffmpeg", "Chromium"], "also_reported_by": [], "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.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/pica-local-2d-vector-design-and-animation-mcp-server-bun-svg-raw-cdp", "markdown": "https://wpnews.pro/news/pica-local-2d-vector-design-and-animation-mcp-server-bun-svg-raw-cdp.md", "text": "https://wpnews.pro/news/pica-local-2d-vector-design-and-animation-mcp-server-bun-svg-raw-cdp.txt", "jsonld": "https://wpnews.pro/news/pica-local-2d-vector-design-and-animation-mcp-server-bun-svg-raw-cdp.jsonld"}}