comfyui_mcp_server
generate_image and other workflows
claude mcp add --transport stdio zuojianghua-comfyui_mcp_server python D:\code\comfyui_mcp_server\server.py \ --env COMFY_URL="http://127.0.0.1:8188/"
How to use
This MCP server provides two core capabilities for ComfyUI: image generation using the ComfyUI text-to-image workflows and prompt optimization to improve generation results. It exposes an MCP-compatible endpoint that leverages the FastMCP framework to communicate with a locally running ComfyUI instance. Users can request new images by supplying textual prompts (and optional parameters like width, height, and seed), or request optimized prompts that can yield higher-quality outputs for a given concept. The server returns both local file paths and online-accessible URLs for the generated images, along with any relevant metadata such as seed and dimensions.
How to install
Prerequisites:
- Python 3.7+ installed
- ComfyUI instance running and accessible at the configured COMFY_URL
- FastMCP library installed in your Python environment
- Clone the MCP server repository:
git clone https://github.com/yourorg/comfyui_mcp_server.git
cd comfyui_mcp_server
- Create and activate a Python virtual environment (optional but recommended):
python -m venv venv
# Windows
venv\Scripts\activate.bat
# macOS/Linux
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Configure the server (example shown in README):
# Edit the configuration file if needed
# The example uses:
# COMFY_URL=http://127.0.0.1:8188/
- Run the server:
python D:\code\comfyui_mcp_server\server.py
- Verify the MCP endpoint is reachable using your MCP client and start issuing generate_image or optimize_image_prompt requests.
Note: If you prefer a different runtime (e.g., a Docker-based setup), adjust the mcp_config accordingly and ensure COMFY_URL points to your running ComfyUI instance.
Additional notes
Tips:
- Ensure ComfyUI is reachable from the MCP server via the COMFY_URL you provide; firewall rules may block access.
- The server can automatically adjust image dimensions to multiples of 8; consider specifying width/height if you have strict requirements.
- Seed handling: a random seed is generated if not provided, which helps with output diversity.
- If you encounter timeout errors, you may increase the timeout in the mcp_config to accommodate slower image generation times.
- The server returns both local file paths and online URLs; you can store results or display images in a UI accordingly.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP