Aseprite MCP
Summary: This server gives an AI agent one execute tool that runs JavaScript programs to draw and edit pixel art live in the user's Aseprite, one program per undo step.
Create or open sprites, pick color modes, and list open sprites.
Draw natively with per-cel
map,px,line,rect,ellipse,fill,outline,shift,copy,recolor,clear, andread/bounds.Manage layers (create, rename, remove, visibility, opacity, ordering) and frames, set frame durations, and define animation tags with directions.
Generate colors via named palettes and OKLCH
rampshades.Load PNG reference images and paste or downscale them into cels.
Inspect results with
view()PNG renders, includingcritique: truesheets showing color, grayscale, silhouette, and true size.Export sprite sheets (PNG + JSON frame/tag metadata) and animated GIFs, scaled and optionally filtered by tag.
Save sprites to disk and load/save/reuse shared helper libraries with
lib()anduse().Commit edits as single labeled undo steps, checkpoint with
commit(), and undo/redo; failed runs discard changes.Merge concurrent artist edits, reporting
mergedcels andlostpixels with artist edits winning overlaps.Get targeted guidance on demand via
help(topic).
Enables AI agents to draw and edit pixel art live in Aseprite by executing JavaScript programs. Supports creating and manipulating sprites, layers, frames, cels, tags, palettes, pixel-level drawing operations, animations, sprite sheets, GIF exports, and critique views.
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., "@Aseprite MCP make a 32x32 pixel art slime and export a 6-frame bounce GIF"
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.
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,fillandshiftchange 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.
Clone the repository and build the extension.
git clone https://github.com/ParthMmm/aseprite-mcp.git cd aseprite-mcp npm install npm run buildIn Aseprite, open Preferences > Extensions, choose Add Extension, and select
dist/aseprite-mcp.aseprite-extension.Restart Aseprite.
Print the pairing token.
node bin/aseprite-mcp.ts tokenIn 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 serveThe 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 |
| Show whether the daemon runs and Aseprite is connected. |
| Stop the daemon. |
| Print or rotate the Aseprite pairing token. |
| 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.
On the machine that runs Aseprite, start the daemon with
--tailscale:node bin/aseprite-mcp.ts serve --tailscaleThe daemon runs
tailscale serve --bg --https=9124 http://127.0.0.1:9124and logs the URL, such ashttps://machine.example-tailnet.ts.net:9124/mcp. The daemon itself still listens on127.0.0.1only.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 --remoteThe 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 --newThe 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.plistAfter 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 YESStart 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.targetThen 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 |
|
|
|
|
|
|
|
|
| Token file |
|
|
| Remote token file (only used with |
|
|
|
|
|
|
|
|
| The sprites folder and the temporary directories |
| The user cache directory |
|
|
|
|
|
|
|
|
| From |
| The machine's owner with |
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?): stringsprite()with no arguments returns the active sprite.rampmakes OKLCH shades, dark to light, one per key.paletteloads a named palette, or saves it when you pass colors.imageloads a PNG as pixels. See Sprite sheets, GIFs and reference images.libsaves, reads or lists helper code. See Saved helper code.helphas the topicsmaps,animation,critique,conflicts,files,exportandlib.
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,fillandshift.Return only what you need, such as counts or a few rows.
view()writes a PNG and returns its path. Withcritique: 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
warningslist each such call once, for examplemap 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.resizereturns a handle with the newwidthandheight, 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 andlib()lists the names. A name has 1 to 40 characters froma-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
useother 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.pngholds every frame, composited from the visible layers and scaled up byscalewith nearest-neighbor sampling. Frames run left to right;columnswraps them into a grid.slime.jsongives each frame'sx,y,w,handdurationin milliseconds, the tags withfrom,toanddirection, the sheetsizeand thescale.slime.gifloops 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: falsewrites 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. Withserve --tailscale, it also accepts requests thattailscale serveforwards for the allowed Tailscale users. Withserve --remote(or a non-loopbackASEPRITE_MCP_HTTP_HOST), it requiresAuthorization: Bearer <token>from remote callers, rejects cross-site browser requests, and keeps/shutdownloopback-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-mcpand the temporary directories. SetASEPRITE_MCP_FILE_DIRSto 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 testsnode --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 |
| CLI ( |
| HTTP MCP server, loopback/tailnet/remote bearer auth, and |
|
|
| Sprite Session over |
| Authenticated WebSocket transport and binary frame protocol |
| Compositing, Views, Critique Sheets, sprite sheet/GIF export, and PNG/GIF codecs |
| Native pixel drawing operations and OKLCH/hex color math |
| Injectable |
| Tailscale Serve integration and LAN/tailnet address discovery |
| Aseprite Lua plugin ( |
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 toolexecuteA
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
Scored across 1 tool
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.
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.
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.
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
Related MCP Connectors
A pixel-art studio your AI draws in, live: sprites, characters, tilesets, game exports.
Pixel art for your game, from your coding agent. Generate sprites, items and tiles in your game's style (64 to 1024 px), make variants, reskins and N/E/S/W directions, then edit everything in a full pixel art editor that syncs into your project. Works with Claude, Claude Code, Cursor and ChatGPT; sign in with OAuth, no API key.
Pixel art for AI agents: free image to pixel art, plus sprite generation and animation.
Generate, edit, style-match, turn, and animate game-ready pixel art at exact sizes.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI to create pixel art in Aseprite through pixel-level drawing primitives, read canvas screenshots, and iterate until satisfied.317MIT
- AlicenseAqualityBmaintenanceEnables AI agents to create and edit pixel art in a live Aseprite window, with tools for drawing, selection, transformation, and animation.181,417 npm745MIT
- AlicenseNot gradedqualityCmaintenanceEnables 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.1MIT
- AlicenseBqualityCmaintenanceEnables 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.116MIT