Cavalry MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Cavalry MCP Make a 1920x1080 title card with an orange rounded rectangle and render frame 30."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Cavalry MCP
Let Claude and other AI assistants drive Cavalry, the 2D procedural motion-design app, through the Model Context Protocol.
Contents
Related MCP server: ae-mcp
Overview
Cavalry MCP is an MCP server that gives an AI assistant a set of typed, validated tools for Cavalry. You can create layers, set attributes, wire up connections, keyframe with Magic Easing, render PNG previews and save scenes, all in plain language:
"Make a 1920×1080 title card: an orange rounded rectangle that springs in from below over 24 frames, then render frame 30 to my desktop."
Design principles:
Typed tools. Every argument is schema-checked before it reaches Cavalry. Arbitrary code execution is off by default.
Local only. Everything stays on your machine. The bridge binds to
127.0.0.1and makes no outbound network calls.Clear errors. Failures say what went wrong and how to fix it, for example "bridge not running", "layer does not exist" or "port mismatch".
No dependencies inside Cavalry. The bridge is a single plain JavaScript file that uses Cavalry's built-in
api.WebServer.
How it works
┌──────────────┐ stdio (MCP) ┌────────────────────┐ HTTP 127.0.0.1:37650 ┌──────────────────────────┐
│ Claude / MCP │ ────────────▶ │ cavalry-mcp │ ─────────────────────▶ │ cavalry-mcp-bridge.js │
│ client │ ◀──────────── │ (Node.js server) │ ◀───────────────────── │ (runs inside Cavalry) │
└──────────────┘ └────────────────────┘ POST /post, GET /get └──────────────────────────┘The MCP server (
src/) exposes tools to the client over stdio.Each tool call becomes a JSON request
{id, op, args}POSTed to the bridge running inside Cavalry.Cavalry's WebServer cannot reply to a POST directly. The bridge runs the operation through Cavalry's scripting API and publishes the result under the request id, and the server polls
GET /getuntil that result appears.
The wire protocol is documented in docs/protocol.md.
Requirements
Component | Version |
2.7 or later (free for individuals since 2.7, scripting included) | |
22 LTS recommended. The server runs on 18.17+, but | |
MCP client | Claude Desktop, Claude Code, Cursor, or any stdio MCP client |
OS | macOS 12+ or Windows 10+ (the platforms Cavalry supports) |
Cavalry 2.6.1 and earlier only let paid Professional licences run unencrypted scripts, and the bridge is an unencrypted script. Use Cavalry 2.7+.
Installation
1. Build the MCP server
git clone https://github.com/Pinyi333/cavalry-mcp.git
cd cavalry-mcp
npm install # also builds dist/ through the "prepare" scriptOptionally confirm everything works (no Cavalry needed):
npm test2. Install the Cavalry bridge
Copy bridge/cavalry-mcp-bridge.js into Cavalry's Scripts folder. You can also open the folder from inside Cavalry with Help > Scripts.
OS | Scripts folder |
macOS |
|
Windows |
|
3. Start the bridge
In Cavalry, choose Window > Scripts > cavalry-mcp-bridge. A small panel opens showing Listening on 127.0.0.1:37650. Cavalry may ask for permission the first time the script uses its Web APIs; allow it.
The bridge stops when the panel or Cavalry closes. Start it again after each restart.
Connect your MCP client
Replace /ABSOLUTE/PATH/TO/cavalry-mcp with the folder you cloned into. Ready-to-copy files are in examples/.
Edit claude_desktop_config.json:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"cavalry": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/cavalry-mcp/dist/index.js"]
}
}
}Restart Claude Desktop. The Cavalry tools appear in the tools menu.
claude mcp add cavalry -- node /ABSOLUTE/PATH/TO/cavalry-mcp/dist/index.jsOr add a project-level .mcp.json:
{
"mcpServers": {
"cavalry": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/cavalry-mcp/dist/index.js"]
}
}
}Any client that launches stdio MCP servers works. Use node as the command and dist/index.js as the argument, plus any environment variables you need.
Then ask your assistant: "Ping Cavalry." You should get the bridge and Cavalry versions back.
Usage examples
Ask | What happens |
"What's in my current scene?" |
|
"Add a blue circle of radius 120 in the centre." |
|
"Make it bounce in from the top over 20 frames." |
|
"Duplicate 12 circles around a ring." |
|
"Render frame 30 at 50% to ~/Desktop/preview.png." |
|
"Save this as ~/Projects/intro.cv." |
|
More step-by-step demos (with fallbacks) are in examples/demo-prompts.md.
Tips for good results:
If a write is rejected with "has no attribute", the path is wrong. Cavalry would otherwise ignore it silently, so the server checks every path first. Use
cavalry_list_attributesto find the right one. In 2D, rotate withrotation.z.Ask the assistant to render a PNG and look at it after big changes. Clients that can read local files (such as Claude Code) can check their own work.
Attribute paths match Cavalry's Copy Scripting Path (right-click an attribute in the Attribute Editor), for example
position.xorgenerator.dimensions.For multi-step builds, the assistant can use
cavalry_batchto do everything in one round-trip.
Tool reference
Tool | Purpose | Kind |
| Check connectivity and versions | read |
| Scene path, unsaved state, frame, comps, active comp settings | read |
| Move the playhead | edit |
| Play / stop | edit |
| List layers (optionally top-level only or by type) | read |
| Currently selected layers | read |
| Replace the selection | edit |
| Create rectangle / ellipse / star / polygon… with attributes | create |
| Create any layer type (text, null, group, duplicator, material…) | create |
| Duplicate a layer, returning the new ids | create |
| Rename a layer | edit |
| Parent / un-parent a layer | edit |
| Delete layers | destructive |
| List attribute paths (optionally with types and values) | read |
| Read attribute values | read |
| Set attribute values (paths are validated first) | edit |
| Layer bounds for layout and alignment | read |
| Incoming / outgoing connections of a layer | read |
| Add a dynamic attribute (e.g. on JavaScript layers) | create |
| Swap a layer's generator | edit |
| Set / clear an attribute expression | edit |
| Wire attributes together | edit / destructive |
| Keyframe one or more attributes, with Magic Easing | edit |
| Delete keyframes or all animation on an attribute | destructive |
| Render a frame to PNG | create |
| Save / Save As | edit |
| Open a | destructive |
| Run many operations in one round-trip, with | destructive |
| Run arbitrary JavaScript in Cavalry (opt-in, see Security) | destructive |
Resource: cavalry://guide/attributes is a built-in guide to common layer types, attribute paths (rotation.z, shapeScale.x, startFrame, …), Magic Easing names and known gotchas. Clients that support MCP resources can attach it as context.
Batch references: later operations in cavalry_batch can use results from earlier ones. "$0" means the id created by operation 0, and "$1.created.0.id" walks into a result:
[
{ "op": "create_primitive", "args": { "shape": "ellipse", "attributes": { "hidden": true } } },
{ "op": "create_layer", "args": { "type": "duplicator" } },
{ "op": "connect", "args": { "fromLayerId": "$0", "toLayerId": "$1", "toAttrId": "shapes" } },
{ "op": "set_generator", "args": { "layerId": "$1", "type": "circleDistribution" } }
]Magic Easing names: SlowIn, SlowOut, SlowInSlowOut, VerySlowIn, VerySlowOut, VerySlowInVerySlowOut, SpringIn, SpringOut, SpringInSpringOut, SmallSpringIn, SmallSpringOut, SmallSpringInSmallSpringOut, AnticipateIn, OvershootOut, AnticipateInOvershootOut, BounceIn, BounceOut, BounceInBounceOut, Custom (with an expression such as 1 - pow(1 - x, 5)), None.
Configuration
The server reads these environment variables. All are optional.
Variable | Default | Description |
|
| Host the bridge listens on. Keep it on loopback. |
|
| Must match |
|
| Max wait for a single operation (raise it for heavy renders). |
|
| How often the server polls the bridge for results. |
|
| Fail fast with |
|
| Registers |
Pass them through your client config:
{
"mcpServers": {
"cavalry": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/cavalry-mcp/dist/index.js"],
"env": { "CAVALRY_MCP_PORT": "37650", "CAVALRY_MCP_TIMEOUT_MS": "30000" }
}
}
}The bridge has its own settings in the CONFIG block at the top of cavalry-mcp-bridge.js: host, port, allowScript and maxResults.
Security
The bridge has no authentication. Any process on your computer that can reach
127.0.0.1:37650can send it commands. It binds to loopback only, so other machines cannot reach it. Never changeCONFIG.hostto0.0.0.0or a LAN address.Arbitrary JavaScript is disabled on both sides by default. To enable
cavalry_run_scriptyou must setCAVALRY_MCP_ALLOW_SCRIPT=trueandCONFIG.allowScript = truein the bridge. Enable it only while you need it.The project stores no credentials, API keys or telemetry, and needs none.
Stop the bridge (close its panel) when you are not using it.
Report vulnerabilities privately as described in SECURITY.md.
Troubleshooting
Symptom | Fix |
| Cavalry is not running, or the bridge panel isn't open. Run Window > Scripts > cavalry-mcp-bridge. Check that the ports match. |
| Cavalry is in the background or a dialog is open. Bring Cavalry to the front; the request is still queued and runs once Cavalry resumes. |
| The operation took too long. For long renders, raise |
| Another app is using the port. Change |
| Copy the |
| Ids change when layers are deleted or scenes reopen. Ask the assistant to call |
Tools don't appear in Claude | Check that the path in the config is absolute and that |
To debug the server without an AI client, use the MCP Inspector:
npm run inspectorDevelopment
npm install
npm run dev # tsc --watch
npm test # vitest (runs the real bridge against an emulated Cavalry)
npm run check # typecheck + lint + format check + tests (what CI runs)Project layout:
cavalry-mcp/
├── bridge/cavalry-mcp-bridge.js # Runs inside Cavalry (plain ES2017, no dependencies)
├── src/
│ ├── index.ts # CLI entry: config, stdio transport
│ ├── server.ts # Registers tools on the MCP server
│ ├── tools.ts # Declarative tool catalogue (schemas, annotations)
│ ├── guide.ts # cavalry://guide/attributes resource
│ ├── bridge-client.ts # HTTP POST-then-poll client + typed errors
│ └── config.ts # Environment variable parsing
├── test/ # Unit + end-to-end tests with a fake Cavalry api
├── docs/protocol.md # Bridge wire protocol
├── docs/index.html # Landing page (GitHub Pages)
└── examples/ # MCP client config templatesLanding page
The project website lives in docs/ as plain HTML, CSS and JavaScript with GSAP and canvas, no build step. Preview it by opening docs/index.html in a browser, or with any static server (npx serve docs). The Deploy site workflow publishes it on every push to main that touches docs/; enable it once under Settings > Pages > Build and deployment > Source: GitHub Actions.
To replace a demo's animated preview with a recording, put the clip in docs/assets/videos/ and set data-video="assets/videos/demo-1.mp4" (and optionally data-poster) on that demo's .demo__media element in docs/index.html. English copy lives in the HTML; Traditional Chinese strings live in docs/assets/js/i18n.js.
To add a tool: implement the operation in the bridge's ops table, add its definition to src/tools.ts, and cover it in test/bridge.test.ts. See CONTRIBUTING.md.
Roadmap
Render-queue tools (render a composition range to video or image sequence)
Composition management (create comps, set resolution, frame range and fps)
Asset import (images, SVG, Google Sheets / Canva Sheets data)
MCP resources for scene structure, and prompts for common motion recipes
Optional shared-secret token between server and bridge
Contributing
Issues and pull requests are welcome. Please read CONTRIBUTING.md first. The automated tests run against an emulated Cavalry, so reports from real Cavalry sessions, including version, OS and the failing tool call, are especially valuable.
Acknowledgements
These community projects shaped this one, and their ideas are credited here:
ZHUYUFAN3-33/cavalry-mcp: typed tools instead of raw eval, the POST-then-poll protocol with request ids, fail-fast "frozen" detection, bounding box and connection inspection, and community-verified attribute paths (which feed the attribute guide).
kacperchlebowicz/Cavalry-mcp: dynamic attributes, and the reference list of layer types and attribute paths.
matthewobanla/Calvary-MCP: node-graph and render-pipeline workflows (render-queue tools are on the roadmap).
No code was copied; all implementations here are original.
License
MIT © Piny
Cavalry is a product of Canva / Scene Group. This project is an independent community integration and is not affiliated with or endorsed by Canva or Scene Group.
Available Tools
29 toolscavalry_add_dynamic_attributeAdd dynamic attributeA
Add a dynamic attribute to layers that support them (e.g. JavaScript layers). Returns the new array count; use cavalry_list_attributes to find the new attribute path.
Inputs: type (required), layerId (required), attrId.
cavalry_batchBatch operationsADestructive
Run several operations in one round-trip, in order. Stops at the first failure; earlier operations are NOT rolled back. Each item is {"op": "", "args": {...}} where op is the tool name without the "cavalry_" prefix. Reference earlier results with "$" strings: "$0" is the id created by operation 0, "$2.created.0.id" walks into a result. Example: [{"op": "create_primitive", "args": {"shape": "ellipse"}}, {"op": "set_keyframes", "args": {"layerId": "$0", "keyframes": [...]}}].
Inputs: operations (required).
cavalry_connectConnect attributesAIdempotent
Connect an output to an input. A layer's main output is its "id" attribute, e.g. connect shape "id" -> duplicator "shapes", or colorMaterial "id" -> shape "material" with force=true.
Inputs: toAttrId (required), toLayerId (required), fromLayerId (required), force, +1 more.
cavalry_create_layerCreate layerA
Create a layer of any Cavalry type (e.g. "null", "group", "textShape", "duplicator", "colorMaterial", "javaScript") and optionally set attributes in the same call.
Inputs: type (required), name, attributes.
cavalry_create_primitiveCreate primitive shapeA
Create a primitive shape layer (e.g. "rectangle", "ellipse", "star", "polygon") and optionally set attributes in the same call, e.g. {"generator.dimensions": [400, 200], "position": [0, 0], "material.materialColor": "#00c2ff"}.
Inputs: shape (required), name, attributes.
cavalry_delete_keyframesDelete keyframesADestructive
Delete keyframes on an attribute at specific frames, or all of its animation when frames is omitted.
Inputs: attrId (required), layerId (required), frames.
cavalry_delete_layersDelete layersADestructive
Delete one or more layers. Ids that do not exist are reported back instead of failing.
Inputs: layerIds (required).
cavalry_disconnectDisconnect attributesCDestructive
Remove a connection between two attributes.
Inputs: toAttrId (required), toLayerId (required), fromLayerId (required), fromAttrId.
cavalry_duplicate_layerDuplicate layerB
Duplicate a layer. Returns the ids of the newly created layers.
Inputs: layerId (required), withInputConnections.
cavalry_get_attributesGet attributesARead-only
Read the current values of one or more attributes on a layer.
Inputs: attrIds (required), layerId (required).
cavalry_get_bounding_boxGet bounding boxARead-only
Return a layer's bounding box (x, y, width, height, centre, left/right/top/bottom). Use it to lay out, align and check that layers fit inside the composition.
Inputs: layerId (required), worldSpace.
cavalry_get_selectionGet selectionBRead-only
Return the layers currently selected in Cavalry, in hierarchy order.
Inputs: no named parameters.
cavalry_inspect_connectionsInspect connectionsARead-only
List a layer's incoming and outgoing attribute connections, to understand an existing node graph.
Inputs: layerId (required).
cavalry_list_attributesList attributesBRead-only
List every attribute path available on a layer, optionally with data types.
Inputs: layerId (required), includeTypes, includeValues.
cavalry_list_layersList layersARead-only
List layers in the active composition with their id, name, type and parent.
Inputs: type, topLevel.
cavalry_open_sceneOpen sceneADestructive
Open a .cv scene file. Unless force is true, Cavalry may ask the user about unsaved changes in the current scene.
Inputs: filePath (required), force.
cavalry_pingPing CavalryARead-only
Check that Cavalry is running and the bridge is reachable. Returns bridge and Cavalry versions.
Inputs: no named parameters.
cavalry_playbackPlay / stopBIdempotent
Start or stop playback in the viewport.
Inputs: action (required).
cavalry_rename_layerRename layerBIdempotent
Change a layer's display name.
Inputs: name (required), layerId (required).
cavalry_render_pngRender PNG frameA
Render the active composition to a PNG file on the local machine (useful for checking your work visually). Use an absolute path; the .png extension is added automatically.
Inputs: filePath (required), frame, scalePercent.
cavalry_save_sceneSave sceneAIdempotent
Save the scene in place, or to a new .cv path when filePath is given.
Inputs: filePath.
cavalry_scene_infoScene infoARead-only
Describe the open scene: file path, unsaved state, current frame, compositions, and the active composition's resolution / frame range / fps when available. Call this first to orient yourself.
Inputs: no named parameters.
cavalry_selectSelect layersBIdempotent
Replace the current selection with the given layers.
Inputs: layerIds (required).
cavalry_set_attributesSet attributesAIdempotent
Set one or more attribute values on a layer at the current frame (does not create keyframes). Every path is checked first, because Cavalry silently ignores writes to unknown paths. In 2D, rotate with "rotation.z".
Inputs: layerId (required), attributes (required), skipValidation.
cavalry_set_expressionSet expressionBIdempotent
Set (or clear, with an empty string) a JavaScript expression on an attribute.
Inputs: attrId (required), layerId (required), expression (required).
cavalry_set_frameSet frameAIdempotent
Move the playhead of the active composition to a frame.
Inputs: frame (required).
cavalry_set_generatorSet generatorBIdempotent
Swap the generator on a layer, e.g. set a Duplicator's "generator" to "circleDistribution" or a Basic Shape's to "ellipse".
Inputs: type (required), layerId (required), attrId.
cavalry_set_keyframesSet keyframesBIdempotent
Create keyframes on a layer. Each keyframe sets one or more attribute values at a frame and can apply a Magic Easing to the keyframes it creates. Example: [{"frame": 0, "values": {"position.x": -300}, "easing": "SlowOut"}, {"frame": 30, "values": {"position.x": 300}}].
Inputs: layerId (required), keyframes (required).
cavalry_set_parentSet parentAIdempotent
Parent a layer under another layer (e.g. a group), or pass parentId null to un-parent it.
Inputs: layerId (required), parentId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 29 tools
Each tool targets a distinct resource and action, with clear separation between attribute reads (get_attributes), path discovery (list_attributes), and writes (set_attributes vs set_keyframes). The only minor overlap is create_layer vs create_primitive, since primitives are a subset of layers, but the descriptions make the boundary reasonably clear.
Every tool uses the same cavalry_ prefix followed by a consistent verb_noun pattern (e.g. cavalry_set_attributes, cavalry_delete_layers, cavalry_create_layer). No mixed casing or verb-style deviations.
With 29 tools the surface is on the heavy side, and several could be folded together (e.g. create_primitive into create_layer). However, the domain—scene, layer, attribute, keyframe, and connection management for a motion graphics app—genuinely needs broad coverage, so it is borderline rather than excessive.
The set covers layer lifecycle (create/duplicate/rename/delete), attributes, keyframes, connections, parenting, selection, scene open/save, playback, frame control, and rendering. Minor gaps exist, such as creating a fresh scene or exporting video/image sequences, but core workflows are fully supported.
Related MCP Connectors
One sentence to a finished animation: your AI writes motion graphics as code and checks real frames.
Build and run visual creative-production workflows from your AI agent.
AI editor to build, animate & export layered short-form video projects via one tool catalog.
Video production studio for AI agents: AI media, motion graphics as code, timeline and export.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to control Adobe After Effects to create videos programmatically, with commands for comps, layers, effects, and rendering.9 npm28MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to operate Adobe After Effects with the dexterity of an editor: reading projects, creating and rigging layers, setting real velocity curves, animating text, building native SVG-based shapes, applying effects, expressions, masks, and viewing render snapshots to verify results.1718 npm1MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients like Claude Code, Claude Desktop, and VS Code to build and edit inside a running Adobe After Effects, covering comps, layers, keyframes, effects, text animators, markers, and renders. It supports batched tool calls with single-step undo, frame previews for self-verification, reusable style tokens, and four one-call studio rigs.1MIT
- AlicenseAqualityBmaintenanceLets AI agents drive a running Adobe After Effects (~270 undo-safe operations). Works with every UI language Adobe ships and sees the frame: draws Object Matte on what it sees (lassos, ⊕/⊖ points, a preview of gaps and people) and syncs AI-generated layers with the plate frame by frame. A large skills library, built for AI and generative features: Roto Brush, Object Matte, Content-Aware Fill.13343 npm6Apache 2.0