ComfyMCP Studio

ComfyMCP Studio

Generates 2D game assets (sprites, icons, tilesets, characters, animations) using AI workflows powered by ComfyUI with support for viewpoint control, style presets, and Unity export.

Category
Visit Server

README

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

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured