Skip to main content
Glama

ComfyMCP Studio

ComfyMCP Studio is an MCP (Model Context Protocol) server for generating 2D game assets using AI workflows powered by ComfyUI.

What you get

  • ComfyUI-backed generation

    • Production-quality SDXL/SD1.5 workflows

  • High-quality outputs by default

    • Render at preset resolution (SDXL-native) then downscale for cleaner details

  • Consistent character animations (img2img)

    • Generate multiple poses from a single reference image

  • Viewpoint control with ControlNet (top-down / side / front / 3/4)

    • Generate top-down assets with stronger camera-angle consistency

  • Presets for common game styles

    • Icon, character, tileset, top-down presets, pixel presets

  • Post-processing

    • Resize, remove background, add outline

  • Unity export + batch generation

Related MCP server: Layer.ai MCP Server

Requirements

  • Python: 3.10+

  • ComfyUI: running locally (default 127.0.0.1:8188)

  • Stable Diffusion checkpoint

    • SDXL recommended (default configured: sd_xl_base_1.0.safetensors)

  • (Optional) ControlNet models

    • Required only for generate_with_viewpoint / generate_topdown_asset

Installation

# Navigate to the project
cd path/ComfyAI-MCP-GameAssets

# Create virtual environment
python -m venv venv
venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Configuration

Copy .env.example to .env and configure:

BACKEND_TYPE=comfyui
COMFYUI_HOST=127.0.0.1
COMFYUI_PORT=8188
COMFYUI_CHECKPOINT=sd_xl_base_1.0.safetensors

OUTPUT_DIR=./output
UNITY_ASSETS_DIR=C:/Projects/MyGame/Assets

ComfyUI setup

  • Start ComfyUI (example):

python main.py --listen 0.0.0.0 --port 8188
  • Checkpoint

    • Make sure your checkpoint exists in ComfyUI (example: ComfyUI/models/checkpoints/).

    • This server reads COMFYUI_CHECKPOINT from .env.

ControlNet setup (for viewpoint locking)

If you use viewpoint tools, you must install a ControlNet model in: ComfyUI/models/controlnet/

  • SDXL depth model (example)

    • diffusers_xl_depth_full.safetensors

Restart ComfyUI after adding models.

If you see HTTP 400 Bad Request when calling /prompt, it usually means:

  • The controlnet_model name is wrong, or

  • The ControlNet nodes/models are not installed/available.

Run as MCP server (Windsurf)

Add this to your MCP settings (or copy from mcp_config.json):

{
  "mcpServers": {
    "comfymcp-studio": {
      "command": "python",
      "args": ["-m", "server.main"],
      "cwd": "path/ComfyAI-MCP-GameAssets",
      "env": {
        "BACKEND_TYPE": "comfyui",
        "COMFYUI_HOST": "127.0.0.1",
        "COMFYUI_PORT": "8188"
      }
    }
  }
}

Tools

  • ping - Backend health check

  • list_available_presets - Lists preset names + configs

  • generate_sprite - Single image generation from prompt

  • generate_icons - Batch icons + optional atlas

  • generate_tileset - Tileable tiles by theme

  • generate_character - Character generation (prompt-driven)

  • generate_character_animations - Img2img multi-pose animations from a reference image

  • generate_with_viewpoint - ControlNet depth-guided generation for stable camera angle

  • generate_topdown_asset - Convenience wrapper for top-down assets (prop, character, creature, tile, effect)

  • process_image - Resize / remove background / add outline

  • create_sprite_atlas - Combine images to spritesheet

  • export_to_unity - Export output PNGs into a Unity project folder

  • batch_generate - Batch generation with prompts

Presets

You can list presets via list_available_presets.

General

  • default - General purpose game asset

  • icon / icon_item - Game icons

  • character / character_portrait - Character sprites

  • tileset - Seamless tileable textures

  • environment - Background/environment art

  • prop - Game props (3/4 view)

Top-down (ControlNet)

  • topdown_prop - Top-down props

  • topdown_character - Top-down characters

  • topdown_creature - Top-down creatures/enemies

  • topdown_tile - Top-down tiles

Effects & UI

  • effect / magic_effect - VFX and spell effects

  • ui_button / ui_frame - UI elements

Creatures

  • creature - Fantasy creatures/monsters

Style-specific

  • handpainted - Hand-painted art style

  • flat_ui - Flat design UI

  • isometric - Isometric game assets

  • pixel_art / pixel_character - Pixel art style

  • pixel_16 / pixel_32 / pixel_64 - Specific pixel sizes

Testing

Quick smoke test

python test_generate.py --list-presets
python test_generate.py --preset icon --size 256 --steps 20 --seed 42 --save

ControlNet viewpoint tests

# Top-down prop (depth ControlNet)
python test_controlnet.py --tests prop --size 512 --strength 0.95 --save

# Top-down character (wrapper tool)
python test_controlnet.py --tests character --size 512 --strength 1.0 --save

