Comfy (Stable Diffusion)
About
Integrates with ComfyUI to enable text-to-image generation using customizable Stable Diffusion workflows.
Details
- Author
- lalanikarim
- Repository
- lalanikarim/comfy-mcp-server
- GitHub stars
- 31
- Downloads
- 11,792
- License
- MIT License
- Categories
- Productivity, Developer Tools, Design, AI, Media, Project Management, Infrastructure, Frontend, Other
- Tags
- #integration
Jump to
- generate_image(prompt, ctx) submits a prompt and returns the generated image.
- generate_prompt(topic, ctx) creates an image generation prompt from a topic.
- Supports optional Ollama integration for prompt generation.
- Works with any exported ComfyUI workflow JSON file.
- Outputs images as URLs or local files via OUTPUT_MODE.
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Comfy (Stable Diffusion)Command (node, npx, python, etc.)/path/to/uvxArguments-
Argument 1
comfy-mcp-server
Environment-
COMFY_URL
http://your-comfy-server-url:port -
OUTPUT_MODE
file -
OUTPUT_NODE_ID
9 -
PROMPT_NODE_ID
6 -
COMFY_WORKFLOW_JSON_FILE
/path/to/the/comfyui_workflow_export.json
Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
-
Argument 1
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Set the following environment variables:
- COMFY_URL to point to your Comfy server URL.
- COMFY_WORKFLOW_JSON_FILE to point to the absolute path of the API export json file for the comfyui workflow.
- PROMPT_NODE_ID to the id of the text prompt node.
- OUTPUT_NODE_ID to the id of the output node with the final image.
- OUTPUT_MODE to either url or file to select desired output.
Optionally, if you have an Ollama server running, you can connect to it for prompt generation.
- OLLAMA_API_BASE to the url where ollama is running.
- PROMPT_LLM to the name of the model hosted on ollama for prompt generation.
generate_image
Generates an image using a specified prompt. Parameters: prompt (string), ctx (Context)
generate_prompt
Generates a comprehensive image generation prompt from a specified topic. Parameters: topic (string), ctx (Context)
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"comfy (stable diffusion)": {
"env": {
"COMFY_URL": "http://your-comfy-server-url:port",
"OUTPUT_MODE": "file",
"OUTPUT_NODE_ID": "9",
"PROMPT_NODE_ID": "6",
"COMFY_WORKFLOW_JSON_FILE": "/path/to/the/comfyui_workflow_export.json"
},
"args": [
"comfy-mcp-server"
],
"command": "/path/to/uvx"
}
}
}
Linux
{
"env": {
"COMFY_URL": "http://your-comfy-server-url:port",
"OUTPUT_MODE": "file",
"OUTPUT_NODE_ID": "9",
"PROMPT_NODE_ID": "6",
"COMFY_WORKFLOW_JSON_FILE": "/path/to/the/comfyui_workflow_export.json"
},
"args": [
"comfy-mcp-server"
],
"command": "/path/to/uvx"
}
Macos
{
"env": {
"COMFY_URL": "http://your-comfy-server-url:port",
"OUTPUT_MODE": "file",
"OUTPUT_NODE_ID": "9",
"PROMPT_NODE_ID": "6",
"COMFY_WORKFLOW_JSON_FILE": "/path/to/the/comfyui_workflow_export.json"
},
"args": [
"comfy-mcp-server"
],
"command": "/path/to/uvx"
}
Windows
{
"env": {
"COMFY_URL": "http://your-comfy-server-url:port",
"OUTPUT_MODE": "file",
"OUTPUT_NODE_ID": "9",
"PROMPT_NODE_ID": "6",
"COMFY_WORKFLOW_JSON_FILE": "/path/to/the/comfyui_workflow_export.json"
},
"args": [
"comfy-mcp-server"
],
"command": "/path/to/uvx"
}
Comfy MCP Server
> A server using FastMCP framework to generate images based on prompts via a remote Comfy server.
Overview
This script sets up a server using the FastMCP framework to generate images based on prompts using a specified workflow. It interacts with a remote Comfy server to submit prompts and retrieve generated images.
Prerequisites
- uv package and project manager for Python.
- Workflow file exported from Comfy UI. This code includes a sample Flux-Dev-ComfyUI-Workflow.json which is only used here as reference. You will need to export from your workflow and set the environment variables accordingly.
You can install the required packages for local development:
uvx mcp[cli]
Configuration
Set the following environment variables:
- COMFY_URL to point to your Comfy server URL.
- COMFY_WORKFLOW_JSON_FILE to point to the absolute path of the API export json file for the comfyui workflow.
- PROMPT_NODE_ID to the id of the text prompt node.
- OUTPUT_NODE_ID to the id of the output node with the final image.
- OUTPUT_MODE to either url or file to select desired output.
Optionally, if you have an Ollama server running, you can connect to it for prompt generation.
- OLLAMA_API_BASE to the url where ollama is running.
- PROMPT_LLM to the name of the model hosted on ollama for prompt generation.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





