调用本地 ComfyUI 实例的 API,用自然语言生成图片。
接入配置
选择客户端,复制配置,再按项目文档补齐环境变量。
claude mcp add hh-comfyui --env COMFYUI_API_BASE='<COMFYUI_API_BASE>' --env COMFYUI_WORKFLOWS_DIR='<COMFYUI_WORKFLOWS_DIR>' -- python -m hh_mcp_comfyui~/.codex/config.toml
[mcp_servers.hh-comfyui]
command = "python"
args = ["-m", "hh_mcp_comfyui"]
env = { COMFYUI_API_BASE = "<COMFYUI_API_BASE>", COMFYUI_WORKFLOWS_DIR = "<COMFYUI_WORKFLOWS_DIR>" }
# codex mcp add hh-comfyui --env COMFYUI_API_BASE='<COMFYUI_API_BASE>' --env COMFYUI_WORKFLOWS_DIR='<COMFYUI_WORKFLOWS_DIR>' -- python -m hh_mcp_comfyui~/.cursor/mcp.json
{
"mcpServers": {
"hh-comfyui": {
"command": "python",
"args": [
"-m",
"hh_mcp_comfyui"
],
"env": {
"COMFYUI_API_BASE": "<COMFYUI_API_BASE>",
"COMFYUI_WORKFLOWS_DIR": "<COMFYUI_WORKFLOWS_DIR>"
}
}
}
}.vscode/mcp.json
{
"servers": {
"hh-comfyui": {
"type": "stdio",
"command": "python",
"args": [
"-m",
"hh_mcp_comfyui"
],
"env": {
"COMFYUI_API_BASE": "<COMFYUI_API_BASE>",
"COMFYUI_WORKFLOWS_DIR": "<COMFYUI_WORKFLOWS_DIR>"
}
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"hh-comfyui": {
"command": "python",
"args": [
"-m",
"hh_mcp_comfyui"
],
"env": {
"COMFYUI_API_BASE": "<COMFYUI_API_BASE>",
"COMFYUI_WORKFLOWS_DIR": "<COMFYUI_WORKFLOWS_DIR>"
}
}
}
}claude_desktop_config.json
{
"mcpServers": {
"hh-comfyui": {
"command": "python",
"args": [
"-m",
"hh_mcp_comfyui"
],
"env": {
"COMFYUI_API_BASE": "<COMFYUI_API_BASE>",
"COMFYUI_WORKFLOWS_DIR": "<COMFYUI_WORKFLOWS_DIR>"
}
}
}
}.trae/mcp.json
{
"mcpServers": {
"hh-comfyui": {
"command": "python",
"args": [
"-m",
"hh_mcp_comfyui"
],
"env": {
"COMFYUI_API_BASE": "<COMFYUI_API_BASE>",
"COMFYUI_WORKFLOWS_DIR": "<COMFYUI_WORKFLOWS_DIR>"
}
}
}
}需要的环境变量
COMFYUI_API_BASECOMFYUI_WORKFLOWS_DIR
把占位值换成你自己的密钥;不要把密钥提交到代码仓库。