modelscope·@PurlieuStudios/comfyui-mcp
暂无描述。
AI-powered image generation for game development via ComfyUI and the Model Context Protocol
ComfyUI MCP Server is a Model Context Protocol (MCP) server that bridges ComfyUI's powerful workflow-based AI image generation with modern development workflows. Originally designed for Godot game development, it can be used with any MCP-compatible client to generate game assets, concept art, and visual content dynamically.
Python 3.10 or higher
python --version # Should be 3.10+
ComfyUI installed and running
http://localhost:8188http://localhost:8188 in your browserStable Diffusion models
models/checkpoints/ directory# Clone the repository
git clone https://github.com/purlieu-studios/comfyui-mcp.git
cd comfyui-mcp
# Install the package
pip install -e .
# For development (includes testing and linting tools)
pip install -e ".[dev]"
# Verify installation
python -c "from comfyui_mcp import ComfyUIClient; print('Installation successful!')"
Option 1: Environment Variables (Recommended for getting started)
# Required
export COMFYUI_URL="http://localhost:8188"
# Optional
export COMFYUI_TIMEOUT="120.0"
export COMFYUI_OUTPUT_DIR="./generated_images"
Option 2: TOML Configuration File
Create comfyui.toml in your project root:
[comfyui]
url = "http://localhost:8188"
timeout = 120.0
output_dir = "./generated_images"
See docs/CONFIGURATION.md for comprehensive configuration options.
import asyncio
from comfyui_mcp import ComfyUIClient, ComfyUIConfig, WorkflowPrompt
async def generate_image():
# Configure the client
config = ComfyUIConfig(url="http://localhost:8188")
async with ComfyUIClient(config) as client:
# Check ComfyUI server health
if not await client.health_check():
print("ComfyUI server is not responding!")
return
# Create a simple workflow
workflow = WorkflowPrompt(
prompt={
"3": {
"class_type": "KSampler",
"inputs": {
"seed": 42,
"steps": 20,
"cfg": 7.0,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1.0
}
}
}
)
# Submit and wait for completion
prompt_id = await client.submit_workflow(workflow)
print(f"Workflow submitted: {prompt_id}")
result = await client.wait_for_completion(
prompt_id=prompt_id,
poll_interval=1.0,
timeout=300.0
)
print(f"Generation complete! Result: {result}")
# Run the async function
asyncio.run(generate_image())
1. Configure MCP Server
Add to your .mcp.json:
{
"mcpServers": {
"comfyui-mcp": {
"command": "python",
"args": ["-m", "comfyui_mcp.server"],
"env": {
"COMFYUI_URL": "http://localhost:8188",
"COMFYUI_OUTPUT_DIR": "./generated_images"
}
}
}
}
More Configuration Examples:
Complete .mcp.json configuration examples are available in examples/mcp/:
| Example | Description | Use Case |
|---|---|---|
[basic.mcp.json](… |
ModelContextProtocol服务器适用于Magic UI,它通过提供诸如跑马灯、动画、特效和互动背景等组件的代码,使AI助手能够轻松为Web应用程序实现UI组件。
一个提供网页开发工具的MCP服务器,例如屏幕捕捉功能,可以让AI代理获取并处理用户屏幕的截图。
一个由人工智能驱动的工具,可以从自然语言描述生成现代UI组件,并与流行的IDE集成,以简化UI开发工作流程。
通过模型上下文协议(MCP)将Blender连接到Claude AI,使Claude能够直接与Blender交互并对其进行控制,从而实现AI辅助的3D建模、场景操作和渲染。
集成了Dify AI API,为Ant Design组件提供代码生成服务,支持文本和图像输入,并具备流式处理能力。
一种模型上下文协议服务器,提供创建、管理和导出Excalidraw绘图的API功能,支持SVG、PNG和JSON等多种格式。