I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

servidor Comfy-MCP
Un servidor que utiliza el marco FastMCP para generar imágenes basadas en las indicaciones a través de un servidor remoto remoto.
3 years
Works with Finder
1
Github Watches
4
Github Forks
18
Github Stars
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 eitherurl
orfile
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.
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
export OUTPUT_MODE=file
Usage
Comfy MCP Server can be launched by the following command:
uvx comfy-mcp-server
Example Claude Desktop Config
{
"mcpServers": {
"Comfy MCP Server": {
"command": "/path/to/uvx",
"args": [
"comfy-mcp-server"
],
"env": {
"COMFY_URL": "http://your-comfy-server-url:port",
"COMFY_WORKFLOW_JSON_FILE": "/path/to/the/comfyui_workflow_export.json",
"PROMPT_NODE_ID": "6",
"OUTPUT_NODE_ID": "9",
"OUTPUT_MODE": "file",
}
}
}
}
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.
generate_prompt(topic: str, ctx: Context) -> str
This function generates a comprehensive image generation prompt from specified topic.
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. -
langchain
: For creating simple LLM Prompt chain to generate image generation prompt from topic. -
langchain-ollama
: For ollama specific modules for LangChain.
License
This project is licensed under the MIT License - see the LICENSE file for details.
相关推荐
Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.
Confidential guide on numerology and astrology, based of GG33 Public information
A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.
Converts Figma frames into front-end code for various mobile frameworks.
Advanced software engineer GPT that excels through nailing the basics.
Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.
Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx
Una puerta de enlace de API unificada para integrar múltiples API de explorador de blockchain similar a Esterscan con soporte de protocolo de contexto modelo (MCP) para asistentes de IA.
Espejo dehttps: //github.com/agentience/practices_mcp_server
Espejo de https: //github.com/bitrefill/bitrefill-mcp-server
Reviews

user_1gtQwaSl
As a devoted user of comfy-mcp-server, I can confidently say that this server is a game-changer for managing Minecraft servers. The seamless integration and user-friendly interface designed by lalanikarim make it an indispensable tool. Its robust performance and ease of use save me considerable time and effort. Highly recommend!