ComfyUI MCP Server
ComfyUI MCP 服务器
1.概述
用于集成 ComfyUI 与 MCP 的服务器实现。
⚠️ 重要提示:此服务器需要正在运行的 ComfyUI 服务器。
您必须托管自己的 ComfyUI 服务器,
或者访问现有的 ComfyUI 服务器地址。
Related MCP server: ComfyUI MCP
2. 调试
2.1 ComfyUI 调试
python src/test_comfyui.py2.2 MCP调试
mcp dev src/server.py3.安装和配置
3.1 ComfyUI 配置
编辑
src/.env以设置 ComfyUI 主机和端口:COMFYUI_HOST=localhost COMFYUI_PORT=8188
3.2 添加自定义工作流程
要添加新工具,请将工作流 JSON 文件放在
workflows目录中,并在系统中将其声明为新工具。
4.内置工具
文本转图像
仅返回所生成图像的 URL。
要获取实际图像:
使用
download_image工具,或者直接在浏览器中访问该 URL。
下载图片
使用图像 URL 下载由其他工具(如
text_to_image)生成的图像。
运行工作流与文件
通过提供工作流 JSON 文件的路径来运行工作流。
# You should ask to agent like this. Run comfyui workflow with text_to_image.jsonCursorAI 的示例图像

使用 json 运行工作流
通过直接提供工作流 JSON 数据来运行工作流。
# You should ask to agent like this. Run comfyui workflow with this { "3": { "inputs": { "seed": 156680208700286, "steps": 20, ... (workflow JSON example) }
5. 如何运行
5.1 使用紫外线(推荐)
示例
mcp.json:{ "mcpServers": { "comfyui": { "command": "uv", "args": [ "--directory", "PATH/MCP/comfyui", "run", "--with", "mcp", "--with", "websocket-client", "--with", "python-dotenv", "mcp", "run", "src/server.py:mcp" ] } } }
5.2 使用 Docker
由于 Docker 容器不共享主机文件系统,因此使用
download_image将图像下载到本地文件夹可能会很困难。使用 Docker 时,请考虑:
在
.env中设置RETURN_URL=false以字节形式接收图像数据。将
.env中的COMFYUI_HOST设置为适当的地址(例如,host.docker.internal或服务器的 IP)。注意:使用二进制数据时,大型图像有效载荷可能会超出响应限制。
5.2.1 构建 Docker 镜像
# First build image
docker image build -t mcp/comfyui .{
"mcpServers": {
"comfyui": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-p",
"3001:3000",
"mcp/comfyui"
]
}
}
}5.2.2 使用现有图像
您也可以使用预先构建的图像。
{
"mcpServers": {
"comfyui": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-p",
"3001:3000",
"overseer66/mcp-comfyui"
]
}
}
}5.2.3 使用 SSE 传输
使用 Docker 运行 SSE 服务器:
docker run -i --rm -p 8001:8000 overseer66/mcp-comfyui-sse配置
mcp.json(如果需要,将 localhost 更改为您的 IP 或域):{ "mcpServers": { "comfyui": { "url": "http://localhost:8001/sse" } } }
注意:当添加新的工作流程作为工具时,您需要重建并重新部署 Docker 镜像以使其可用。
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 gradedqualityCmaintenanceA lightweight MCP server that bridges AI agents with a local ComfyUI instance to generate and iteratively refine images, audio, and video through conversational tool calls.41MIT
- 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.
- AlicenseAqualityDmaintenanceMCP server that provides image generation, captioning, and tagging via ComfyUI API, configurable for agent tools.43MIT
- AlicenseAqualityCmaintenanceMCP server that lets OpenCode (or any MCP-compatible AI coding tool) directly control ComfyUI for AI image generation.142MIT
Related MCP Connectors
MCP server for Flux AI image generation
Generate AI images, video, music, and sound effects, and upscale them, from any MCP client.
MCP server for NanoBanana AI image generation and editing
Appeared in Searches
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/Overseer66/comfyui-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server