Sponsored by Deepsite.site

Hh Mcp Comfyui

Created By
zjf26719 months ago
基于Model Context Protocol (MCP)的ComfyUI图像生成服务,通过API调用本地ComfyUI实例工作流生成图片,实现自然语言生图自由
Content

ComfyUI MCP 服务

Python 3.12+License

这是一个基于Model Context Protocol (MCP)的ComfyUI图像生成服务,通过API调用本地ComfyUI实例生成图片。

功能特性

  • 通过MCP协议提供图像生成服务,实现自然语言生图自由
  • 支持动态替换工作流中的提示词和尺寸等参数
  • 自动加载workflows目录下的工作流文件作为资源

安装依赖

1. 确保已安装Python 3.12+

2. 使用uv管理Python环境:

  • 安装uv:
    # On macOS and Linux.
    $ curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # On Windows.
    $ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
    
    # 更新uv(非必要操作):
    $ uv self update
    
    

测试运行服务

  • uvx方式
    $ uvx hh-mcp-comfyui
    
    INFO:hh_mcp_comfyui.server:Scanning for workflows in: C:\Users\tianw\AppData\Local\uv\cache\archive-v0\dp4MTo0f1qL0DdYF_BYCL\Lib\site-packages\hh_mcp_comfyui\workflows
    INFO:hh_mcp_comfyui.server:Starting ComfyUI MCP Server...
    
  • pip方式
    $ pip install hh_mcp_comfyui
    
    $ python -m hh_mcp_comfyui
    
    INFO:hh_mcp_comfyui.server:Scanning for workflows in: F:\Python\Python312\Lib\site-packages\hh_mcp_comfyui\workflows
    INFO:hh_mcp_comfyui.server:Starting ComfyUI MCP Server...
    

出现上面的信息表示服务启动成功

样例工作流copy到指定工作流目录:

点击下载获取样例工作流

特别注意:请找你本地对应的安装目录把下载好的样例工作流添加进去,然后重启你的MCP服务,可以使用如下方式找到你的安装目录的位置)

  • uvx

    $ uvx hh-mcp-comfyui
    
  • pip

    #首先安装依赖
    $ pip install hh_mcp_comfyui
    $ python -m hh_mcp_comfyui
    

使用方法

必须确保本地ComfyUI实例正在运行(默认地址: http://127.0.0.1:8188) ComfyUI安装地址

Cherry Studio、Cline、Cursor等客户端的使用方式

  • uvx MCP服务配置

    {
      "mcpServers": {
        "hh-mcp-comfyui": {
          "command": "uvx",
          "args": [
            "hh-mcp-comfyui"
          ]
        }
      }
    }
    
  • pip MCP服务配置

    需要先执行命令窗口先执行:pip install hh_mcp_comfyui

    {
      "mcpServers": {
        "hh-mcp-comfyui": {
          "command": "python",
          "args": [
            "-m",
            "hh_mcp_comfyui"
          ]
        }
      }
    }
    

测试

使用MCP Inspector测试服务端工具

  • uvx方式
    $ npx @modelcontextprotocol/inspector uvx hh-mcp-comfyui
    
  • pip方式
    $ pip install hh_mcp_comfyui
    $ npx @modelcontextprotocol/inspector python -m hh_mcp_comfyui
    

使用注意事项(针对没有用过comfyui的特别注意)

  • 默认工作流为t2image_bizyair_flux
  • 图片尺寸默认为1024x1024
  • 服务启动时会自动加载workflows目录下的所有JSON工作流文件
  • 如果你使用的是本项目中的样例工作流需要在comfyui中下载个插件,详细操作请查看:样例工作流插件安装教程
  • 如果使用你本地的comfyui工作流的话,先要保证你的工作流能在comfyui正常运行,然后需要导出(API)的JSON格式,并放入workflows目录中

如有问题可以到微信公众号中联系我:

公众号二维码

👆 扫码关注,发现更多好玩的!

Server Config

{
  "mcpServers": {
    "hh-mcp-comfyui": {
      "command": "uvx",
      "args": [
        "hh-mcp-comfyui"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
ChatWiseThe second fastest AI chatbot™
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
CursorThe AI Code Editor
Tavily Mcp
Serper MCP ServerA Serper MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Amap Maps高德地图官方 MCP Server
Playwright McpPlaywright MCP server
DeepChatYour AI Partner on Desktop