An image generation server that connects to a local ComfyUI instance via its API, supporting dynamic workflows.
这是一个基于Model Context Protocol (MCP)的ComfyUI图像生成服务,通过API调用本地ComfyUI实例生成图片。
Cherry Studio中使用效果
Cline中使用效果
1. 确保已安装Python 3.12+
2. 使用uv管理Python环境:
# 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 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 install hh_mcp_comfyui
$ python -m hh_mcp_comfyui
INFO:hh_mcp_comfyui.server:Scanning for workflows in: F:\Python\Python313\Lib\site-packages\hh_mcp_comfyui\workflows
INFO:hh_mcp_comfyui.server:Starting ComfyUI MCP Server...
出现上面的信息表示服务启动成功
必须确保本地ComfyUI实例正在运行(默认地址: http://127.0.0.1:8188) ComfyUI安装地址
{
"mcpServers": {
"hh-mcp-comfyui": {
"command": "uvx",
"args": [
"hh-mcp-comfyui@latest"
],
"env": {
"COMFYUI_API_BASE": "http://127.0.0.1:8188",
"COMFYUI_WORKFLOWS_DIR": "/path/hh-mcp-comfyui/workflows"
}
}
}
}
需要先执行命令窗口先执行:pip install hh_mcp_comfyui
{
"mcpServers": {
"hh-mcp-comfyui": {
"command": "python",
"args": [
"-m",
"hh_mcp_comfyui"
],
"env": {
"COMFYUI_API_BASE": "http://127.0.0.1:8188",
"COMFYUI_WORKFLOWS_DIR": "/path/hh-mcp-comfyui/workflows"
}
}
}
}
前提是已安装docker
{
"mcpServers": {
"hh-mcp-comfyui": {
"command": "docker",
"args": [
"run",
"--net=host",
"-v",
"/path/hh-mcp-comfyui/workflows:/app/workflows",
"-i",
"--rm",
"zjf2671/hh-mcp-comfyui:latest"
],
"env": {
"COMFYUI_API_BASE": "http://127.0.0.1:8188"
}
}
}
}
(注意:使用下面uvx或pip方式找到你的安装工作流目录的位置把样例工作流添加进去,然后重启你的MCP服务)
uvx
$ uvx hh-mcp-comfyui
pip
#首先安装依赖
$ pip install hh_mcp_comfyui
$ python -m hh_mcp_comfyui
使用MCP Inspector测试服务端工具
$ npx @modelcontextprotocol/inspector uvx hh-mcp-comfyui
$ pip install hh_mcp_comfyui
$ npx @modelcontextprotocol/inspector python -m hh_mcp_comfyui
$ npx @modelcontextprotocol/inspector docker run --net=host -i --rm zjf2671/hh-mcp-comfyui
然后点击连接如图即可调试:
t2image_bizyair_flux
/path/hh_mcp_comfyui/workflows
目录中将工作流JSON文件放入/path/hh_mcp_comfyui/workflows
目录中
如果是uvx和pip启动方式请看上面 《样例工作流copy到指定工作流目录》 的使用方式
重启服务自动加载新工作流
.
├── .gitignore
├── .python-version
├── pyproject.toml
├── README.md
├── uv.lock
├── example/ # 示例工作流目录
│ └── workflows/
│ ├── i2image_bizyair_sdxl.json
│ ├── t2image_bizyair_flux.json
│ ├── i2image_cogview4.json
│ └── t2image_sd1.5.json
├── src/ # 源代码目录
│ └── hh_mcp_comfyui/
│ ├── comfyui_client.py # ComfyUI客户端实现
│ ├── server.py # MCP服务主文件
│ └── workflows/ # 工作流文件目录
# Clone the repository.
$ git clone https://github.com/zjf2671/hh-mcp-comfyui.git
$ cd hh-mcp-comfyui
# Initialized venv
$ uv venv
# Activate the virtual environment.
$ .venv\Scripts\activate
# Install dependencies.
$ uv lock
Resolved 30 packages in 1ms
# sync dependencies.
$ uv sync
Resolved 30 packages in 2.54s
Audited 29 package in 0.02ms
$ uv --directory 你本地安装目录/hh-mcp-comfyui run hh-mcp-comfyui
INFO:__main__:Scanning for workflows in: D:\cygitproject\hh-mcp-comfyui\src\hh_mcp_comfyui\workflows
INFO:__main__:Registered resource: workflow://t2image_bizyair_flux -> t2image_bizyair_flux.json
INFO:__main__:Starting ComfyUI MCP Server...
$ npx @modelcontextprotocol/inspector uv --directory 你本地安装目录/hh-mcp-comfyui run hh-mcp-comfyui
{
"mcpServers": {
"hh-mcp-comfyui": {
"command": "uv",
"args": [
"--directory",
"项目绝对路径(例如:D:/hh-mcp-comfyui)",
"run",
"hh-mcp-comfyui"
],
"env": {
"COMFYUI_API_BASE": "http://127.0.0.1:8188",
"COMFYUI_WORKFLOWS_DIR": "/path/hh-mcp-comfyui/workflows"
}
}
}
}
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)An MCP server for interacting with the Tatara blockchain ecosystem. Requires configuration for the Tatara RPC endpoint and a wallet private key.
Access real-time Maven Central intelligence for fast and accurate dependency information.
Advanced evaluation tools for AI safety, alignment, and performance using the Trustwise API.
A server for CodeFuse-CGM, a graph-integrated large language model designed for repository-level software engineering tasks.
An AI-driven platform for frontend semantic cognition and automation.
Provides local access to Cursor chat history for AI analysis and insights, with no external services or API keys required.
MCP Server that exposes Creatify AI API capabilities for AI video generation, including avatar videos, URL-to-video conversion, text-to-speech, and AI-powered editing tools.
Manages Infrastructure as Code (IaC) operations using Ansible and Terraform. Requires external tools and manual setup.
Fetch comprehensive information about CRAN packages, including READMEs, metadata, and search functionality.
Securely execute shell commands with whitelisting, resource limits, and timeout controls for LLMs.