Skip to main content
Glama

Aseprite MCP

Aseprite MCP lets an AI agent draw pixel art live in Aseprite. The agent writes one JavaScript program per step ("code mode"). The server exposes one tool, execute.

Why it is fast

  • One program is one round trip and one undo step, however many pixels it changes.

  • Pixel work runs natively. Methods such as map, rect, fill and shift change many pixels per call.

  • The tool description is under about 1,000 tokens. The agent reads longer guidance on demand with help(topic).

Measured on an Apple Silicon Mac with Aseprite 1.3.18: a program that draws a 48×48 sprite, builds a 12-frame animation and renders a critique view takes about 80 ms on Node and about 55 ms on Bun, from request to result.

Related MCP server: aseprite-ai-artist

Install

Requires Aseprite and Node.js 24 or later (it runs the TypeScript sources directly). Bun also runs the daemon, about 30% faster. The tests need Node.

  1. Clone the repository and build the extension.

    git clone https://github.com/ParthMmm/aseprite-mcp.git
    cd aseprite-mcp
    npm install
    npm run build
  2. In Aseprite, open Preferences > Extensions, choose Add Extension, and select dist/aseprite-mcp.aseprite-extension.

  3. Restart Aseprite.

  4. Print the pairing token.

    node bin/aseprite-mcp.ts token
  5. In Aseprite, choose File > Aseprite MCP..., paste the token, and select Connect.

To make a new token, run node bin/aseprite-mcp.ts token --new, then paste it in the dialog again.

Run

Start the shared daemon:

node bin/aseprite-mcp.ts serve   # or: bun bin/aseprite-mcp.ts serve

The daemon serves MCP at http://127.0.0.1:9124/mcp. Aseprite connects to it on ws://127.0.0.1:9123.

Connect a client in one of two ways:

  • Executor: use Quick Add with the URL http://127.0.0.1:9124/mcp.

  • Any stdio client: set the command to node /path/to/aseprite-mcp/bin/aseprite-mcp.ts. It starts the daemon if none runs.

By default, a view is returned as a file path. Use http://127.0.0.1:9124/mcp?images=inline to also get image blocks in the result.

Other commands:

Command

Action

node bin/aseprite-mcp.ts status

Show whether the daemon runs and Aseprite is connected.

node bin/aseprite-mcp.ts stop

Stop the daemon.

node bin/aseprite-mcp.ts token [--new]

Print or rotate the Aseprite pairing token.

node bin/aseprite-mcp.ts token --remote [--new]

Print or rotate the remote HTTP bearer token.

Use it from other machines over Tailscale

If your machines share a Tailscale tailnet, agents on any of them can connect to the daemon with one URL.

  1. On the machine that runs Aseprite, start the daemon with --tailscale:

    node bin/aseprite-mcp.ts serve --tailscale

    The daemon runs tailscale serve --bg --https=9124 http://127.0.0.1:9124 and logs the URL, such as https://machine.example-tailnet.ts.net:9124/mcp. The daemon itself still listens on 127.0.0.1 only.

  2. On the other machine, add that URL to the MCP client as an HTTP server.

By default, only the Tailscale user who owns the machine can connect. To allow other users, set ASEPRITE_MCP_TAILNET_USERS to a comma-separated list of logins, such as alice@example.com,bob@example.com. The daemon compares each login with the Tailscale-User-Login header that tailscale serve adds, and refuses all other requests, including requests without that header.

If Serve is not yet enabled for your tailnet, tailscale serve prints a link to enable it. Open the link, then start the daemon again. The daemon stops with an error if tailscale serve does not finish within 30 seconds.

Tailnet callers differ from local callers in two ways:

  • Each result includes view images as image blocks, because the caller cannot read file paths on this machine.

  • A tailnet caller cannot stop the daemon.

To stop serving the daemon to the tailnet, run tailscale serve --https=9124 off.

If you run tailscale serve yourself, start the daemon with plain serve and set both ASEPRITE_MCP_TAILNET_HOST and ASEPRITE_MCP_TAILNET_USERS. ASEPRITE_MCP_TAILNET_HOST is the Host header the proxy forwards, such as machine.example-tailnet.ts.net:9124.

