Logo vun Aseprite MCP

Aseprite MCP

Communautéit
ext-sakamoro

Aseprite MCP server (Python) — programmatic pixel art via Claude/LLM. Palette / batch / Lua script builder / error handling / test coverage.

Editeurext-sakamoro
RepositoryAsepriteMCP
SproochPython
Forks
5
Stären
23
Disponibel Tools
0
Transporttypstdio
Kategorien
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    Aseprite MCP stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    23 Stären an 5 Forks aus dem verlinkte Repository.

Aseprite MCP Tools v2.0

日本語版はこちら | macOS Setup Guide

A powerful Python MCP (Model Context Protocol) server for programmatic interaction with Aseprite, featuring enhanced error handling, configuration management, batch processing, and more!

🚀 What's New in v2.0

  • 🛡️ Comprehensive Error Handling: Custom exceptions with detailed, actionable error messages
  • 🔧 Configuration Management: Pydantic-based settings with JSON/YAML support
  • 📝 Advanced Logging: Structured logging with performance metrics
  • 🎨 Palette Management: Create, apply, and extract color palettes
  • ⚡ Batch Processing: Process multiple files in parallel
  • 🏗️ Lua Script Builder: Clean, type-safe Lua script generation
  • 🔒 Enhanced Security: Input validation and path traversal protection
  • 🧪 Full Test Coverage: Comprehensive unit tests

📋 Features

Core Drawing Tools

  • Canvas Operations: Create sprites, add layers and frames
  • Drawing Tools: Pixels, lines, rectangles, circles, and fill operations
  • Export Tools: Export to various formats with scaling and layer support

New Palette Tools (v2.0)

  • Preset Palettes: GameBoy, NES, PICO-8, CGA, Monochrome, Sepia
  • Custom Palettes: Create and apply custom color schemes
  • Palette Extraction: Extract colors from existing images
  • Color Remapping: Replace colors throughout sprites

Batch Processing (v2.0)

  • Batch Resize: Resize multiple sprites maintaining aspect ratio
  • Batch Export: Convert multiple files to different formats
  • Batch Palette Apply: Apply palettes to multiple files
  • Custom Scripts: Run Lua scripts on file sets

🔧 Installation

Requirements

  • Python 3.13+
  • Aseprite (must be installed separately)

Claude Desktop Configuration

Using UV (Recommended)

json
{
  "mcpServers": {
    "aseprite": {
      "command": "/opt/homebrew/bin/uv",
      "args": [
        "--directory",
        "/path/to/aseprite-mcp",
        "run",
        "-m",
        "aseprite_mcp"
      ],
      "env": {
        "ASEPRITE_PATH": "/path/to/aseprite"
      }
    }
  }
}

Using Python

json
{
  "mcpServers": {
    "aseprite": {
      "command": "python",
      "args": ["-m", "aseprite_mcp"],
      "cwd": "/path/to/aseprite-mcp",
      "env": {
        "ASEPRITE_PATH": "/path/to/aseprite"
      }
    }
  }
}

Install Dependencies

bash
pip install -r requirements.txt

⚙️ Configuration

Environment Variables

bash
export ASEPRITE_PATH="/Applications/Aseprite.app/Contents/MacOS/aseprite"
export ASEPRITE_MCP_LOG_LEVEL="INFO"

Configuration File (config.json)

json
{
  "aseprite_path": "/path/to/aseprite",
  "canvas": {
    "max_width": 10000,
    "max_height": 10000
  },
  "batch": {
    "max_parallel_jobs": 4,
    "continue_on_error": true
  },
  "log_level": "INFO",
  "security": {
    "allowed_directories": ["/home/user/sprites"],
    "max_file_size": 104857600
  }
}

Configuration File (config.yaml)

yaml
aseprite_path: /path/to/aseprite

canvas:
  max_width: 10000
  max_height: 10000
  default_color_mode: RGBA

batch:
  max_parallel_jobs: 4
  continue_on_error: true

log_level: INFO

security:
  allowed_directories:
    - /home/user/sprites
  max_file_size: 104857600

📖 Usage Examples

Basic Drawing Operations

python
# Create a new sprite
await create_canvas(320, 240, "my_sprite.aseprite")

# Draw pixels
await draw_pixels("my_sprite.aseprite", [
    {"x": 10, "y": 10, "color": "FF0000"},  # Red
    {"x": 11, "y": 10, "color": "00FF00"},  # Green
    {"x": 12, "y": 10, "color": "0000FF"}   # Blue
])

# Draw shapes
await draw_rectangle("my_sprite.aseprite", 50, 50, 100, 80, "FFFF00", fill=True)
await draw_circle("my_sprite.aseprite", 160, 120, 30, "FF00FF", fill=False)
await draw_line("my_sprite.aseprite", 0, 0, 320, 240, "FFFFFF", thickness=2)

# Fill area
await fill_area("my_sprite.aseprite", 100, 100, "00FFFF", tolerance=10)

Layer and Frame Management

python
# Add a new layer
await add_layer("my_sprite.aseprite", "Background")

