comfyui
lightweight Python-based MCP (Model Context Protocol) server for local ComfyUI
claude mcp add --transport stdio joenorton-comfyui-mcp-server python server.py \ --env PORT="9000 (default MCP port; adjust if needed)" \ --env COMFYUI_PORT="8188 (default ComfyUI port; ensure ComfyUI is running)"
How to use
The ComfyUI MCP Server exposes a local MCP interface that delegates execution to a local ComfyUI instance. After starting ComfyUI and launching the MCP server, clients can connect to http://127.0.0.1:9000/mcp and issue tools such as generate_image, view_image, regenerate, and a suite of management and workflow tools. This setup supports iterative image, audio, and video generation through a conversational workflow, with server-side defaults and optional asset provenance.
Once connected, you can operate in two modes: direct tool usage and agent integration. In direct usage, you can call tools to generate assets, inspect results, and manage jobs. For AI agents, create a project-scoped .mcp.json file pointing to the local MCP endpoint, enabling seamless tool calls like generate_image, list_assets, get_job, and publish_asset. The server also supports stateful iteration via regenerate, explicit asset identity for reliable follow-ups, and optional image viewing through view_image to provide inline feedback to the agent.
How to install
Prerequisites:
- Python 3.8+ installed locally
- Lua-based or Python-based dependencies if required by ComfyUI (as per ComfyUI installation)
- A local ComfyUI instance running (preferred port 8188 as in the quick start)
Installation steps:
- Clone the repository and install dependencies
git clone https://github.com/joenorton/comfyui-mcp-server.git
cd comfyui-mcp-server
pip install -r requirements.txt
- Ensure ComfyUI is installed and running locally (in a separate terminal)
cd <ComfyUI_dir>
python main.py --port 8188
- Start the MCP server
python server.py
The MCP server will listen at http://127.0.0.1:9000/mcp by default.
- (Optional) Run the test client to verify
python test_client.py
Prerequisites recap: Python environment ready, ComfyUI running on the expected port, and network access to localhost for both services.
Additional notes
Tips and caveats:
- If you change the ComfyUI port, ensure both ComfyUI and server.py are aligned (the default is 8188 for ComfyUI and 9000 for MCP).
- The MCP server supports stateful iteration via regenerate and asset identity via get_asset_metadata; this helps maintain consistent prompts across steps.
- Publish-related features require a functioning publish workflow in ComfyUI; ensure workflows exist in the workflows/ directory for automatic exposure.
- If an agent client expects a different MCP type, you can switch the type field in your .mcp.json to http or streamable-http as needed.
- Test client and test prompts can be used to validate defaults configured via config files, environment variables, or set_defaults calls.
Related MCP Servers
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
mcp-yfinance
Real-time stock API with Python, MCP server example, yfinance stock analysis dashboard
comfy
A server using FastMCP framework to generate images based on prompts via a remote Comfy server.
cloudwatch-logs
MCP server from serkanh/cloudwatch-logs-mcp
servicenow-api
ServiceNow MCP Server and API Wrapper
the -company
TheMCPCompany: Creating General-purpose Agents with Task-specific Tools