Use it from other machines without Tailscale Serve

On a LAN, WireGuard, Tailscale without Serve, or behind your own TLS reverse proxy, start the daemon with --remote:

node bin/aseprite-mcp.ts serve --remote

The daemon binds HTTP to 0.0.0.0 (or ASEPRITE_MCP_HTTP_HOST), prints this machine's reachable Tailscale and LAN URLs, and requires Authorization: Bearer <token> from remote callers. Print or rotate the remote bearer token with:

node bin/aseprite-mcp.ts token --remote
node bin/aseprite-mcp.ts token --remote --new

The remote bearer token is separate from the Aseprite pairing token and lives in ~/.config/aseprite-mcp/remote-token (or ASEPRITE_MCP_REMOTE_TOKEN). Remote bearer callers get inline view images and cannot stop the daemon, while local loopback callers on 127.0.0.1 keep working without a header.

Plain HTTP is not encrypted by aseprite-mcp. Use --remote over Tailscale, WireGuard, or a trusted LAN, or keep ASEPRITE_MCP_HTTP_HOST=127.0.0.1 with ASEPRITE_MCP_REMOTE_TOKEN behind a TLS reverse proxy.

Start the daemon at login on macOS

Save this as ~/Library/LaunchAgents/com.parthmmm.aseprite-mcp.plist. Replace both paths: the first is your node or bun binary (which bun), the second is your clone.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key><string>com.parthmmm.aseprite-mcp</string>
  <key>ProgramArguments</key>
  <array>
    <string>/Users/you/.bun/bin/bun</string>
    <string>/path/to/aseprite-mcp/bin/aseprite-mcp.ts</string>
    <string>serve</string>
  </array>
  <key>RunAtLoad</key><true/>
  <key>KeepAlive</key><true/>
  <key>StandardErrorPath</key><string>/tmp/aseprite-mcp.log</string>
</dict>
</plist>

Then load it:

launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.parthmmm.aseprite-mcp.plist

After you update the code, restart it with launchctl kickstart -k gui/$(id -u)/com.parthmmm.aseprite-mcp. Aseprite reconnects by itself.

macOS: keep Aseprite awake

macOS App Nap slows apps that sit in the background, and Aseprite then stalls saves until you bring it to the front. Turn App Nap off for Aseprite once, then restart Aseprite:

defaults write org.aseprite.Aseprite NSAppSleepDisabled -bool YES

Start the daemon at login on Linux

Save this as ~/.config/systemd/user/aseprite-mcp.service. Replace both paths: the first is your node or bun binary (which bun), the second is your clone. %h is your home directory.

[Unit]
Description=aseprite-mcp daemon

[Service]
ExecStart=%h/.bun/bin/bun %h/path/to/aseprite-mcp/bin/aseprite-mcp.ts serve
Restart=always
RestartSec=2

[Install]
WantedBy=default.target

Then start it, and let it run while you are logged out:

systemctl --user daemon-reload
systemctl --user enable --now aseprite-mcp
loginctl enable-linger "$USER"

After you update the code, restart it with systemctl --user restart aseprite-mcp. Aseprite reconnects by itself. Read the daemon's log with journalctl --user -u aseprite-mcp.

The daemon needs a running Aseprite, and Aseprite needs a desktop session. On a machine that runs unattended, turn on automatic login for your desktop, and start Aseprite at login: copy its desktop entry with cp /usr/share/applications/aseprite.desktop ~/.config/autostart/.

The first time the extension connects, Aseprite asks whether the script may open a network connection. Answer it once at the desktop and give the script full trust. Aseprite saves the answer in ~/.config/aseprite/aseprite.ini, so later starts connect without asking.

Settings

Set these environment variables for the daemon.

Variable

Default

ASEPRITE_MCP_HTTP_HOST

127.0.0.1 (0.0.0.0 with serve --remote)

ASEPRITE_MCP_HTTP_PORT

9124

ASEPRITE_MCP_PORT

9123 (WebSocket port for the extension)

ASEPRITE_MCP_TIMEOUT

15000 ms per command (at least 60000 for snapshot and commit)

