Skip to main content

pac-vector

Local stdio MCP server: an SVG editor and Lottie animator over in-memory virtual documents (one per "window", like Inkscape), with a live browser preview of every edit.

  • Content goes in as SVG markup; structure (layers, groups, masks, z-order) has typed tools.
  • Animation documents turn finished SVG artwork into Lottie — or open existing Lottie files (.json / .lottie) with every layer intact: keyframes or presets per layer, parenting, track mattes, frame renders for the agent, .json / animated .gif export, and a player with a timeline.
  • Layers are real Inkscape layers, so exported files open in Inkscape with layers intact.
  • Path booleans (union, difference, intersection, exclusion, division) via Skia PathOps.
  • Every edit is atomic (a failed call changes nothing), one undo/redo step, and autosaved: windows of a crashed session reopen in the next one.
  • render returns a PNG the agent can look at: SVG through resvg, animation frames through rlottie, a real Lottie renderer (no browser, no Cairo).

Install

Same shape as pac-pincers: a pip package, run as a module by whatever Python it was installed into.

python -m pip install --upgrade pac-vector
claude mcp add pac-vector --scope user -- python -m pac_vector

As a plugin .mcp.json entry (mirrors the datatopia plugin's pac-pincers entry):

"pac-vector": {
  "type": "stdio",
  "command": "${PAC_VECTOR_PYTHON:-python}",
  "args": ["-m", "pac_vector"],
  "env": {}
}

Development:

python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"
.\.venv\Scripts\python.exe run_tests.py -q
.\.venv\Scripts\python.exe -m build          # dist/pac_vector-<ver>.tar.gz + .whl

Tools (22)

Group Tools
Documents doc_create (svg: blank, file, markup, duplicate · anim: from SVG artwork or a Lottie file), doc_list, doc_set (size, background; svg: units, viewBox, fit; anim: fps, duration), doc_export (svg/png; anim: Lottie .json, animated .gif / .webp / .apng, or one frame), doc_close
Reading inspect (svg outline or xml; anim layers + keyframes), render (svg PNG, crop to ids + bbox; anim: a frame or a strip of frames)
Editing add (markup → layer/group, defs auto-routed; SMIL animations into any element), update (svg: attrs/style/text/transform/label/hidden/locked/text-on-path · anim: layer in/out, static transform, parent, name, hidden), replace, remove, arrange (z-order, move, duplicate, offset), import_svg (file / other window / markup → editable group or image; anim: new layers from SVG artwork or a Lottie, with a start time)
Structure group (also new layers; anim: a parent null — camera / rig), ungroup, mask (mask or clip from id or markup; anim: track matte from a layer, inverted too), unmask
Geometry boolean (union, difference, intersection, exclusion, division), align (align edges/centers, distribute evenly or by gap; relative to selection, page, first, last or an element)
Animation animate (keyframes for position, anchor, scale, rotation, opacity, trim start/end/offset, fill/stroke colour, stroke width — or presets: fade, pop, slide, draw on/off, spin, pulse, shake — with per-layer stagger)
History undo, redo

Animation documents (Lottie)

doc_create(kind="anim", source=<svg doc id | .svg path | markup>, duration="3s", fps=30, split="elements")
animate(doc, layers=["disc"], preset={"name": "pop_in", "start": 0, "duration": "0.8s"})
animate(doc, layers=["ring", "check"], preset={"name": "draw_on", "start": "0.3s"}, stagger="0.4s")
animate(doc, layers=["disc"], property="rotation", keyframes=[{"t": 30, "value": 0}, {"t": "2s", "value": 90, "ease": "back"}])
render(doc, frames=[0, 15, 45, 89])          # look at frames
doc_export(doc, path="intro.json")            # Lottie
doc_export(doc, path="intro.gif", fps=25, scale=0.667, loop=1)   # animated GIF, plays once (e.g. Google Slides)
  • Animated exports: .gif, .webp, .apng. Frames are sampled at the export's own fps (fractional document frames), runs of identical frames become one longer frame (an opening hold costs one frame), and delays are exact — GIF counts centiseconds, so 30 fps alternates 3/4 cs. loop is a play count: 0 = forever, 1 = once and stop on the last frame, n = n times. GIFs get one shared palette of the most used exact colours (flat colours never shift) and the background painted in (document background, else white); WebP / APNG can stay transparent. MP4 / WebM are not supported (they would need ffmpeg).

  • Each element of the artwork becomes a layer (split: elements / layers / single). Shapes are baked to paths in composition pixels with their paint resolved; anchor and position start at the artwork's centre, so scale and rotation pivot there.

  • Times are frames (12, "12f") or seconds ("0.4s"). A keyframe's ease shapes the segment that starts at it: linear, ease*, smooth, snap, back, back-in, anticipate, hold or a [x1, y1, x2, y2] cubic-bezier.

  • From SVG artwork, not carried over (reported on import): text (convert to paths first), images, <use>, clip paths and masks. Gradients become their average colour.

  • Lottie files: doc_create(kind="anim", source="hero.json") (or a .lottie, Lottie JSON text, another animation's id) opens one with its size, fps and length; import_svg(doc, source="spinner.lottie", start="1s", x=…, y=…, width=…) adds one to an animation, retimed to its fps. Layers are kept as their JSON — shapes, path morphs, gradients, masks, precomps, images (embedded), effects, expressions all export and play as they came — and pac-vector's edits go on top: keyframes / presets (they replace that property's own animation), in/out, parent, track mattes, hiding, copies. split="single" wraps the whole file in one precomp layer instead; a box placement with each layer adds a parent null that carries it. Re-opening a pac-vector export gives the same document back.

  • Parenting: update(attrs={"parent": "camera"}), or group(doc, ids=[…], label="camera") for a new null at the composition centre — animate its scale / position to zoom or pan everything under it (opacity isn't inherited). ungroup releases them.

  • Track mattes: mask(doc, targets=["bones"], source="screen", kind="clip") — the source layer's artwork, following its own keyframes, decides where the targets show (a moving layer is a moving window). kind="clip" / mode="alpha" = alpha matte, mode="luminance" = luma matte, invert=true hides the targets inside the source instead. One source can matte several layers (exported as one Lottie matte copy per target); hide the source with update(hidden=true) if it should only act as the window. unmask removes a matte.

  • render, .png frames and animated exports are drawn by rlottie from the exported JSON, so they show what a Lottie player shows (expressions aren't evaluated). A frame exports as .svg only from drawn (SVG-imported) layers. The browser preview plays the same JSON with lottie-web.

Preview

doc_create / doc_list / inspect print the preview URL (/#<doc> for SVG, /anim#<doc> for animations). The SVG page has a tab per document, outlines the elements each edit touched, and shows (and copies) the id of anything you click. The animation page plays the Lottie with lottie-web (loaded from cdnjs): play/pause, frame step, loop, speed, a range bar to loop a section (handles, drag, I/O keys), one track per layer with its animated properties and clickable keyframes, and a fullscreen toggle (F) that leaves only the stage and the transport. The server lives inside the MCP process: it starts on the first doc_create and dies with the session.

Environment

Variable Default Meaning
PAC_VECTOR_PORT 0 (random) Pin the preview port (falls back to random if busy)
PAC_VECTOR_OPEN_BROWSER off 1 opens the preview in the default browser on first start
PAC_VECTOR_ROOT server cwd Base directory for relative export/import paths
PAC_VECTOR_LOG WARNING Log level (stderr only)
PAC_VECTOR_AUTOSAVE on 0 disables the crash-recovery mirror
PAC_VECTOR_AUTOSAVE_DIR <tmp>/pac-vector-autosave Where the mirror lives (<pid>/<doc>.svg + .json)

Notes

  • stdout is the JSON-RPC pipe: nothing may print to it. tests/test_stdout_safety.py scans the package for print() / sys.stdout, and tests/test_stdio.py runs a real session.
  • Native modules (resvg, skia-pathops, rlottie) are loaded before the stdio loop starts (render.warm): on Windows a first native load from inside the FastMCP loop can hang (see pac-pincers' _excel.py). rlottie comes from rlottie-python (LGPL-2.1, a shared library loaded through ctypes).
  • Bounding boxes are measured from pixels (two-pass render), so they include strokes and filters and work for text and curves; content further than two page-widths off-canvas isn't found. align uses them, so it aligns what you see.
  • Booleans use fill geometry only (strokes, text and images don't take part); the result is a <path> in the bottom operand's place, styled like it, keeping its id.
  • Animations are SMIL: the browser preview plays them; render / PNG export show the static first frame.
  • Version lives only in pyproject.toml; a release is a commit named after the version.

Metadata

Release files for pac-vector 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pac-vector 0.5.0
File Size Uploaded Provenance Actions
pac_vector-0.5.0.tar.gz 105.9 kB Without provenance Details for pac_vector-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pac-vector 0.5.0
File Interpreter ABI Platform Actions
pac_vector-0.5.0-py3-none-any.whl Python 3 none any Details for pac_vector-0.5.0-py3-none-any.whl

Total release size: 200.2 kB

Release files / pac_vector-0.5.0.tar.gz

Download URL pac_vector-0.5.0.tar.gz
Size 105.9 kB
Tags Source
SHA-256 checksum
How to use checksums
63089778cccf056ac1ddcd6a71cb6f1a77b02e72a5122ef272955f2f56cd08cf
BLAKE2b-256 checksum
How to use checksums
df755f6246e35fbaaac1a1d2c2b3558a2aa2db7aaa517ee6e60b93f178af46da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / pac_vector-0.5.0-py3-none-any.whl

Download URL pac_vector-0.5.0-py3-none-any.whl
Size 94.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d31ff093600a9100c48d1f0be51ccd5f3527eca268e9cc2acbf4e9b95428113
BLAKE2b-256 checksum
How to use checksums
981343eb4983588a3612d2b0c70bb5e05eb7d666d561ecd6e6dc0a5ed85fe6c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for pac-vector 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page