Skip to main content
Glama

stykanimate-mcp

A production-ready Model Context Protocol (MCP) server built in TypeScript/Node.js that interfaces with the open-source StykAnimate stick figure animation engine.

stykanimate-mcp allows LLMs and AI coding assistants to programmatically create, rig, animate, import, and export stick figure animations over the standard MCP stdio transport.


Features

  • Headless & Loosely Coupled: Operates completely in a headless Node.js context without requiring Electron, WebGPU, or browser display layers.

  • Authoritative StykAnimate Document Model: Conforms directly to the StykAnimate v5 specification (canvas_width, canvas_height, fps, figure_types, keyframes, layers, layerSheet).

  • Kinematic & Mathematical Rigging: Supports Forward Kinematics (FK), Analytical 2-Bone Inverse Kinematics (IK), and StykAnimate joint constraints (connector, stretch, follow).

  • Algorithmic Motion Sequences: Generates smooth animation loops from mathematical expressions (sine/cosine waves for walking, running, breathing) or interpolates between keyframes with shortest-angle angular difference logic.

  • Legacy Asset Bridge: Parses native Pivot .stk figure files, .piv animation projects, and Stick Nodes .nodes formats.

  • Multi-Format Compilation: Compiles projects into native .styk binary v1 containers (56-byte header with SHA-256 and zlib) or formatted .stykanimate / .json project files.

  • Clean MCP stdio Protocol: Sends error and diagnostic logs exclusively to stderr, keeping stdout completely clean for JSON-RPC messages.


Related MCP server: Cascadeur MCP

Installation

Prerequisites

  • Node.js 22.0.0 or higher

  • npm

Build from Source

git clone https://github.com/jitendrakumar025/stykanimate-mcp.git
cd stykanimate-mcp
npm install
npm run build

To run the automated test suite:

npm test

To link the binary globally:

npm link

MCP Client Configuration

Add stykanimate-mcp to your MCP client configuration (such as Claude Desktop, Claude Code, Cursor, or Antigravity):

Works out-of-the-box in any MCP client without manual path setup:

{
  "mcpServers": {
    "stykanimate": {
      "command": "npx",
      "args": ["-y", "stykanimate-mcp"]
    }
  }
}

Antigravity (Global & Project Plugin)

Global Configuration

Add to ~/.gemini/config/mcp_config.json:

{
  "mcpServers": {
    "stykanimate": {
      "command": "npx",
      "args": ["-y", "stykanimate-mcp"]
    }
  }
}

(Or for local development: "command": "node", "args": ["<path-to-repo>/dist/index.js"])

Project Plugin (.agents/plugins/)

Place within .agents/plugins/stykanimate/:

  • plugin.json:

    {
      "name": "stykanimate",
      "description": "StykAnimate animation engine MCP plugin"
    }
  • mcp_config.json:

    {
      "mcpServers": {
        "stykanimate": {
          "command": "node",
          "args": ["./dist/index.js"]
        }
      }
    }

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "stykanimate": {
      "command": "npx",
      "args": ["-y", "stykanimate-mcp"]
    }
  }
}

Or for local development from source:

