Back to MCP directory
publicPublicdnsLocal runtime

comfyui_mcp_server

ComfyUI的MCP服务,提供图像生成和提示词优化功能,支持自动调整尺寸和随机种子生成。

article

README

🚀 ComfyUI MCP 服务器

ComfyUI MCP 服务器基于模型上下文协议(MCP),专为 ComfyUI 打造,可提供图像生成与提示优化服务,助力用户高效产出优质图像。

🚀 快速开始

在使用本服务器前,请确保满足以下要求:

  • Python 3.7+
  • 运行中的 ComfyUI 实例
  • 安装了 FastMCP 库

✨ 主要特性

  • 图像生成:借助 ComfyUI 的文本转图像工作流,轻松生成图像。
  • 提示优化:对图像生成提示进行优化,提升生成效果,获得更优质的图像结果。

🔧 技术细节

服务器架构

核心组件

  • FastMCP 框架实现
  • ComfyUI API 集成
  • 结果获取的轮询机制

关键功能

  • generate_image:根据文本提示创建图像。
  • optimize_image_prompt:增强输入提示,提升图像生成效果。

技术规范

  • 自动调整图像尺寸为 8 的倍数。
  • 随机种子生成,确保输出结果的多样性。
  • 返回本地文件路径和在线可访问的 URL。

📦 安装指南

配置

以下是服务器的配置示例:

{
  "mcpServers": {
    "ComfyUI_MCP_Server": {
      "disabled": false,
      "timeout": 600,
      "command": "python",
      "args": [
        "D:\\code\\comfyui_mcp_server\\server.py"
      ],
      "env": {
        "COMFY_URL": "http://127.0.0.1:8188/"
      },
      "transportType": "stdio"
    }
  }
}

请根据实际情况修改配置内容。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client