Supports environment variable configuration for ComfyUI connections through .env files, allowing users to customize host and port settings.
Supports containerized deployment of the MCP server through Docker, with instructions for building and configuring the Docker image.
Provides integration with ComfyUI, a Python-based stable diffusion interface, enabling AI image generation through tools like text_to_image and download_image capabilities.
ComfyUI MCP Server
1. Overview
- A server implementation for integrating ComfyUI with MCP.
- ⚠️ IMPORTANT: This server requires a running ComfyUI server.
- You must either host your own ComfyUI server,
- or have access to an existing ComfyUI server address.
2. Debugging
2.1 ComfyUI Debugging
2.2 MCP Debugging
3. Installation and Configuration
3.1 ComfyUI Configuration
- Edit
src/.env
to set ComfyUI host and port:
3.2 Adding Custom Workflows
- To add new tools, place your workflow JSON files in the
workflows
directory and declare them as new tools in the system.
4. Built-in Tools
- text_to_image
- Returns only the URL of the generated image.
- To get the actual image:
- Use the
download_image
tool, or - Access the URL directly in your browser.
- Use the
- download_image
- Downloads images generated by other tools (like
text_to_image
) using the image URL.
- Downloads images generated by other tools (like
- run_workflow_with_file
- Run a workflow by providing the path to a workflow JSON file.
- example image of CursorAI
- Run a workflow by providing the path to a workflow JSON file.
- run_workflow_with_json
- Run a workflow by providing the workflow JSON data directly.
- Run a workflow by providing the workflow JSON data directly.
5. How to Run
5.1 Using UV (Recommended)
- Example
mcp.json
:
5.2 Using Docker
- Downloading images to a local folder with
download_image
may be difficult since the Docker container does not share the host filesystem. - When using Docker, consider:
- Set
RETURN_URL=false
in.env
to receive image data as bytes. - Set
COMFYUI_HOST
in.env
to the appropriate address (e.g.,host.docker.internal
or your server's IP). - Note: Large image payloads may exceed response limits when using binary data.
- Set
5.2.1 Build Docker Image
5.2.2 Using Existing Images
Also you can use prebuilt image.
5.2.3 Using SSE Transport
- Run the SSE server with Docker:
- Configure
mcp.json
(change localhost to your IP or domain if needed):
NOTE: When adding new workflows as tools, you need to rebuild and redeploy the Docker images to make them available.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A server that integrates ComfyUI with MCP, allowing users to generate images and download them through natural language interactions.
Related MCP Servers
- AsecurityAlicenseAqualityA powerful MCP server for fetching and transforming web content into various formats (HTML, JSON, Markdown, Plain Text) with ease.Last updated -414612TypeScriptMIT License
- -securityAlicense-qualityThe Comfy MCP Server uses the FastMCP framework to generate images from prompts by interacting with a remote Comfy server, allowing automated image creation based on workflow configurations.Last updated -7PythonMIT License
- -securityAlicense-qualityA MCP server that integrates with Cursor IDE to generate images based on text descriptions using JiMeng AI, allowing users to create and save custom images directly within their development environment.Last updated -82PythonMIT License
- -security-license-qualityA TypeScript-based MCP server that lets users generate images using OpenAI's dall-e-3 model by providing a prompt and image name.Last updated -1