- Explore MCP Servers
- lalanikarim_comfy-mcp-server
Lalanikarim Comfy Mcp Server
What is Lalanikarim Comfy Mcp Server
lalanikarim_comfy-mcp-server is a server that utilizes the FastMCP framework to generate images based on user-defined prompts by interacting with a remote Comfy server.
Use cases
Use cases include generating artwork based on specific themes, creating visual assets for games, and producing images for marketing materials based on descriptive prompts.
How to use
To use lalanikarim_comfy-mcp-server, ensure you have Python 3.x installed along with the required packages. Set the necessary environment variables for your Comfy server URL and workflow JSON file, then run the script directly using the command ‘python comfy-mcp-server.py’.
Key features
Key features include the ability to generate images from prompts, integration with a remote Comfy server, and a straightforward setup process using environment variables.
Where to use
lalanikarim_comfy-mcp-server can be used in various fields such as digital art creation, game development, and any application requiring image generation from textual descriptions.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Lalanikarim Comfy Mcp Server
lalanikarim_comfy-mcp-server is a server that utilizes the FastMCP framework to generate images based on user-defined prompts by interacting with a remote Comfy server.
Use cases
Use cases include generating artwork based on specific themes, creating visual assets for games, and producing images for marketing materials based on descriptive prompts.
How to use
To use lalanikarim_comfy-mcp-server, ensure you have Python 3.x installed along with the required packages. Set the necessary environment variables for your Comfy server URL and workflow JSON file, then run the script directly using the command ‘python comfy-mcp-server.py’.
Key features
Key features include the ability to generate images from prompts, integration with a remote Comfy server, and a straightforward setup process using environment variables.
Where to use
lalanikarim_comfy-mcp-server can be used in various fields such as digital art creation, game development, and any application requiring image generation from textual descriptions.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
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
- Python 3.x installed.
- Required packages:
mcp,json,urllib,time,os. - Workflow file exported from Comfy UI. This code includes a sample
Flux-Dev-ComfyUI-Workflow.jsonwhich 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 using pip:
pip install "mcp[cli]"
Configuration
Set the following environment variables:
COMFY_URLto point to your Comfy server URL.COMFY_WORKFLOW_JSON_FILEto point to the absolute path of the API export json file for the comfyui workflow.PROMPT_NODE_IDto the id of the text prompt node.OUTPUT_NODE_IDto the id of the output node with the final image.
Example:
export COMFY_URL=http://your-comfy-server-url:port
export COMFY_WORKFLOW_JSON_FILE=/path/to/the/comfyui_workflow_export.json
export PROMPT_NODE_ID=6 # use the correct node id here
export OUTPUT_NODE_ID=9 # use the correct node id here
Usage
Run the script directly:
python comfy-mcp-server.py
The server will start and listen for requests to generate images based on the provided prompts.
Functionality
generate_image(prompt: str, ctx: Context) -> Image | str
This function generates an image using a specified prompt. It follows these steps:
- Checks if all the environment variable are set.
- Loads a prompt template from a JSON file.
- Submits the prompt to the Comfy server.
- Polls the server for the status of the prompt processing.
- Retrieves and returns the generated image once it’s ready.
Dependencies
mcp: For setting up the FastMCP server.json: For handling JSON data.urllib: For making HTTP requests.time: For adding delays in polling.os: For accessing environment variables.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