# Multi-view for the same object
python test_controlnet.py --tests multi --views topdown,side,front,3/4 --size 512 --strength 0.90 --save

Character animation tests (img2img)

# Requires a local reference image
python test_character_animation.py --ref path\\to\\reference.png --poses idle,walking,attacking --denoise 0.35 --seed 42 --save

Output

Generated images are saved under OUTPUT_DIR when you call tools with save_to_file=true. Typical folders:

  • output/controlnet/

  • output/icons/

  • output/characters/

  • output/tilesets/

Troubleshooting

  • HTTP 400 Bad Request from ComfyUI /prompt

    • Check ControlNet model file exists in ComfyUI/models/controlnet/

    • Verify the exact filename passed as controlnet_model

    • Restart ComfyUI after installing models

  • Results still not top-down

    • Increase control_strength (try 0.90 to 1.0)

    • Use preset=topdown_character/topdown_prop

  • Duplicated/fragmented weapons/armor

    • Add explicit constraints to prompt: single character, one sword, one shield

License

MIT

Available Tools

13 tools
batch_generateA

Generate multiple assets in batch from a list of prompts.

Args:
    prompts: List of asset descriptions
    preset: Style preset to use for all generations
    width: Override width for all assets
    height: Override height for all assets
    seed: Base seed for reproducibility (each prompt gets seed+index)
    save_to_file: Whether to save all images to disk

Returns:
    JSON with all generated assets

Inputs: prompts (required), preset, width, height, +2 more. Returns: result

create_sprite_atlasB

Combine multiple images into a sprite atlas/spritesheet.

Args:
    images_base64: List of base64 encoded images
    columns: Number of columns in the atlas
    padding: Padding between sprites in pixels
    save_to_file: Whether to save atlas to disk
    filename: Custom filename for the atlas

Returns:
    JSON with the combined atlas as base64

Inputs: images_base64 (required), columns, padding, save_to_file, +1 more. Returns: result

export_to_unityB

Export a generated asset directly to a Unity project.

Args:
    image_base64: Base64 encoded image to export
    asset_name: Name for the asset file (without extension)
    asset_type: Unity folder type (Sprites, Textures, UI, etc.)
    subfolder: Optional subfolder within the asset type folder

Returns:
    JSON with export status and file path

Inputs: image_base64 (required), asset_name (required), asset_type, subfolder. Returns: result

generate_characterA

Generate character sprites with optional multiple poses.

Args:
    description: Character description (e.g., "a knight in silver armor")
    poses: List of poses to generate (e.g., ["idle", "walking", "attacking"])
    preset: Style preset to use (default: character). Options: character, character_portrait, pixel_character
    width: Sprite width in pixels
    height: Sprite height in pixels
    seed: Base seed for reproducibility (each pose gets seed+index)
    steps: Override generation steps (higher = better quality but slower)
    save_to_file: Whether to save images to disk

Returns:
    JSON with base64 images for each pose

Inputs: description (required), poses, preset, width, +4 more. Returns: result

generate_character_animationsA

Generate multiple character poses with consistent identity using img2img.

This tool takes a reference character image and generates variations with different
poses while maintaining the same character identity (outfit, colors, style).

Args:
    reference_image_base64: Base64 encoded reference character image (front/idle view)
    description: Character description (e.g., "a knight in silver armor")
    poses: List of poses to generate (e.g., ["walking", "attacking", "jumping"])
    denoise: How much to change from reference (0.2=very similar, 0.5=more different). Default 0.35
    seed: Random seed for reproducibility (same seed = same variations)
    preset: Style preset to use (default: character)
    pose_denoise_boost: Additional denoise for action poses (default: 0.25)
    save_to_file: Whether to save images to disk

Returns:
    JSON with base64 images for each pose, all maintaining character identity

Example workflow:
    1. First generate a base character with generate_character(description, poses=["idle"])
    2. Take the best result's image_base64 as reference_image_base64
    3. Call this tool with poses=["walking", "running", "attacking"]

Inputs: reference_image_base64 (required), description (required), poses (required), denoise, +4 more. Returns: result

generate_iconsA

Generate multiple game icons from a list of descriptions.

Args:
    prompts: List of icon descriptions (e.g., ["sword", "shield", "potion"])
    preset: Style preset to use (default: icon). Options: icon, icon_item, flat_ui
    size: Icon size in pixels (square)
    seed: Base seed for reproducibility (each icon gets seed+index)
    create_atlas: Whether to combine icons into a single spritesheet
    save_to_file: Whether to save images to disk

Returns:
    JSON with base64 images for each icon and optional atlas

Inputs: prompts (required), preset, size, seed, +2 more. Returns: result

generate_spriteA

Generate a single game sprite from a text description.

