aseprite-mcp

aseprite-mcp

MCP server for controlling Aseprite from Codex, wrapping its native CLI and Lua scripting to enable pixel art creation, sprite editing, animation, file inspection, and export.

Category
访问服务器

README

aseprite-mcp

MCP server for controlling Aseprite from Codex. It wraps Aseprite's native CLI plus Lua scripting so Codex can create pixel art, edit sprites, build animation frames, inspect files, and export PNG/GIF/sprite sheets.

The broad capability path is intentional:

  • High-level tools cover common pixel-art workflows.
  • aseprite_command_sequence exposes Aseprite's built-in app.command.<CommandId>(params) action system.
  • aseprite_cli exposes any Aseprite CLI flag.
  • aseprite_run_lua exposes Aseprite's Lua API, so features not modeled by the high-level schema are still reachable.

Requirements

  • Node.js 20+
  • Aseprite installed locally
  • Aseprite executable available as one of:
    • ASEPRITE_PATH=/path/to/aseprite
    • aseprite on PATH
    • macOS user app path such as ~/Applications/Aseprite.app/Contents/MacOS/aseprite
    • macOS app path such as /Applications/Aseprite.app/Contents/MacOS/aseprite

This machine has Aseprite at /Users/sunjiaxiang/Applications/Aseprite.app/Contents/MacOS/aseprite.

Build

cd /Users/sunjiaxiang/workspace/tmp/aseprite-mcp
npm install
npm run build
npm test
npm run test:e2e

Add To Codex

Use the Codex CLI:

codex mcp add aseprite -- node /Users/sunjiaxiang/workspace/tmp/aseprite-mcp/dist/index.js

If Aseprite is not on PATH, pass the executable path:

codex mcp add aseprite \
  --env ASEPRITE_PATH=/Users/sunjiaxiang/Applications/Aseprite.app/Contents/MacOS/aseprite \
  -- node /Users/sunjiaxiang/workspace/tmp/aseprite-mcp/dist/index.js

After adding the server, restart Codex so the new MCP tools are loaded.

Equivalent ~/.codex/config.toml shape is:

[mcp_servers.aseprite]
command = "node"
args = ["/Users/sunjiaxiang/workspace/tmp/aseprite-mcp/dist/index.js"]

[mcp_servers.aseprite.env]
ASEPRITE_PATH = "/Users/sunjiaxiang/Applications/Aseprite.app/Contents/MacOS/aseprite"

Tools

aseprite_status

Resolves Aseprite and reports version/configuration.

aseprite_list_commands

Lists Aseprite command IDs extracted from upstream src/app/commands/commands_list.h, such as NewFile, SpriteSize, Flip, HueSaturation, NewFrame, SaveFileAs, and ExportSpriteSheet.

aseprite_command_sequence

Runs Aseprite built-in actions through Lua as app.command.<CommandId>(params). Use this for menu/action behavior such as creating files, resizing sprites, flipping, changing color mode, adding frames/layers, applying filters, and saving. It accepts dryRun: true to inspect the generated Lua.

aseprite_create_sprite

Creates a new sprite from structured JSON drawing operations. Supports pixel, rect, line, circle, text, matrix, and embedded lua operations. Use dryRun: true to inspect generated Lua without launching Aseprite.

aseprite_run_lua

Runs inline Lua or a .lua file through Aseprite's --script, optionally after opening input sprites and passing app.params.

aseprite_cli

Runs raw Aseprite CLI args. This is the escape hatch for all native Aseprite features.

aseprite_export

Exports an existing sprite/image using common flags such as --save-as, --sheet, --data, --trim, --frame-range, --layer, and --tag.

aseprite_sprite_info

Opens a sprite and returns width, height, frames, layers, and tags.

Example Codex Prompt

After registration and restart, ask Codex:

Use the aseprite MCP to create a 16x16 four-frame bouncing green slime.
Save the source as /Users/sunjiaxiang/workspace/tmp/slime.aseprite and export a GIF to /Users/sunjiaxiang/workspace/tmp/slime.gif.

Codex can call aseprite_create_sprite for the source file and aseprite_export or aseprite_cli for the GIF.

For native Aseprite actions:

Use the aseprite MCP command sequence tool to create a sprite in scriptBefore, run Aseprite's Flip and NewFrame commands, draw a few pixels in scriptAfter, then save it as /Users/sunjiaxiang/workspace/tmp/action-test.aseprite.

Codex can call aseprite_list_commands to discover command IDs and aseprite_command_sequence to run them.

Structured Sprite Example

examples/slime.json contains a four-frame sample. To inspect the Lua generated from it:

npm run build
node examples/create-slime.mjs

If Aseprite is installed:

node examples/create-slime.mjs > /tmp/slime.lua
/Applications/Aseprite.app/Contents/MacOS/aseprite --batch --script /tmp/slime.lua

Or through the MCP tool:

{
  "dryRun": false,
  "spec": {
    "width": 16,
    "height": 16,
    "output": "/Users/sunjiaxiang/workspace/tmp/test.aseprite",
    "operations": [
      {
        "type": "rect",
        "x": 2,
        "y": 2,
        "width": 12,
        "height": 12,
        "color": "#ffcc00ff"
      }
    ]
  }
}

Command Sequence Example

This dry-run request generates a Lua script that calls Aseprite's native command system. Some UI/document commands can be disabled in --batch; set requireEnabled: false only when you have verified the command still behaves correctly headlessly.

{
  "dryRun": true,
  "validateKnownCommands": true,
  "scriptBefore": "local sprite = Sprite(16, 16, ColorMode.RGB); app.activeSprite = sprite; app.activeImage:drawPixel(1, 1, Color{r=255,g=0,b=0,a=255})",
  "actions": [
    {
      "command": "Flip",
      "params": {
        "orientation": "horizontal"
      },
      "requireEnabled": false
    },
    {
      "command": "NewFrame",
      "params": {}
    }
  ],
  "scriptAfter": "app.activeImage:drawPixel(2, 2, Color{r=0,g=0,b=255,a=255})",
  "saveAs": "/Users/sunjiaxiang/workspace/tmp/action-test.aseprite"
}

For commands with newer or version-specific IDs, keep validateKnownCommands false and let the installed Aseprite validate the command at runtime.

Notes

  • transparentColor maps to Aseprite's transparent color index/mask color. Pass a numeric string like "0" or provide a palette and a matching hex color.
  • Command parameters are passed as a Lua table to Aseprite. Aseprite's CommandWithNewParams supports booleans, numbers, strings, rectangles/sizes, colors, and enum strings for many commands.
  • The MCP server does not reimplement Aseprite. It uses Aseprite itself for file creation, scripting, export, and conversion.
  • When no Aseprite executable is available, tests still verify TypeScript, Lua generation, and stdio MCP tool registration.
  • Full end-to-end image generation requires a real Aseprite executable. On this machine, /Users/sunjiaxiang/Applications/Aseprite.app/Contents/MacOS/aseprite is available and used for smoke tests.
  • npm run test:e2e creates real .aseprite files and exports PNGs through the MCP server.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选