{
  "mcpServers": {
    "stykanimate": {
      "command": "node",
      "args": ["<path-to-repo>/dist/index.js"]
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "stykanimate": {
      "command": "stykanimate-mcp"
    }
  }
}

Core MCP Tools

1. create_animation_project

Initializes a new StykAnimate project context mirroring the application's document model.

  • Inputs:

    • canvasWidth (number, optional, default: 960): Canvas width in pixels (1–100000).

    • canvasHeight (number, optional, default: 540): Canvas height in pixels (1–100000).

    • fps (number, optional, default: 24): Target playback frame rate (1–1000).

    • projectName (string, optional, default: "Untitled animation"): Project title.

    • preset ("blue" | "walker" | "empty", optional, default: "blue"):

      • "blue": The official StykAnimate startup figure with 10 segments and 4 IK chains (hands and feet).

      • "walker": The classic Pivot stickman figure.

      • "empty": Blank project ready for custom figure creation.

    • defaultDuration (number, optional, default: 10): Initial hold duration in timeline ticks.

2. define_stick_rig

Defines a custom stick figure rig/skeleton configuration mapping bones, segments, fixed-length joints, and IK controller targets.

  • Inputs:

    • name (string, required): Rig name (e.g., "StickNinja").

    • nodes (array of objects, required):

      • id (integer, 1-based, unique): Segment identifier.

      • parentId (integer, 0 for root): Parent segment ID.

      • name (string, optional): Bone label (e.g., "Torso", "Right forearm").

      • length (number, optional): Bone length in pixels.

      • angleRad (number, optional): Default rotation angle in radians.

      • angleDeg (number, optional): Default rotation angle in degrees.

      • x, y (numbers, optional): End coordinate relative to parent (auto-computes length & angle).

      • thickness (number, optional, default: 12): Stroke thickness or circle radius.

      • primitive ("line" | "circle" | "circleFill" | "circleClear" | "squareLine", optional).

      • color ([r, g, b], optional, default: [13, 153, 255]).

      • constraints (object, optional): StykAnimate connector, stretch, or follow constraints.

      • ik (object, optional): IK controller properties (enabled, chainLength, bendDirection, targetX, targetY).

    • rootX, rootY (numbers, optional): Initial root placement on canvas.

    • scale (number, optional, default: 1.0): Figure scale.

    • addToProject (boolean, optional, default: true): Inject into active session.

3. generate_motion_sequence

Accepts keyframes or mathematical expressions to automatically compute absolute and relative joint rotation changes across frames.

  • Inputs:

    • mode ("preset" | "expression" | "keyframes", required):

      • "preset": Built-in cycles:

        • Mobility: "walk_loop", "run_loop", "idle_breathe", "wave_hand", "jumping_jacks"

        • Action & Combat: "punch_combo", "sword_slash", "spin_kick", "backflip", "dash_dodge"

      • "expression": Mathematical formulas evaluated over time (t, phase, frame, fps).

      • "keyframes": Smooth interpolation between sparse keyframe poses with shortest-angle easing.

    • frameCount (number, optional, default: 24): Number of timeline frames.

    • durationPerFrame (number, optional, default: 1): Exposure duration per frame.

    • expressions (object, optional):

      • rootX: e.g., "baseX + Math.sin(phase) * 10"

      • rootY: e.g., "baseY - Math.abs(Math.sin(phase * 2)) * 8"

      • jointExpressions: map of segment names/IDs to math expressions (e.g., {"Left arm": "baseAngle + sin(phase) * 0.6"}).

    • keyframes (array of objects, optional): Authored poses at specific frameIndex positions.

    • easing ("linear" | "ease_in" | "ease_out" | "ease_in_out", optional).

    • injectIntoDocument (boolean, optional, default: true).

4. add_figure_instance

Places a new instance of an existing figure type or preset prop (e.g., broadsword, round shield, enemy fighter) into the animation scene across all keyframes.

  • Inputs:

    • figureTypeId (integer, optional): Figure type ID to instantiate.

    • preset ("blue" | "walker" | "sword" | "shield", optional): Spawn a preset prop or character.

    • rootX, rootY (numbers, optional): Canvas position coordinates.

    • scale (number, optional, default: 1.0): Scale factor.

    • colorRgb ([r, g, b], optional): Color override tint.

    • transparency (integer 0–255, optional): Transparency level.

5. add_visual_effect

Injects dynamic action visual effects (impact bursts, blade slash arcs, screen shake) into specific timeline frames for high-impact production visuals.

  • Inputs:

    • effectType ("impact_burst" | "slash_arc" | "camera_shake", required).

    • targetX, targetY (numbers, optional): Canvas coordinates for the effect.

    • startFrame (integer, optional, default: 0): Beginning frame index (0-based).

    • durationFrames (integer, optional, default: 4): Active frame length.

    • scale (number, optional, default: 1.0): Effect scale.

    • colorRgb ([r, g, b], optional): Effect color.

    • intensity (number, optional, default: 8): Amplitude for camera shake.

6. import_legacy_asset

Bridges to the parsing layer to read standard Pivot .stk, .piv, and Stick Nodes .nodes data files.

  • Inputs:

    • filePath (string, required): Absolute or relative path to the asset file.

    • figureName (string, optional): Override label for the imported figure.

    • format ("auto" | "stk" | "piv" | "nodes", optional, default: "auto").

    • addToProject (boolean, optional, default: true).

7. compile_and_save_project

Bundles the accumulated project state, frames, rigs, and layers into a native project container (.styk) or .stykanimate / .json file.

  • Inputs:

    • outputPath (string, required): Destination file path (e.g., "./project.stykanimate" or "./scene.styk").

    • format ("auto" | "json" | "styk-container", optional, default: "auto").

    • pretty (boolean, optional, default: true).

8. render_and_export_media

Renders and exports production-ready visual media files directly from the timeline without requiring external editors or GUI tools.

  • Inputs:

    • outputPath (string, required): Target destination file or folder (e.g., "./battle.mp4", "./anim.gif", "./player.html", "./frames").

    • format ("mp4" | "gif" | "webm" | "svg" | "animated-svg" | "png-sequence" | "svg-sequence" | "html-player", required):

      • "mp4": High-definition H.264 video with faststart streaming (via FFmpeg).

      • "gif": High-quality animated GIF with 2-pass Bayer palette generation (via FFmpeg).

      • "webm": Web-optimized VP9 video (via FFmpeg).

      • "html-player": Self-contained interactive 60fps HTML5 player with timeline scrubber and speed controls.

      • "animated-svg": Standalone self-playing vector animation using CSS keyframes.

      • "svg": Crisp vector rendering of a specific keyframe.

      • "png-sequence": Folder of crisp raster PNG frames rendered at full canvas resolution.

      • "svg-sequence": Folder of individual SVG vector frames.

    • fps (number, optional): Playback frame rate (defaults to document fps).

    • width, height (numbers, optional): Custom resolution overrides.

    • loop (boolean, optional, default: true): Video/GIF loop setting.

    • frameIndex (number, optional, default: 0): Single frame index to export for format "svg".

    • outputPath (string, required): Output file path (e.g. ./scene.stykanimate or ./project.styk).

    • format ("auto" | "json" | "styk-container", optional, default: "auto"):

      • "json": Valid StykAnimate v5 JSON project.

      • "styk-container": Compressed v1 native container with 56-byte header and SHA-256 checksum.

    • pretty (boolean, optional, default: true): 2-space indented JSON formatting.


Example Workflow

An LLM can interact with the server through a simple workflow:

// 1. Initialize project
callTool("create_animation_project", { "preset": "blue", "fps": 24 })

// 2. Animate a walking cycle
callTool("generate_motion_sequence", {
  "mode": "preset",
  "preset": "walk_loop",
  "frameCount": 24
})

// 3. Save the project file
callTool("compile_and_save_project", {
  "outputPath": "C:/Animations/walking_blue.stykanimate"
})

License

MIT

Available Tools

8 tools
add_figure_instanceB

Places a new instance of an existing figure type or preset prop (e.g., broadsword, round shield, enemy stickman) into the animation scene across all keyframes.

Inputs: rootX, rootY, scale, preset, +3 more.

add_visual_effectC

Injects dynamic action visual effects (impact bursts, sword slash arcs, screen shake) into specific timeline frames to create high-impact, production-level visuals.

Inputs: effectType (required), scale, targetX, targetY, +4 more.

compile_and_save_projectC

Bundles the accumulated project state, frames, rigs, and layers into a final .stykanimate or valid project JSON string, writing it cleanly to a local path specified by the user.

Inputs: outputPath (required), format, pretty.

create_animation_projectB

Initializes a brand new StykAnimate project context (canvas dimensions, target FPS, empty frame timeline, default layers). Returns the raw initialization object mirroring StykAnimate's document model.

Inputs: fps, preset, canvasWidth, projectName, +2 more.

define_stick_rigC

Defines a custom stick figure rig/skeleton configuration mapping bones, segments, fixed-length joints, and interpolation properties (like Inverse Kinematics targets).

Inputs: name (required), nodes (required), rootX, rootY, +3 more.

generate_motion_sequenceA

Accepts keyframes or mathematical expressions (e.g., sine waves for walking/running loops) to automatically compute absolute/relative joint rotation changes across a specified number of frames. Returns an array of calculated timeline frames injected into the document model state.

Inputs: mode (required), easing, preset, keyframes, +5 more.

import_legacy_assetB

Bridges the LLM to the codebase parsing layer to read standard .piv or .stk data types. Returns extracted structural configurations converted into a StykAnimate-native schema format.

Inputs: filePath (required), format, figureName, addToProject.

render_and_export_mediaA

Renders and exports the active stick figure animation to visual media formats: "mp4" (H.264 video), "gif" (palette-optimized animated GIF), "webm" (VP9 video), "svg" (single frame vector), "animated-svg" (standalone self-playing vector), "png-sequence" (folder of crisp PNG frames), "svg-sequence" (folder of SVGs), or "html-player" (interactive standalone 60fps web player with timeline scrubber controls).

Inputs: format (required), outputPath (required), fps, loop, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct phase of the animation workflow: project setup, rig definition, motion generation, legacy import, effects, figure instancing, saving, and rendering. The closest pairs (define_stick_rig vs import_legacy_asset, add_visual_effect vs add_figure_instance) are clearly separated by their descriptions.

    Naming Consistency4/5

    All names use snake_case with an action-first verb_noun pattern, which is highly predictable. The only minor deviations are compound verbs in compile_and_save_project and render_and_export_media, but these remain natural and readable.

    Tool Count5/5

    Eight tools is well-scoped for a stick-figure animation server. Each tool covers a meaningful pipeline stage, and there is no obvious redundancy or filler.

    Completeness3/5

    The surface covers creation, motion, effects, instancing, saving, and exporting, but lacks operations for editing or removing existing figures, effects, and keyframes. It also has no explicit tool for loading/opening an existing project, only creating new projects and saving them.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI clients to control Cascadeur locally for scene and rig inspection, body and finger animation, keyframes, physics actions, camera control, PNG previews, and FBX import/export via stdio MCP.
      36
      10
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI assistants to open, inspect, and edit StykAnimate and Pivot stick figure animation projects — reading rigs and timelines, evaluating poses at any frame, and transforming figures, keyframes, layers, and colors without a browser or GPU. Changes are undoable and projects can be saved or exported back to StykAnimate or Pivot formats.
      26
      2
      GPL 3.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables an AI assistant to turn a plain scene description into a stick-figure animation — complete with walks, props, poses, physics-timed arcs and audio — and export it as MP4, WebM or GIF, or save it as an editable project file. Frames are rendered headlessly by the real animation app, so output matches the app's own exporter.
      8
      3
      GPL 3.0