ComfyUI MCP Server
A lightweight Python MCP server: an agent generates and iteratively refines images, audio and video in a local ComfyUI
- 411 ★ on the repository
- Last commit
- Apache-2.0
Extended access
Why this level
- The agent launches jobs on your ComfyUI and loads your GPU
- `publish_asset` writes and compresses files in a web project's directory, and the server listens on a local address without authorization
Install
- Works in
Manual install
git clone https://github.com/joenorton/comfyui-mcp-server.git && cd comfyui-mcp-server && pip install -r requirements.txtNeeds a running ComfyUI, for example python main.py --port 8188 in its folder.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The agent launches jobs on your ComfyUI and loads your GPU
- `publish_asset` writes and compresses files in a web project's directory, and the server listens on a local address without authorization
This is third-party code. Review the repository files before installing.
What it does
The server connects an MCP client to your local ComfyUI. The agent calls `generate_image` with a prompt and receives a picture, while the rest of the parameters come from defaults: width, height, steps, model. For audio there is `generate_song`, which needs tags and lyrics. The main idea of this version is refinement. Every file gets its own identifier, and `regenerate` repeats a generation with changed parameters without rewriting the prompt. `view_image` shows a finished picture to the agent itself so it can judge it and adjust the prompt. The agent follows long jobs with `get_queue_status` and `get_job` and stops an unwanted one with `cancel_job`. ComfyUI workflows go into the workflows folder as JSON files and become tools by themselves. The placeholders PARAM_PROMPT, PARAM_INT_STEPS and PARAM_FLOAT_CFG turn into tool parameters. `publish_asset` copies a finished picture into a web project's directory and compresses it to a size limit, 600 KB by default.
Who it is for. For people who already run ComfyUI and want Cursor, Claude Code or n8n to generate images for a website or project on their own.
Good fit when
- You want the agent to generate a hero image for a website and drop it into `public/gen` under the right name
- A result is almost right and needs another pass with a different step count or model, without a new prompt
- You have your own ComfyUI workflow and want to expose it to the agent as a tool with parameters
- You want to make a track from tags and lyrics through the `generate_song` workflow and wait for it with `get_job`
- You need a project image library with a manifest: `publish_asset` updates it by `manifest_key`
Not a fit when
- ComfyUI is not running locally: the server only passes jobs to it and generates nothing itself
- You need cloud generation without your own GPU: the project is built around a local ComfyUI instance
- You need to expose the server to a network: it listens on a local address without authorization and should not be published without a reverse proxy
- File identifiers must survive a restart: they are valid only for the current server session
Example request
Generate a hero image for a coffee shop website, look at the result, make a lighter variant and publish the best one as hero.webp.MCP
- Transport
- http
- Authentication
- not required
Environment variables
COMFY_MCP_DEFAULT_*- Defaults for generation such as size and step count; the name ends with the parameter name
Limitations
It needs a running ComfyUI (port 8188 by default), Python and the packages from requirements.txt: requests, mcp and Pillow. Models must sit in the models/checkpoints directory inside ComfyUI.
The server listens on 127.0.0.1:9000 without authorization, so do not expose it outside without a reverse proxy or protection of your own. Audio comes from a ready workflow, while video and other scenarios need their own files in the workflows folder.
The publish directory is detected automatically among public/gen, static/gen and assets/gen. If the ComfyUI output cannot be found, set the path once with the `set_comfyui_output_root` tool. For Comfy Desktop and nonstandard installs this is the recommended step.
How to disable. Stop the `python server.py` process and remove the comfyui-mcp-server entry from `.mcp.json` or your client's MCP settings. Persistent defaults sit in `~/.config/comfy-mcp/config.json`, which you can delete by hand.
FAQ
How do I connect ComfyUI to Cursor or Claude Code over MCP?
Start ComfyUI, then `python server.py` from the project folder. Add a server with type streamable-http and the address http://127.0.0.1:9000/mcp to `.mcp.json`, then restart the client. If auto-discovery fails, change the type to http.
How can I check the server without an MCP client?
Run `python test_client.py`, optionally with `-p` and your own prompt. The client connects to the server, lists the tools and defaults, generates a picture and prints the result details.
How do I refine an image without rewriting the prompt?
The `regenerate` tool takes the file's `asset_id` and new parameter values. `get_asset_metadata` returns the file's provenance, including the workflow history.
How do I add my own ComfyUI workflow?
Put the workflow JSON into the workflows folder and place PARAM_PROMPT, PARAM_INT_STEPS or PARAM_FLOAT_CFG where needed. The tool name comes from the file name, so my_workflow.json gives a my_workflow tool.
Where are the defaults for size and step count set?
The order is: values in the call, then those set through `set_defaults`, then `~/.config/comfy-mcp/config.json`, then COMFY_MCP_DEFAULT_ variables, then built-in ones. `set_defaults` can persist values between runs.
Discussion
No questions or reviews yet.
Related
MCP serversThe official Comfy Org MCP server: an agent runs workflows in your local ComfyUI and collects the finished images
An MCP server for generating images and video from the agent: several models, a large prompt library and parallel tasks
A local MCP server for editing and analyzing images: the agent crops frames, finds objects and reads text from photos
Recraft's remote MCP server: an agent draws raster and vector images, edits a region, removes the background and upscales
Hosted Magic Hour MCP server: the agent generates and edits video, images and audio through the service API
ClipForge MCP
ClipForge
ClipForge MCP builds a vertical video from a topic or a product link: stock footage, Edge TTS voiceover and captions, no keys, composed with FFmpeg
Comparison with similar tools
Entries that share the main search query, and how they differ.
| Entry | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| ComfyUI MCP Server (this entry) | no | not required | 411 | |
| Comfy MCP | yes | not required | 311 | the official Comfy Org MCP server for running workflows, while this server adds iteration, file identifiers and publishing into a web project |
| MeiGen AI Design MCP | yes | API key | 1,793 | generation through several cloud models, while this server works only with your local ComfyUI |
README in short
The page walks from a two-to-three-minute quick start to the tool list and configuration reference. Separate notes explain how the current streamable HTTP version differs from the earlier WebSocket one. The detailed parameter reference and the architecture notes live in the docs folder.