ASEPRITE_MCP_TOKEN

Token file

ASEPRITE_MCP_TOKEN_FILE

~/.config/aseprite-mcp/token

ASEPRITE_MCP_REMOTE_TOKEN

Remote token file (only used with --remote, non-loopback ASEPRITE_MCP_HTTP_HOST, or when set)

ASEPRITE_MCP_REMOTE_TOKEN_FILE

~/.config/aseprite-mcp/remote-token

ASEPRITE_MCP_PALETTE_FILE

~/.config/aseprite-mcp/palettes.json

ASEPRITE_MCP_LIB_DIR

~/.config/aseprite-mcp/lib, where lib(name, code) saves helper code

ASEPRITE_MCP_SPRITES_DIR

~/Pictures/aseprite-mcp, where s.save("name") writes

ASEPRITE_MCP_FILE_DIRS

The sprites folder and the temporary directories

ASEPRITE_MCP_VIEWS_DIR

The user cache directory

ASEPRITE_MCP_AUTOSAVE

~/.config/aseprite-mcp/autosave, or off

ASEPRITE_MCP_AUTOSAVE_KEEP

5 copies per sprite

ASEPRITE_MCP_AUTOSAVE_DAYS

14

ASEPRITE_MCP_AUTOSAVE_MB

200

ASEPRITE_MCP_TAILNET_HOST

From tailscale status with serve --tailscale; otherwise no tailnet access

ASEPRITE_MCP_TAILNET_USERS

The machine's owner with serve --tailscale; otherwise no tailnet access

The program API

The agent calls execute with a JavaScript program. Coordinates are 0-based, with (0,0) at the top left.

Globals:

sprite(o?: { new?: [w, h]; colorMode?: "rgb"|"indexed"|"gray"; open?: path; id?: number; name?: string }): Promise<Sprite>
sprites(): Promise<{ id, name, width, height, frames, active }[]>
image(path): Promise<Image>
ramp(base: string, keys: string, o?: { hueShift?: number }): Record<string, string>
palette(name, colors?): Promise<Record<string, string>>
lib(name?, code?): Promise<string[] | string>
use(name): void
help(topic?): string
  • sprite() with no arguments returns the active sprite.

  • ramp makes OKLCH shades, dark to light, one per key.

  • palette loads a named palette, or saves it when you pass colors.

  • image loads a PNG as pixels. See Sprite sheets, GIFs and reference images.

  • lib saves, reads or lists helper code. See Saved helper code.

  • help has the topics maps, animation, critique, conflicts, files, export and lib.

A Sprite has layers(), frames(), selection(), cel(layer, frame), cels(layer), layer(name, opts), setFrames(count, opts), tag(name, from, to, opts), view(opts), resize(width, height, opts), commit(label), undo(n), redo(n), changes(), save(path) and export(name, opts).

A Cel has map, px, line, rect, ellipse, fill, outline, shift, copy, recolor, clear, read and bounds. Drawing methods return the number of pixels changed. bounds() returns [x, y, w, h] of the non-transparent pixels, or null for an empty cel.

Colors are "#rgb", "#rrggbb" or "#rrggbbaa". A pixel map uses a palette of one-character keys and one string per row:

const s = await sprite({ new: [32, 32] });
const P = { k: "#1a1c2c", ...ramp("#b13e53", "rst") };
const c = s.cel("Layer 1");
c.ellipse([8, 8, 16, 16], P.s, { fill: true });
c.map(P, ["..tt", ".tsst"], { x: 12, y: 10 });
c.outline();
return await s.view({ critique: true });

Rules:

  • Edits go to a draft. When the program returns, each touched sprite commits as one undo step labeled MCP: program.

  • A throw or a timeout commits nothing. Call await s.commit("label") for a checkpoint that survives a later throw.

  • Do not loop over single pixels in JavaScript. Use map, rect, fill and shift.

  • Return only what you need, such as counts or a few rows.

  • view() writes a PNG and returns its path. With critique: true, the image shows color, grayscale values, silhouette and true size. background: "#080707" draws that color instead of the checkerboard.

  • Pixels that a drawing call puts outside the canvas are dropped. The result's warnings list each such call once, for example map on "body"@0 dropped 12 pixels outside the 48x48 canvas.

  • s.resize(64, 64, { x, y }) changes the canvas size, not the scale of the art. The art moves by (x, y). By default it stays at the bottom center, so a figure on a baseline stays on it. resize returns a handle with the new width and height, and it commits in the same undo step as the other edits. It needs extension 0.2.0 or later.

