Logo Aseprite MCP

Aseprite MCP

Cộng đồng
ext-sakamoro

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

Nhà phát hànhext-sakamoro
Kho mãAsepriteMCP
Ngôn ngữPython
Bản fork
5
Sao
23
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Aseprite MCP cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    23 sao và 5 bản fork từ kho mã được liên kết.

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

Dùng MCP Aseprite MCP với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Aseprite MCP, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Aseprite MCP làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Aseprite MCP.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "asepritemcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Aseprite MCP, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Aseprite MCP.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Aseprite MCP giúp tôi làm việc này không?
Aseprite MCP
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Aseprite MCP.

Câu hỏi thường gặp

Máy chủ MCP Aseprite MCP dùng để làm gì?

Aseprite MCP là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Aseprite MCP với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Aseprite MCP với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Aseprite MCP với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Aseprite MCP, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Aseprite MCP với TypingMind?

Aseprite MCP hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP Aseprite MCP cung cấp những công cụ nào trong TypingMind?

Aseprite MCP cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Aseprite MCP không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Aseprite MCP yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