Comfy MCP Server
快適なMCPサーバー
FastMCP フレームワークを使用して、リモート Comfy サーバー経由のプロンプトに基づいて画像を生成するサーバー。
概要
このスクリプトは、FastMCPフレームワークを使用してサーバーを設定し、指定されたワークフローを使用してプロンプトに基づいて画像を生成します。リモートのComfyサーバーと連携してプロンプトを送信し、生成された画像を取得します。
Related MCP server: comfyui-mcp
前提条件
Python 用のuvパッケージとプロジェクト マネージャー。
Comfy UIからエクスポートされたワークフローファイル。このコードには、ここでは参照用としてのみ使用されるサンプルの
Flux-Dev-ComfyUI-Workflow.jsonが含まれています。ワークフローからエクスポートし、環境変数を適切に設定する必要があります。
ローカル開発に必要なパッケージをインストールできます。
uvx mcp[cli]構成
次の環境変数を設定します。
COMFY_URLComfy サーバーの URL を指します。COMFY_WORKFLOW_JSON_FILE、comfyui ワークフローの API エクスポート json ファイルの絶対パスを指します。PROMPT_NODE_IDテキストプロンプトノードの ID に設定します。OUTPUT_NODE_ID最終画像を含む出力ノードの ID に設定します。OUTPUT_MODE``urlまたはfileに設定して、必要な出力を選択します。
オプションとして、 Ollamaサーバーが実行中の場合は、プロンプトを生成するためにサーバーに接続できます。
OLLAMA_API_BASEollama が実行されている URL に設定します。PROMPT_LLMプロンプト生成用の ollama でホストされているモデルの名前に設定します。
例:
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使用法
Comfy MCP Server は次のコマンドで起動できます。
uvx comfy-mcp-serverClaude デスクトップ設定の例
{
"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",
}
}
}
}
機能性
generate_image(prompt: str, ctx: Context) -> Image | str
この関数は、指定されたプロンプトを使用して画像を生成します。以下の手順に従います。
すべての環境変数が設定されているかどうかを確認します。
JSON ファイルからプロンプト テンプレートを読み込みます。
プロンプトを Comfy サーバーに送信します。
プロンプト処理のステータスをサーバーにポーリングします。
生成された画像が準備できたら取得して返します。
generate_prompt(topic: str, ctx: Context) -> str
この関数は、指定されたトピックから包括的な画像生成プロンプトを生成します。
依存関係
mcp: FastMCP サーバーをセットアップします。json: JSON データを処理します。urllib: HTTP リクエストを行うため。time: ポーリングに遅延を追加します。os: 環境変数にアクセスします。langchain: トピックから画像生成プロンプトを生成するためのシンプルな LLM プロンプト チェーンを作成します。langchain-ollama: LangChain の ollama 固有のモジュール用。
ライセンス
このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceAn MCP server that enables high-quality image generation using OpenAI's GPT-Image-1 model with support for style variations and HD quality. It automatically downloads and saves generated images to a local directory as PNG files while managing metadata and batch processing.
- AlicenseAqualityCmaintenanceMCP server for ComfyUI — text-to-image, variations, img2img refine, upscale, image proxy, and workflow runner.15731MIT
- AlicenseAqualityAmaintenanceA secure MCP server for ComfyUI that enables AI assistants to generate images, run workflows, and manage jobs with built-in security controls.462MIT
- FlicenseNot gradedqualityBmaintenanceMCP server that connects local ComfyUI to AI agents, enabling natural language control of ComfyUI for creating workflows, generating images, and managing the queue.
Related MCP Connectors
MCP server for Flux AI image generation
MCP server for Wan AI video generation
MCP server for Luma Dream Machine AI video generation
Appeared in Searches
- Instructions for accessing Gmail messages programmatically using a cursor
- Exploring text-to-image generation techniques
- A flexible and user-friendly UI tool for extended functionalities
- A platform for finding and downloading stock images using keywords
- A platform for downloading images from Unsplash using specified keywords
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lalanikarim/comfy-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server