Saved helper code

lib(name, code) saves JavaScript helpers to ~/.config/aseprite-mcp/lib/<name>.js. A later program loads them with a top-level use("name") statement. Before the program runs, the daemon puts each used library in front of it, dependencies first, so the functions it declares are in scope.

await lib(
  "style",
  'use("base")\nfunction blob(c, x, y) { c.rect([x, y, 4, 4], INK, { fill: true }) }'
);
// next program:
use("style");
const s = await sprite({ new: [48, 48] });
blob(s.cel("Layer 1"), 10, 10);
  • lib(name) returns the source and lib() lists the names. A name has 1 to 40 characters from a-z, 0-9, _ and -.

  • The daemon parses the code before it saves it. A syntax error names the line, and nothing is saved.

  • A library can use other libraries. A missing library or a cycle fails before the program runs.

  • An error inside a library names the library and its line. Lines in the program stay as you wrote them.

Sprite sheets, GIFs and reference images

s.export(name, opts) writes a sprite sheet and an animated GIF for apps and previews. A bare name such as "slime" goes to the sprites folder.

const s = await sprite();
return await s.export("slime", { scale: 4, gif: true, columns: 4 });
// { sheet: ".../slime.png", json: ".../slime.json", gif: ".../slime.gif", frames: 8, width: 192, height: 192 }
  • slime.png holds every frame, composited from the visible layers and scaled up by scale with nearest-neighbor sampling. Frames run left to right; columns wraps them into a grid.

  • slime.json gives each frame's x, y, w, h and duration in milliseconds, the tags with from, to and direction, the sheet size and the scale.

  • slime.gif loops and keeps the frame durations. It has one transparent color and at most 255 other colors.

  • tag: "idle" exports only that tag's frames. sheet: false writes only the GIF.

image(path) loads a PNG, such as a reference drawing, as pixels. It returns { image, width, height } with read(opts), colors(max) and downscale(factor). downscale(4) turns art drawn at 4x back into one pixel per block. To paste it into a cel, pass the handle (or { image: ref.image }): c.copy(ref, { x: 8, y: 8 }). The decoder reads 8-bit PNGs and palette PNGs; it refuses interlaced and 16-bit files.

Safety

  • The daemon listens on loopback addresses only (127.0.0.1) by default. With serve --tailscale, it also accepts requests that tailscale serve forwards for the allowed Tailscale users. With serve --remote (or a non-loopback ASEPRITE_MCP_HTTP_HOST), it requires Authorization: Bearer <token> from remote callers, rejects cross-site browser requests, and keeps /shutdown loopback-only.

  • Aseprite and the daemon pair with a shared token. Each side proves it knows the token with an HMAC-SHA256 exchange, and the extension checks the server too. The token never crosses the connection, unpaired WebSocket messages are capped at 64 KiB, and browser origins are rejected on the extension socket.

  • A program can read and write files only inside the allowed folders: by default ~/Pictures/aseprite-mcp and the temporary directories. Set ASEPRITE_MCP_FILE_DIRS to change it.

  • Each program runs in a sandboxed interpreter (psychoscript). Defaults: 60 seconds, 64,000 bytes of output and a 64 MB draft.

  • The daemon saves backup copies after each commit and removes old ones by count, age and size.

See DISCLAIMER.md.

Undo and conflicts

Each program is one undo step in Aseprite. Press Ctrl+Z (Cmd+Z on macOS) to undo the whole program.

The program edits a private draft of the sprite. At commit, the daemon compares each cel it wrote with what Aseprite holds now. If you changed the same cel meanwhile, the daemon merges both edits. Where you both changed the same pixel, your edit wins. The commit result reports merged cels and lost pixels. After three failed retries, the commit fails and the agent runs the program again.

