ComfyUI MCP Server
by joenorton
The ComfyUI MCP Server is a lightweight Python server that allows AI agents to generate images using a local ComfyUI instance via the Model Context Protocol (MCP). It facilitates programmatic image generation by receiving requests over WebSocket.
Last updated: N/A
What is ComfyUI MCP Server?
This server is a Python-based MCP server that acts as an interface between AI agents and a local ComfyUI instance. It receives image generation requests from agents, forwards them to ComfyUI, and returns the generated image URLs.
How to use ComfyUI MCP Server?
To use the server, first install ComfyUI and the required Python dependencies. Then, clone the repository, prepare your ComfyUI workflows in the workflows/
directory, start ComfyUI, and finally, run the MCP server using python server.py
. You can then send image generation requests using the provided client or your own custom client.
Key features of ComfyUI MCP Server
Supports flexible workflow selection
Accepts dynamic parameters like prompt, width, height, and model
Returns image URLs served by ComfyUI
Uses WebSocket for communication
Use cases of ComfyUI MCP Server
Integrating ComfyUI image generation into AI agent workflows
Automating image generation tasks
Creating dynamic image generation services
Programmatically controlling ComfyUI from other applications
FAQ from ComfyUI MCP Server
What is MCP?
What is MCP?
MCP stands for Model Context Protocol, a protocol for communication between AI agents and models.
What port does the server listen on?
What port does the server listen on?
The server listens on ws://localhost:9000 by default.
Where should I put my ComfyUI workflows?
Where should I put my ComfyUI workflows?
Place your API-format workflow files in the workflows/
directory.
How do I change the image generation parameters?
How do I change the image generation parameters?
Modify the payload
in client.py
to change parameters like prompt
, width
, height
, workflow_id
, or model
.
What if my model is not found?
What if my model is not found?
Ensure your chosen model
exists in <ComfyUI_dir>/models/checkpoints/
.