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
访问服务器

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

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选