s.changes() lists what you drew since the agent last looked. Use s.selection() or rect: "selection" for "this part".

Development

The code is TypeScript that Node and Bun run directly; there is no build step for the server.

npm install
npm test             # node --test
npm run typecheck    # tsc, type check only
npm run check        # Ultracite: oxlint and oxfmt
npm run fix          # apply safe fixes, then rerun the tests

node --test also runs test/aseprite.test.ts. It runs test/aseprite-handlers.lua in a real Aseprite in batch mode, and it skips when it cannot find the app. Set ASEPRITE=/path/to/aseprite to point to the binary.

npm run build writes dist/aseprite-mcp.aseprite-extension (currently extension 0.3.0).

The icon and banner in assets/ come from scripts/art.lua. To draw them again, run aseprite -b --script scripts/art.lua. It writes the .aseprite sources, scaled PNGs and the animated banner GIF.

Architecture

See GLOSSARY.md for the domain terms used across the codebase.

Path

Responsibility

bin/aseprite-mcp.ts

CLI (serve, token, status, stop, and stdio MCP proxy)

src/daemon.ts

HTTP MCP server, loopback/tailnet/remote bearer auth, and /health + /shutdown

src/program.ts

psychoscript sandbox runtime and the execute tool API

src/session.ts

Sprite Session over Link (drafts, diffs, compare-and-swap commits, conflict merges, artist changes)

src/link.ts, src/wire.ts

Authenticated WebSocket transport and binary frame protocol

src/render.ts, src/codecs.ts

Compositing, Views, Critique Sheets, sprite sheet/GIF export, and PNG/GIF codecs

src/raster.ts, src/color.ts

Native pixel drawing operations and OKLCH/hex color math

src/files.ts, src/library.ts

Injectable Workspace storage (path sandboxing, tokens, views, backups, palettes) and saved libraries

src/tailnet.ts

Tailscale Serve integration and LAN/tailnet address discovery

extension/

Aseprite Lua plugin (0.3.0)

License

Public domain under the Unlicense. Use, copy, change and sell it for any purpose, with no conditions and no attribution needed.

Available Tools

1 tool
executeA

Draw pixel art live in the user's Aseprite by running a JavaScript program. Coordinates are 0-based, (0,0) top-left; frames are 0-based.

Globals: sprite(o?: { new?: [w, h]; colorMode?: "rgb"|"indexed"|"gray"; open?: path; id?: number; name?: string }): Promise // no args = the active sprite sprites(): Promise<{ id, name, width, height, frames, active }[]> image(path): Promise // load a PNG reference: Image { image, width, height, read(o?), colors(max = 32), downscale(factor) } ramp(base: string, keys: string, o?: { hueShift?: number }): Record<string, string> // OKLCH shades, dark to light, one per key palette(name, colors?): Promise<Record<string, string>> // load, or save with colors, a named palette lib(name?, code?): Promise<string[] | string> // save helper code: lib(name, code); read: lib(name); list: lib() use(name): void // top-level use("style") puts a saved library's functions in scope; see help("lib") help(topic?): string // topics: maps, animation, critique, conflicts, files, export, lib

Sprite { id, name, width, height, colorMode layers(): string[] // paths, bottom to top; "group/child" frames(): number; selection(): Rect | null cel(layer, frame = 0): Cel; cels(layer): Cel[] // one per frame layer(name, o?: { below?, visible?, opacity? (0-255), rename?, remove? }): void // unknown name = new layer setFrames(count, o?: { duration?: ms | ms[] }): void // new frames copy the last frame tag(name, from, to, o?: { direction?: "forward"|"reverse"|"pingpong" }): void view(o?: { frame?: number | "all"; rect?: Rect; scale?: number; critique?: boolean; background?: "#080707" }): Promise<{ path, width, height }> // background replaces the checkerboard resize(w, h, o?: { x?, y? }): Sprite // canvas size, not scale; art moves by (x, y), default bottom-centred; use the returned handle commit(label?): Promise<{ label, cels, pixels, merged, lost }> // checkpoint now undo(n = 1): Promise; redo(n = 1): Promise changes(): Promise<{ layer, frame, rect, palette, rows }[]> // the artist's edits since you last looked save(nameOrPath?): Promise // save("slime") -> ~/Pictures/aseprite-mcp/slime.aseprite export(name, o?: { scale?, tag?, sheet? = true, gif?, columns? }): Promise<{ sheet?, json?, gif?, frames, width, height }> } // sprite sheet PNG + JSON, GIF Cel { layer, frame map(palette, rows, o?: { x?, y?, flip?: "h"|"v"|"hv" }): number // one char per pixel; "." and " " skip; "#00000000" erases px(points: [x, y, color][]): number; line(x0, y0, x1, y1, color): number rect(r, color, o?: { fill? }): number; ellipse(r, color, o?: { fill? }): number; fill(x, y, color): number outline(color?, o?: { mode?: "selective"|"outside"|"inside"; rect? }): number // selective needs no colour shift(dx, dy, o?: { rect? }): number copy(from: Cel | Image | { layer, frame?, sprite? } | { image }, o?: { rect?, x?, y?, flip? }): number recolor(map: { "#from": "#to" }, o?: { rect? }): number; clear(r?): number bounds(): Rect | null // [x, y, w, h] of the non-transparent pixels; null when empty read(o?: { rect?; palette? }): { palette, rows } } // same format as map; pass your palette to keep its keys Rect = [x, y, w, h] | "selection". Colours are "#rgb", "#rrggbb" or "#rrggbbaa". Drawing methods return pixels changed.

Rules:

  • Edits go to a draft. When the program returns, each touched sprite commits as ONE undo step ("MCP: program").

  • A throw or timeout commits nothing; the result lists the discarded cels. await s.commit("label") is a checkpoint that survives a later throw.

  • Pixel loops belong in methods: map/rect/fill/shift run natively; a JS loop per pixel is slow.

  • Return only what you need (counts, a few rows), never whole sprites or handles.

  • view() writes a PNG and returns its path; open the file to look. Use critique: true to judge colour, values and silhouette in one image.

  • The result's warnings name each drawing call that dropped pixels outside the canvas; move the art or s.resize().

  • The result's commit list reports merged and lost: if the artist drew on the same cels meanwhile, both edits are kept and the artist wins where you overlap.

Example: const s = await sprite({ new: [32, 32] }) const P = { k: "#1a1c2c", ...ramp("#b13e53", "rst") } const c = s.cel("Layer 1") c.ellipse([8, 8, 16, 16], P.s, { fill: true }) c.map(P, ["..tt", ".tsst"], { x: 12, y: 10 }) c.outline() return await s.view({ critique: true })

Inputs: code (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 1 tool

    Disambiguation5/5

    There is only one tool, so there is no possibility of misselection between tools. The single entry point cleanly routes all capability through a documented JavaScript API.

    Naming Consistency4/5

    With a single tool there is no pattern to violate, so consistency is trivially satisfied. The name 'execute' is generic and doesn't convey the pixel-art domain, though the description compensates immediately.

    Tool Count3/5

    A single tool is a deliberate design choice here — it exposes an entire scripting API (sprite, cel, palette, export, help) rather than a thin capability. Still, one tool is on the thin side and offers no discoverability of operations without reading a long description.

    Completeness4/5

    The surface covers creation, layers, frames, tags, drawing primitives, palettes, libraries, view/critique, save/export, and undo/redo — a genuinely broad lifecycle. Minor gaps exist, such as no way to set the selection (only read it) and no explicit tilemap or slice operations.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to create and edit pixel art in a live Aseprite window, with tools for drawing, selection, transformation, and animation.
      18
      1,417 npm
      745
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI coding agents to create, draw, and refine Aseprite documents through deterministic canvas, layer, frame, tag, and palette tools, with pixel analyzers, style validation, and preview/diff visual feedback. It also supports spritesheet and animated GIF export, producing multi-layer game-ready assets.
      1
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI assistants to create and edit pixel art and animated sprites in Aseprite through 104 tools covering drawing, layers, animation, palettes, tilemaps, exports, visual analysis, and raw Lua scripting.
      116
      MIT