aseprite-lua-mcp
This server lets an LLM agent run one complete Aseprite Lua script headlessly to create pixel art and animations, plus fetch a compact Lua API cheat sheet.
Run
execute_aseprite_scriptwith a fulllua_codescript viaaseprite --batch --script, with a 60s timeout.Create sprites, pixel art, animations, layers, palettes, frames/tags, and export images by saving inside the script (e.g.
spr:saveCopyAs(...)).Pass optional
output_filename; relative paths resolve underDEFAULT_OUTPUT_DIR/cwd, parent dirs are created, and the result verifies whether the file was created; scripts can use theOUTPUT_PATHglobal.Get stdout/stderr with Lua syntax/runtime errors and line numbers for quick script fixes.
Receive inline base64
image/pngresponses when scripts return output images (per README).Call
get_aseprite_lua_docsfor a compact Aseprite Lua API cheat sheet (Sprite, Layer, Cel, Image, Color, Palette,saveCopyAs).README additionally notes existing sprite loading via
input_filename, though that parameter is not present in the provided schema.
Allows LLM agents to create pixel art and animations in Aseprite by running complete Lua scripts headlessly, with control over sprites, layers, cels, images, colors, palettes, frames, tags, and exporting output files.
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-lua-mcpmake a 32x32 pixel art sword sprite and save it as sword.png"
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-lua-mcp 
A lightweight Model Context Protocol server that lets LLM agents create pixel art and animations in Aseprite by writing one complete Lua script and running it headlessly with aseprite --batch --script.
What's New in v0.2.0
Native Image Responses: Scripts returning output images now automatically send inline base64
image/pngcontent blocks for direct preview in supported clients.Existing Sprite Editing: Added
input_filenameparameter to load existing sprites before executing scripts.Documentation Filtering:
get_aseprite_lua_docsnow supports filtering byclass_name(e.g.,Cel,Sprite) or search terms to reduce token usage.Configurable Output Directory: Environment variable
ASEPRITE_OUTPUT_DIR(withDEFAULT_OUTPUT_DIRfallback).Startup Health Checks: Auto-detects and logs Aseprite binary paths on startup.
Related MCP server: mnehmos.aseprite.mcp
Why scripts instead of per-pixel tools?
Most Aseprite integrations expose one IPC/tool call per operation (put pixel, draw line, add frame...). Every call costs tokens and a round-trip. This server exposes a single "run this script" tool instead:
Approach | Tool calls for a 32x32 sprite | Token usage |
One MCP call per pixel/shape | hundreds | very high, rate-limit prone |
One Lua script (this server) | 1 | 90%+ lower |
A Lua loop replaces thousands of tokens of repeated calls, and when something fails the agent fixes a single script and re-runs it.
Quick start
Requires Node.js 18+ and Aseprite installed locally. No clone or build needed; npx downloads the package on demand.
Claude Code
claude mcp add aseprite -- npx -y aseprite-lua-mcpWith environment variables:
claude mcp add aseprite \
-e ASEPRITE_PATH="C:/Program Files/Aseprite/Aseprite.exe" \
-e DEFAULT_OUTPUT_DIR="C:/Users/me/sprites" \
-- npx -y aseprite-lua-mcpThe
--beforenpxis required so that-yis passed tonpxand not parsed byclaude mcp add.
Claude Desktop / .claude.json
Add this to claude_desktop_config.json (or the mcpServers section of .claude.json):
{
"mcpServers": {
"aseprite": {
"command": "npx",
"args": ["-y", "aseprite-lua-mcp"],
"env": {
"ASEPRITE_PATH": "C:/Program Files/Aseprite/Aseprite.exe",
"DEFAULT_OUTPUT_DIR": "C:/Users/me/sprites"
}
}
}
}env is optional. Restart the client after editing the config.
Environment variables
Variable | Description | Default |
| Path to the Aseprite executable. The server errors if it is set but the file doesn't exist. | Auto-detected in common Windows, macOS and Linux locations (including Steam), then |
| Base directory for a relative |
|
Absolute output_filename values are used as-is. The output file's parent directory is created automatically.
Tools
execute_aseprite_script
Parameter | Type | Description |
| string (required) | Complete Lua script to run. |
| string (optional) | Expected output file, e.g. |
The code is written to a temporary .lua file, run with aseprite --batch --script (60 second timeout), and the temp file is always deleted. The result contains stdout and stderr (syntax and runtime errors with line numbers). When output_filename is given, the global OUTPUT_PATH (the resolved absolute path) is available inside the script, and the server reports whether the file was actually created. The script is responsible for saving it.
local spr = Sprite(16, 16)
local img = spr.cels[1].image
local c = Color{ r=220, g=40, b=40 }
for y=0,15 do for x=0,15 do
if (x-8)^2 + (y-8)^2 <= 36 then img:putPixel(x, y, c) end
end end
spr:saveCopyAs(OUTPUT_PATH)get_aseprite_lua_docs
Returns a compact cheat sheet of the Aseprite Lua API (Sprite, Layer, Cel, Image, Color, Palette, saveCopyAs) so the agent doesn't need to guess.
Recommended .clauderules
To get immediate execution with no explanatory prose, and the biggest token savings, put this in a .clauderules file (or your CLAUDE.md) in your project:
# aseprite-lua-mcp rules
- ALWAYS generate pixel art by writing a complete Lua script and executing it with `execute_aseprite_script`. Never draw pixel by pixel or issue per-operation calls.
- DO NOT explain your drawing strategy or write introductory/concluding prose text. Execute the tool IMMEDIATELY with the generated script.
- If you are unsure about the Aseprite Lua API, call `get_aseprite_lua_docs` once before writing the script.
- Put everything in a single script: create the sprite, draw (use loops and helper functions for lines, circles, rects, fills), set palette/layers/frames/tags, and export with `spr:saveCopyAs(...)`.
- Pass `output_filename` and save to the `OUTPUT_PATH` global inside the script.
- On error, read the stderr line number, fix the script, and re-run the whole script; NEVER fall back to per-pixel commands.
- Use small canvases (16x16 to 64x64) and scale up only for previews.Development
git clone <this repo> aseprite-lua-mcp
cd aseprite-lua-mcp
npm install
npm run build
node dist/index.jsSecurity note
This server executes arbitrary Lua inside Aseprite, which can read and write files and run OS commands (os.execute). Only connect it to agents you trust.
License
MIT
Available Tools
2 toolsexecute_aseprite_scriptA
Run a complete Aseprite Lua script headlessly (aseprite --batch --script). Write the whole drawing/animation/export as one script instead of many small calls. Call get_aseprite_lua_docs first if unsure about the API.
Inputs: lua_code (required), output_filename.
get_aseprite_lua_docsA
Return a compact cheat sheet of the Aseprite Lua API (Sprite, Layer, Cel, Image, Color, Palette, saveCopyAs).
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one retrieves API documentation, the other executes a script. There is no overlap or ambiguity in their roles.
Both names follow a consistent snake_case verb_aseprite_noun pattern (get_..._docs, execute_..._script). The verbs are different but appropriate for their actions, and the structure is predictable.
With only 2 tools, the set is borderline thin for the stated purpose. While each tool earns its place, a more complete server might include additional operations like listing sprites or validating scripts.
The server covers the essential workflow for Aseprite Lua scripting: accessing API documentation and executing scripts headlessly. No obvious gaps exist for the intended use case.
Maintenance
Related MCP Connectors
Generate, edit, style-match, turn, and animate game-ready pixel art at exact sizes.
Generate pixel art sprites, animations, 8-direction rotations and palettes for games.
Turn images into pixel art, extract and remap palettes, and upscale sprites without blur.
AI game assets for agents: consistent sprites, 2D animations, tiles, maps, music and engine exports.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI to create pixel art in Aseprite through pixel-level drawing primitives, read canvas screenshots, and iterate until satisfied.317MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to create, inspect, edit, and export pixel art, sprites, animations, and spritesheets using headless Aseprite, and to convert arbitrary images into indexed pixel art.MIT
- 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