Live Sync

Live sync connects an MCP server process to an ASCII Motion editor tab, so changes your AI assistant makes appear in the open project. This page explains how the connection works, how to confirm it, how to work with the editor safely, and how to fix common problems.

How the connection works

text
AI client (Copilot app, CLI, VS Code, Claude, …)
   │  stdio — the client starts and owns the server process
   ▼
ascii-motion-mcp --live --port 9876      ← one process, one auth token
   │  WebSocket on 127.0.0.1:9876 (token required, bridge v3)
   ▼
ASCII Motion editor tab  (☰ → MCP Connection)
  • Your AI client starts the server for you from its MCP configuration. Do not also run npx ascii-motion-mcp --live in a terminal: that starts a second server with a different token, and the browser would connect to the wrong one, or fail with a port conflict.
  • The server listens on 127.0.0.1 (loopback) only. The browser must run on the same computer as the MCP server.
  • A new random auth token is generated every time the server starts. If your client restarts the server, reconnect the browser with the new token.
  • The editor is the source of truth. It validates and applies every change through its own undo history, then acknowledges it with the document ID and a new revision number. A connected tool never silently edits a separate copy of the project held by the server.

Version compatibility

ASCII Motion appMCP serverNotes
2.2.6 or later, including ascii-motion.appascii-motion-mcp@3 (3.0.0)Bridge v3, protocol 3. These docs describe this pairing.
Earlier than 2.2.6ascii-motion-mcp@2.3.0 (legacy)The older bridge. Many layer, timeline, selection and effect tools report success without changing the browser project.

Version 3 needs Node.js 22 or 24. If you connect a 3.0.0 server to an older app build, canonical operations return UNSUPPORTED with "Connect an ASCII Motion app with bridge v3 support". Update the app, or use ascii-motion-mcp@2.3.0 with it.

Connect the editor

  1. Configure the server in your client with --live (see the setup guides).

  2. Start a chat that can use the ascii-motion server, and ask:

    text
    Call get_auth_token and get_connection_status for ascii-motion.

    The response includes the token and the port this exact server instance is using.

  3. Open ASCII Motion in a desktop browser on the same computer.

  4. Open the ☰ menu and choose MCP Connection.

  5. Paste the token into Auth Token, check that Port matches (default 9876), and click Connect.

  6. The status changes to Connected, and Commands received counts tool calls as they arrive.

Get the token from the same server

Version 3 doesn't print the token in its logs. Always get it with get_auth_token in the same client session that started the server.

Verify the connection

Ask the assistant to call get_capabilities. A connected 3.0.0 server and a current app report:

json
{
  "capabilities": {
    "protocol": "ascii-motion-bridge",
    "protocolVersion": 3,
    "contractVersion": "3.0.0",
    "contractHash": "e76f9c34204f3d25b99d22a97a3ad531022d75e20e0df847c6e15d674a8302de",
    "documentId": "doc-…",
    "revision": 12,
    "operations": ["add_content_frame", "add_effect", "…"],
    "unavailable": [
      { "op": "list_cloud_projects", "code": "AUTH_REQUIRED", "reason": "Sign in to Ascii Motion in the browser" }
    ]
  }
}
ResultMeaning
"mode": "headless"No browser is connected. Only local file tools work; app operations return UNSUPPORTED with "requires a connected ASCII Motion app".
UNSUPPORTED, "Connect an ASCII Motion app with bridge v3 support"The browser is running an app older than 2.2.6. Reload ascii-motion.app, or use the legacy ascii-motion-mcp@2.3.0.
UNSUPPORTED with appContractHash and mcpContractHashThe app and server were built from different bridge contracts. Update the one that's older.
An operation is listed under unavailableIt needs something the browser doesn't have, usually a signed-in account.

Then run a reversible check:

text
Using ascii-motion: read the document summary, write "@" at x 0, y 0 with
set_cells, read that cell back with read_cells, then call app_undo.

You should see @ appear in the top-left corner of the canvas and then disappear. If it lands in a different project, you're connected to another tab; see Troubleshooting. To check the installed version from a terminal, run npx -y ascii-motion-mcp@3 --version.

Discover before you edit

Start every session with three small reads instead of pulling the whole document:

  • get_capabilities: contract, version, supported operations and sign-in or entitlement state.
  • get_document_summary: canvas, timeline, layers and groups with their IDs and content-frame ranges, effects, shaders, selection and history flags. It contains no cell data.
  • get_catalog with a family of effects, shaders, generators, palettes, export_formats, tools or fonts: the property names, settings, defaults and enums the running app actually accepts.

Use read_cells with a region to inspect only the cells you need. scope: "composite" returns what the editor's compositor shows at a timeline frame, including transforms, effects and generators but not shaders. scope: "layer" returns one content frame's raw cells.