# Add animation frames
await add_frame("my_sprite.aseprite", after_frame=0)

Palette Operations

python
# Apply preset palette
await apply_preset_palette("my_sprite.aseprite", "gameboy")
# Available presets: gameboy, gameboy-pocket, nes, pico-8, cga, monochrome, sepia

# Create custom palette
await create_palette("my_sprite.aseprite", [
    "264653", "2A9D8F", "E9C46A", "F4A261", "E76F51"
])

# Extract palette from image
await extract_palette_from_image("reference.png", max_colors=16)

# Get palette information
await get_palette_info("my_sprite.aseprite")

# Remap colors
await remap_colors("my_sprite.aseprite", {
    "FF0000": "00FF00",  # Red to Green
    "0000FF": "FFFF00"   # Blue to Yellow
})

Export Operations

python
# Export single file
await export_sprite("my_sprite.aseprite", "output.png", scale=2.0)

# Export with frame range
await export_sprite("animation.aseprite", "frames.gif", frame_range="1-10")

# Export each layer separately
await export_layers("my_sprite.aseprite", "layers/", format="png")

Batch Processing

python
# Resize multiple sprites
await batch_resize(
    input_dir="sprites/",
    output_dir="sprites_small/",
    scale=0.5,
    file_pattern="*.aseprite"
)

# Export batch to PNG
await batch_export(
    input_dir="sprites/",
    output_dir="exports/",
    format="png",
    scale=2.0
)

# Apply palette to multiple files
await batch_apply_palette(
    input_dir="sprites/",
    palette_file="my_palette.aseprite",
    create_backup=True
)

# Run custom Lua script on multiple files
await batch_process_custom(
    input_dir="sprites/",
    lua_script="app.activeSprite:flatten()",
    output_dir="flattened/"
)

🏗️ Architecture

Project Structure

aseprite-mcp/
├── aseprite_mcp/
│   ├── core/
│   │   ├── commands.py      # Aseprite command execution
│   │   ├── config.py        # Configuration management
│   │   ├── exceptions.py    # Custom exceptions
│   │   ├── logging.py       # Logging system
│   │   ├── lua_builder.py   # Lua script builder
│   │   └── validation.py    # Input validation
│   └── tools/
│       ├── batch.py         # Batch processing
│       ├── canvas.py        # Canvas operations
│       ├── drawing.py       # Drawing tools
│       ├── export.py        # Export functions
│       └── palette.py       # Palette management
├── tests/                   # Unit tests
├── examples/                # Example scripts
└── config.example.yaml      # Configuration example

Error Handling

python
try:
    result = await create_canvas(-100, 200, "test.aseprite")
except ValidationError as e:
    print(f"Validation failed: {e}")
except AsepriteError as e:
    print(f"Aseprite error: {e}")

Lua Script Builder

python
from aseprite_mcp.core.lua_builder import LuaBuilder

builder = LuaBuilder()
builder.create_sprite(200, 200)
builder.begin_transaction()
builder.set_color("FF0000")
builder.for_loop("i", 0, 10)
    builder.draw_pixel("i * 10", "i * 10")
builder.end_loop()
builder.end_transaction()
builder.save_sprite("output.aseprite")

script = builder.build()  # Returns clean Lua code

🧪 Testing

Run all tests:

bash
pytest tests/ -v

Run specific test:

bash
pytest tests/test_validation.py -v

Run demo script:

bash
python examples/demo_improvements.py

📝 Logging

Logs include:

  • Operation tracking
  • Performance metrics
  • Error details with context
  • Structured JSON output (optional)

Example log:

2024-06-11 10:30:45 - aseprite_mcp - INFO - Operation: create_canvas
2024-06-11 10:30:45 - aseprite_mcp - INFO - Canvas created successfully
2024-06-11 10:30:45 - aseprite_mcp - INFO - Performance: create_canvas took 0.234s

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Follow the coding standards:
    • Use type hints
    • Add input validation
    • Include error handling
    • Write unit tests
    • Update documentation
  4. Submit a pull request

📄 License

MIT License - see LICENSE file for details

🙏 Credits

  • Original implementation: Divyansh Singh
  • v2.0 improvements: Enhanced error handling, configuration, batch processing, and more

📚 Additional Resources

Aseprite MCP MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal Aseprite MCP verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „Dësen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

Aseprite MCP als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu Aseprite MCP an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "asepritemcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vu Aseprite MCP. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu Aseprite MCP.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat Aseprite MCP?
Aseprite MCP
Jo. Ech hunn et gelies.
Dat hunn ech mat Aseprite MCP fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server Aseprite MCP benotzt?

Aseprite MCP ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech Aseprite MCP MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir Aseprite MCP mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat Aseprite MCP MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann Aseprite MCP verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech Aseprite MCP MCP mat TypingMind?

Aseprite MCP leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt Aseprite MCP MCP an TypingMind zur Verfügung?

Aseprite MCP stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir Aseprite MCP MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann Aseprite MCP eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