- Home
- MCP servers
- ComfyUI
ComfyUI
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"purlieustudios-comfyui-mcp": {
"command": "python",
"args": [
"-m",
"comfyui_mcp.server"
],
"env": {
"COMFYUI_URL": "http://localhost:8188",
"COMFYUI_OUTPUT_DIR": "./generated_images"
}
}
}
}ComfyUI MCP Server exposes ComfyUI workflows as MCP tools so you can generate game assets, concept art, and visual content from an MCP client. It enables async generation, real-time progress, and a structured way to integrate AI-assisted artwork into game development pipelines.
How to use
You use the MCP server by running it as a local process and connecting an MCP client to issue tools like generate_image, list_workflows, get_workflow_status, cancel_workflow, and load_workflow. Start the server using the standard Python module command, then configure your MCP client to point at the server and the ComfyUI instance it wraps.
How to install
Prerequisites: you need Python 3.10 or higher and a running instance of ComfyUI (accessible at http://localhost:8188). Ensure you have Stable Diffusion models placed in ComfyUI’s models/checkpoints/ directory for asset generation.
-
Clone the MCP server repository and enter its directory.
-
Create and activate a Python virtual environment.
-
Install the package in editable mode with development dependencies.
-
Verify the installation by importing the client in Python.
-
Start the MCP server using the explicit command shown below.
Configuration and startup details
To run the MCP server locally, use the following command snippet, which starts the server in stdio mode and passes the required environment variables that point to your ComfyUI instance and the output directory for generated images.
Configuration example (stdio startup)
{
"mcpServers": {
"comfyui_mcp": {
"type": "stdio",
"name": "comfyui_mcp",
"command": "python",
"args": ["-m", "comfyui_mcp.server"],
"env": {
"COMFYUI_URL": "http://localhost:8188",
"COMFYUI_OUTPUT_DIR": "./generated_images"
}
}
}
}
Environment variables you will use
The server relies on a few environment variables to locate the ComfyUI instance and to determine where generated assets should be written.
-
COMFYUI_URL: URL of the running ComfyUI server (for example, http://localhost:8188)
-
COMFYUI_OUTPUT_DIR: Directory path where generated images will be saved (for example, ./generated_images)
MCP Tools
Available MCP tools let you drive asset generation from code or automation. These are the core capabilities exposed by the server.
Workflow templates and usage
Pre-built workflow templates provide common asset-generation patterns (characters, items, environments). You can load templates, customize prompts, and submit them through the MCP client to generate assets in batches or iteratively.
Starting the MCP Server
Run the server as a Python module to start listening for MCP client requests. Use the following command from your terminal.
Python API Client usage
The Python API client lets you health-check the ComfyUI server, submit workflows, monitor progress, and download results. Use a ComfyUIConfig with the ComfyUIClient to manage connections and perform operations programmatically.
Troubleshooting tips
If you cannot connect to ComfyUI, verify that ComfyUI is running and that the COMFYUI_URL in your environment matches the actual server URL. Check that the output directory exists and is writable. Review server logs for errors related to workflow execution or resource availability.
Examples
Run a simple generation flow by loading the character-portrait template, adjust prompt and seed, then submit via the MCP client. Retrieve progress and download the resulting images when complete.
Notes
This MCP server is designed for production-ready usage with retry logic, error handling, and logging built in. It supports asynchronous operation and real-time progress updates via WebSockets when available.
Available tools
generate_image
Generate images using workflow templates by submitting a workflow prompt through the MCP interface.
list_workflows
List available workflow templates that you can apply to generate assets.
get_workflow_status
Check the progress or status of a running workflow.
cancel_workflow
Cancel a currently running workflow.
load_workflow
Load and use a custom workflow file within a generation session.