Skip to main content

An MCP server for creating svg animations.

Project description

MCP SVG Animator

An MCP server for creating animated SVG diagrams. You can create a diagram from text input, photos of sketches and YAML specifications.

You don't normally need to use YAML; just tell Claude code what you want, upload photos of sketches, and then iterate until you've got what you want.

You can see some sample inputs and outputs on the Demo Page

File Output Configuration

By default, the MCP server does not allow writing files to your filesystem. To enable file output (SVG, PNG, or video), create a configuration file at ~/.config/mcp-svg-animator/config.yaml:

file_output:
  allowed:
    - path: "~/diagrams"
      types: [svg, png, webm]
    - path: "/tmp/svg-animator/**"
      types: [svg, png]
    - path: "~/projects/**/output"
      types: [svg, png, webm]

Configuration options:

  • path: Directory where files can be written. Supports ~ expansion and glob patterns (* for single level, ** for recursive).
  • types: List of allowed file types (svg, png, webm).

Files in subdirectories of allowed paths are also permitted.

Features

  • Create and iterate on your requirements using natural language and/or rough diagrams
  • Multiple shape types - circle, rectangle, line, text, path, ellipse, group
  • Path segments - Build curves with move_to, line_to, cubic_bezier, quadratic_bezier, arc
  • SMIL animations - Animate attributes and transforms
  • Reusable definitions - Define once, use many times
  • Library imports - Share definitions across diagrams
  • Relative positioning - Reference other elements' positions
  • Direct file output - Write SVG directly to file, reducing token usage
  • PNG export - Generate PNG previews of static diagrams
  • Video export - Record animations to .webm video

Installation

pip install mcp-svg-animator

# Install Playwright browsers (for video generation)
playwright install chromium

Usage with Claude Code

Register the MCP server globally:

claude mcp add --scope user svg-animator -- python -m mcp_svg_animator

Then in any Claude Code session, ask Claude code to create animations:

"Create an animated SVG of a red circle that pulses"

See docs/usage.md for more details.

MCP Tools

You don't need to explicitly invoke these. Ask Claude Code to create the animation you describe, and it will invoke the relevant tools.

Tool Description
create_svg_from_yaml Generate SVG from YAML specification. Optional output_path writes SVG to file; optional png_path generates a PNG preview.
create_animation_video Record SVG animation to .webm video

Development

# Clone the repository
git clone https://github.com/romilly/mcp-svg-animator.git
cd mcp-svg-animator

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt
pip install -r requirements-test.txt

# Install Playwright browsers (for video generation)
playwright install chromium

# Run tests
pytest

# Type checking
pyright src/

Examples

See the examples/ directory for sample YAML files and generated SVGs:

  • demo.yaml - Basic shapes
  • stick_figure.yaml - Static stick figure
  • stick_figure_waving.yaml - Animated waving
  • curves.yaml - Bezier curves and arcs
  • meeting.yaml - Two figures, one walks to meet the other

Acknowledgments

This project uses the following open source packages:

  • MCP - Model Context Protocol SDK (MIT)
  • Pydantic - Data validation (MIT)
  • drawsvg - SVG generation (MIT)
  • PyYAML - YAML parsing (MIT)
  • Playwright - Video recording (Apache 2.0)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_svg_animator-0.3.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_svg_animator-0.3.0-py2.py3-none-any.whl (21.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mcp_svg_animator-0.3.0.tar.gz.

File metadata

  • Download URL: mcp_svg_animator-0.3.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mcp_svg_animator-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f47d75d9a970655d23672389228e4725c32ee47a2342ad7eaa9c49f96c732eda
MD5 08d8d8c9a540579041c4652c1078907d
BLAKE2b-256 a3727b6d195a7f141ffeb83e5c89bff700bf3e1c1cba4433fc7c0402ea31636c

See more details on using hashes here.

File details

Details for the file mcp_svg_animator-0.3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_svg_animator-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4a3e0cec032a8616d4eae9a21879b2ffd4463133b4d8764bb6f36e5735034de9
MD5 fa50654ef4d857de900bc926cd940950
BLAKE2b-256 a89a1269bd4fcaa060d0f3f069dff5ab27c2c5901ddc203614d27b82157947a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page