Tool discovery is large

Version 3.0.0 lists 216 tools with 288,778 bytes of schemas, much more than 2.3.0. Result paging doesn't shrink this. If your client supports progressive or tool-search discovery, turn it on. Clients with a tool limit need some tools disabled: Windsurf's Cascade, for example, allows 100 enabled tools across all servers.

Canonical, compatibility and app_ names

Version 3.0.0 has three kinds of tools:

  • 106 canonical operations, generated from the app's bridge contract. They take explicit IDs and timeline frames. Prefer them for new work.
  • 109 compatibility tools with the 2.3.0 names, so existing prompts keep working. When connected, they also run through the app. The tool reference flags the one exception, copy_region_to_frame, whose result you should check.
  • read_artifact, which pages through saved results. See Large results and artifacts.

When a canonical operation has the same name as a compatibility tool but different inputs, the canonical tool has an app_ prefix:

Compatibility toolCanonical toolDifference
load_projectapp_load_projectReads a local file vs. loads a native session object through the app importer
add_layerapp_add_layerName only vs. placement with aboveLayerId, and returns the new layerId and contentFrameIds
add_content_frameapp_add_content_frameLegacy data vs. canonical cells, an optional copyFromContentFrameId, and returned IDs
undo, redoapp_undo, app_redoBoth go through the editor's undo history

24 canonical tools carry the prefix, including app_add_generator_layer, app_create_group and app_fill_region. Inside apply_operations, use the unprefixed contract names, such as add_layer, because a batch only contains canonical operations.

Stable IDs, timeline frames and revisions

  • IDs: layers, groups, content frames, effect and shader blocks, property tracks and keyframes all have stable IDs. Every mutation returns the IDs it created or changed under ids. Use them instead of list positions, which change when things are added or reordered.
  • Timeline frames: every canonical frame, startFrame and durationFrames is a zero-based timeline frame, not milliseconds and not a content-frame ordinal. A content frame that starts at frame 4 and lasts 4 frames covers frames 4–7.
  • Targets: drawing tools take an optional target with layerId, contentFrameId or frame. Without one, they edit the active layer's content frame at the playhead. If no content frame covers the frame, the tool returns NOT_FOUND unless you pass createIfMissing: true. Coordinates are layer-local.
  • Revisions: every response includes documentId and revision. Pass a revision from a read as expectedRevision so a mutation fails with CONFLICT if you, or anyone else, edited the document in the app since that read. Read again, then retry.

See Layers and timeline for a full walkthrough.

Atomic batches

apply_operations runs up to 100 mutations as one change: one revision, one undo entry, and a full rollback if any step fails. Later steps see the results of earlier steps. A failure reports the failing step in details.index and details.op, and the document, revision and history stay unchanged.

json
{
  "expectedRevision": 41,
  "operations": [
    { "op": "set_cells", "input": {
      "target": { "layerId": "layer-1-…", "contentFrameId": "cf-16-…" },
      "cells": [{ "x": 1, "y": 1, "char": "*", "color": "#FFD700" }]
    } },
    { "op": "draw_line", "input": {
      "target": { "layerId": "layer-1-…", "contentFrameId": "cf-16-…" },
      "from": { "x": 0, "y": 3 }, "to": { "x": 11, "y": 3 },
      "style": { "char": "-", "color": "#00FFAA" }
    } },
    { "op": "set_project_metadata", "input": { "name": "Batch demo" } }
  ]
}

A batch can't contain reads, undo, redo, new_project, load_project, nested apply_operations, view changes, or import, export and cloud operations. Run those as separate calls.

Large results and artifacts

  • Default tool responses are capped at 16 KiB. Larger results, full documents and binary exports are saved as artifacts instead of being pasted into the conversation.
  • Artifacts are written inside --project-dir, by default under .ascii-motion/artifacts/. The response gives the artifact id, a filePath and its size.
  • read_artifact reads one page at a time: artifactId, offset, length (up to 8,192 bytes) and encoding (auto, utf8 or base64). Continue from nextOffset until it is null. Each page response stays under 64 KiB.
  • Usually you don't need to page through an artifact at all. Open the saved file, or ask the agent to report its path.

Errors are bounded too: a large validation error returns a short message and saves the full details as an artifact.

Errors and recovery