Args:
    prompt: Description of the sprite to generate (e.g., "a blue slime monster")
    preset: Style preset to use (default, pixel_16, pixel_32, flat_ui, handpainted, etc.)
    width: Override width in pixels
    height: Override height in pixels
    negative_prompt: Additional things to avoid (appended to preset's negative prompt)
    seed: Random seed for reproducibility
    steps: Number of generation steps (more = higher quality but slower)
    save_to_file: Whether to save the image to disk
    filename: Custom filename (auto-generated if not provided)

Returns:
    JSON with base64 image data and metadata

Inputs: prompt (required), preset, width, height, +5 more. Returns: result

generate_tilesetA

Generate a set of tileable game tiles.

Args:
    theme: Overall theme for the tileset (e.g., "forest", "dungeon", "sci-fi")
    tile_types: List of tile types to generate (e.g., ["ground", "wall", "water"])
    preset: Style preset to use (default: tileset). Options: tileset, topdown_tile
    tile_size: Size of each tile in pixels (square)
    seed: Base seed for reproducibility (each tile gets seed+index)
    save_to_file: Whether to save images to disk

Returns:
    JSON with base64 images for each tile type

Inputs: theme (required), tile_types (required), preset, tile_size, +2 more. Returns: result

generate_topdown_assetA

Simplified tool to generate top-down 2D game assets with guaranteed viewpoint.

This is a convenience wrapper around generate_with_viewpoint specifically for
top-down games (RPG, strategy, etc.).

Args:
    prompt: Description of the asset (e.g., "wooden treasure chest", "stone well")
    asset_type: Type of asset - "prop", "character", "creature", "tile", "effect"
    size: Output size in pixels (square)
    control_strength: How strictly to enforce top-down view (0.5-1.0)
    seed: Random seed for reproducibility
    save_to_file: Whether to save the image to disk (default: True for reliability)

Returns:
    JSON with file_path to generated image

Inputs: prompt (required), asset_type, size, control_strength, +2 more. Returns: result

generate_with_viewpointA

Generate a game asset with precise camera viewpoint control using ControlNet.

This tool uses depth maps to guide the generation, ensuring consistent camera angles
like top-down, side view, front view, etc.

Args:
    prompt: Description of the asset to generate (e.g., "a wooden barrel")
    view_type: Camera angle - "topdown", "side", "front", "3/4"
    shape: Object shape hint - "flat", "sphere", "cylinder", "box"
    preset: Style preset to use (default: topdown_prop)
    controlnet_model: ControlNet model (default: diffusers_xl_depth_full.safetensors)
    control_strength: How strongly to follow viewpoint (0.0-1.0, default: 0.8)
    width: Output width in pixels
    height: Output height in pixels
    seed: Random seed for reproducibility
    save_to_file: Whether to save the image to disk

Returns:
    JSON with base64 image data and metadata

Note:
    Requires ControlNet models installed in ComfyUI. Common depth models:
    - diffusers_xl_depth_full.safetensors (SDXL)
    - control_v11f1p_sd15_depth.pth (SD1.5)

Inputs: prompt (required), view_type, shape, preset, +6 more. Returns: result

list_available_presetsB

List all available style presets for asset generation.

Returns:
    JSON object containing all presets with their configurations

Inputs: no named parameters. Returns: result

pingA

Check if the MCP server and backend are healthy.

Returns:
    Status message indicating server and backend health

Inputs: no named parameters. Returns: result

process_imageB

Apply post-processing operations to an image.

Args:
    image_base64: Base64 encoded input image
    operations: List of operations to apply: "resize", "remove_background", "add_outline"
    resize_width: Target width for resize operation
    resize_height: Target height for resize operation
    outline_color: Hex color for outline (e.g., "#000000")
    outline_thickness: Thickness of outline in pixels
    save_to_file: Whether to save processed image to disk

Returns:
    JSON with processed image as base64

Inputs: image_base64 (required), operations (required), resize_width, resize_height, +3 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 13 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting different asset types or workflows (e.g., generate_sprite vs generate_tileset vs generate_character). However, generate_character and generate_character_animations have some overlap in generating character poses, though their descriptions clarify that the latter uses img2img for identity consistency. generate_with_viewpoint and generate_topdown_asset also share similar functionality, but the latter is described as a convenience wrapper.

    Naming Consistency5/5

    All tool names follow a consistent snake_case pattern with clear verb_noun structure (e.g., generate_sprite, create_sprite_atlas, export_to_unity). The naming is predictable and readable throughout the set, with no mixing of conventions or inconsistent verb styles.

    Tool Count5/5

    13 tools is well-scoped for a game asset generation server. Each tool serves a specific purpose in the asset creation pipeline, from generation (e.g., generate_sprite, generate_tileset) to processing (process_image) and export (export_to_unity). The count supports comprehensive workflows without being overwhelming.

    Completeness5/5

    The toolset provides complete coverage for game asset generation workflows. It includes generation tools for various asset types (sprites, characters, icons, tilesets), batch operations, post-processing (process_image), export functionality (export_to_unity), sprite atlas creation, and utility tools (list_available_presets, ping). There are no obvious gaps for the stated domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    Appeared in Searches