CodeWhat to do
INVALID_INPUTFix the arguments. The message names the field, and long details go to an artifact.
NOT_FOUNDAn ID is stale or no content frame covers the target frame. Re-read the summary, or use createIfMissing.
CONFLICTThe document changed after your read, or timing would overlap. Re-read, then retry with the new expectedRevision.
UNSUPPORTEDAn older app, mismatched contracts, headless mode, or an option the app can't represent. See Verify the connection.
AUTH_REQUIREDSign in to ASCII Motion in the connected browser. Don't share credentials with the agent.
LOCKEDThe target layer or group is locked in the app. Unlock it, or choose another target.
OUT_OF_RANGEA coordinate, frame or value is outside the canvas, timeline or allowed range. Check get_document_summary.
LIMIT_REACHEDThe request is larger than a preview allows, or a plan limit was reached. Use a single frame or export instead, or remove layers.
ENTITLEMENT_REQUIREDThe signed-in account's plan doesn't include this feature.
PORT_IN_USEAnother server, usually another AI session's, holds the live port. Use that session, or close it and retry. See Troubleshooting.
UI_NOT_READYThe editor is still loading or showing a blocking dialog. Finish or close it in the app, then retry.
BUSY, INTERNAL, timeout or disconnectThe request was cancelled or the outcome is unknown, and the app may already have applied it. Reconnect, call get_document_summary, and check whether the change was applied before retrying anything destructive.

Cloud projects are untested signed in

The cloud project tools, such as list_cloud_projects, save_cloud_project and publish_cloud_project, act for the account signed in to the connected browser. In 3.0.0 they have only been tested signed out, where they correctly return AUTH_REQUIRED. Signed-in behavior and plan entitlements are untested. Save a local copy before trying them on projects you care about. Account, billing and sign-in are not MCP tools.

Headless mode (no browser)

Without --live, or before a browser connects, the server keeps its own in-memory project. Compatibility tools can draw, inspect and export text-based formats to files in --project-dir without opening the app, and read_artifact reads saved results. Canonical operations, image and video export, image and video import, layers, effects, shaders and generators need a connected editor.

When a browser connects, the editor's project becomes the source of truth. Headless edits made before connecting are not merged into it.

Security and privacy

  • The WebSocket server binds to 127.0.0.1 and rejects connections without the current token. It accepts browser connections only from ascii-motion.app, localhost and 127.0.0.1 origins.
  • Treat the token like a password for this session. Don't post it in issues, screenshots or shared chat transcripts.
  • Never expose the port to your network, tunnel it, or remove the token check to make remote access work.
  • MCP does not need your ASCII Motion account credentials. Never paste passwords, cloud tokens or API keys into an AI chat to "help" the connection.
  • --project-dir controls where file tools and artifacts read and write. Point it at a dedicated folder rather than your home directory.

Remote and cloud agents

Live sync only works when the AI client, the MCP server and the browser all run on the same computer. Cloud agents, such as Copilot cloud agent sessions, Codespaces or a remote SSH host, start the server on a different machine, and your desktop browser cannot reach that machine's 127.0.0.1. In those environments, use headless mode and file exports, then open the files in the app yourself.

Troubleshooting

SymptomLikely causeFix
Server fails to start, or the client shows it as stoppednpx or node is not on the client's PATH, or Node.js is older than 22. Desktop apps launched from the Dock or Start menu often don't load your shell profile.Use the full path to npx (find it with which npx on macOS/Linux or where npx on Windows) as the command, or start the client from a terminal. Check node --version reports 22 or 24.
PORT_IN_USE from a tool, or EADDRINUSEAnother ascii-motion-mcp already holds the port: another AI session that used ASCII Motion, a manual terminal instance or a second client. Version 3.0.0 exits at startup instead of reporting PORT_IN_USE.Use ASCII Motion from the session that holds the port, or close it and retry; 3.0.1 and later claim the port on the next tool call. To run both, give one a different --port and use that port in the dialog.
Status stays Error, or closes with "Invalid auth token"The server was restarted and has a new token, or the token belongs to another instance.Ask for get_auth_token again and reconnect.
Connection closes with "Invalid origin"The editor is served from an unsupported address.Use https://ascii-motion.app or a local dev server on localhost/127.0.0.1.
Connected, but changes land in the wrong projectSeveral editor tabs are open, or another tab connected last.Close other ASCII Motion tabs and reconnect from the one you want.
Tools return UNSUPPORTED while connectedThe tab is running an app older than 2.2.6, or the contract hashes differ.Reload ascii-motion.app and reconnect. See Version compatibility.
The client hides some tools, or warns about too manyThe client limits how many tools it loads.Turn on tool search or progressive discovery, or disable tools you don't need.
Connection drops after a command "timed out" or "acknowledgement interrupted"The server quarantines the browser channel when a command can't be confirmed, so it doesn't report a false success.Click Connect again, then ask the assistant to call get_document_summary and check whether the last change was applied before continuing.
Generator or layer tools fail with a limit errorYour plan's layer limit has been reached (five layers on the free plan).Remove or bake layers, or upgrade in the app.
Cell edits don't change a generator's outputGenerator layers are rendered procedurally from their settings.Change the generator with app_set_generator_property, or convert it to editable cells with app_bake_generator_layer first.