Skip to main content

Standalone MCP server + client for generating Anima-style images via a remote/local ComfyUI Server API.

Project description

animatool-mcp

一个独立的 MCP Server + Python 客户端:通过标准 ComfyUI Server API/prompt/history/<id>/view?...)在本地或云端 ComfyUI 上执行 Anima 工作流,并把生成图片以 base64 形式返回给 Cursor/Claude 等 MCP 客户端原生显示。

重要:本项目不需要安装到 ComfyUI/custom_nodes/。但你仍然需要一台可访问的 ComfyUI Server(本机或云端),并且云端已经把模型权重放到 models/ 下(按文件名加载)。


安装

pip install comfyui-animatool

Cursor 配置(MCP)

在你的项目中创建/编辑 .cursor/mcp.json

{
  "mcpServers": {
    "animatool": {
      "command": "animatool-mcp",
      "env": {
        "COMFYUI_URL": "http://127.0.0.1:8188"
      }
    }
  }
}

然后重启 Cursor,确保 MCP 状态为 Running。


云端/远程 ComfyUI(推荐做法)

COMFYUI_URL 该填什么?

  • 本机默认http://127.0.0.1:8188
  • 带路径前缀的反代:例如 https://example.com/comfy/(注意建议以 / 结尾,避免丢路径前缀)

1) 最佳实践:用隧道/VPN 让 ComfyUI 变成“内网可达”

ComfyUI 默认几乎没有鉴权能力,把它直接暴露到公网非常危险。建议使用:

  • Tailscale / ZeroTier / Cloudflare Tunnel / 自建 VPN
  • 或者反向代理 + HTTPS + 鉴权(Bearer / Basic / 自定义 Header)

2) 配置鉴权(可选)

本项目支持“有些云端需要、有些不需要”的混合场景。你可以在 .cursor/mcp.json 里通过 env 注入:

Bearer Token

{
  "mcpServers": {
    "animatool": {
      "command": "animatool-mcp",
      "env": {
        "COMFYUI_URL": "https://your-host.example.com:8188",
        "ANIMATOOL_BEARER_TOKEN": "YOUR_TOKEN"
      }
    }
  }
}

Basic Auth

{
  "mcpServers": {
    "animatool": {
      "command": "animatool-mcp",
      "env": {
        "COMFYUI_URL": "https://your-host.example.com:8188",
        "ANIMATOOL_BASIC_USER": "user",
        "ANIMATOOL_BASIC_PASS": "pass"
      }
    }
  }
}

自定义 Header(通用,推荐)

{
  "mcpServers": {
    "animatool": {
      "command": "animatool-mcp",
      "env": {
        "COMFYUI_URL": "https://your-host.example.com:8188",
        "ANIMATOOL_HEADERS_JSON": "{\"X-API-Key\":\"xxx\",\"CF-Access-Client-Id\":\"...\",\"CF-Access-Client-Secret\":\"...\"}"
      }
    }
  }
}

Windows/JSON 转义提示:ANIMATOOL_HEADERS_JSON 本身是一个 JSON 字符串,所以内部的双引号需要转义(如上所示)。

3) 自签名证书/SSL 校验

如果你的云端是自签名证书,可以临时关闭校验(不推荐长期使用):

{
  "mcpServers": {
    "animatool": {
      "command": "animatool-mcp",
      "env": {
        "COMFYUI_URL": "https://your-host.example.com:8188",
        "ANIMATOOL_SSL_VERIFY": "false"
      }
    }
  }
}

CLI(可选)

用于本地自测(不依赖 MCP 客户端):

animatool-generate --comfyui-url http://127.0.0.1:8188 --json-file payload.json

环境变量速查

环境变量 说明 默认值
COMFYUI_URL ComfyUI Server base URL http://127.0.0.1:8188
ANIMATOOL_TIMEOUT 请求超时秒 600
ANIMATOOL_POLL_INTERVAL 轮询间隔秒 1
ANIMATOOL_SSL_VERIFY SSL 校验 true
ANIMATOOL_BEARER_TOKEN Bearer Token (空)
ANIMATOOL_BASIC_USER / ANIMATOOL_BASIC_PASS Basic Auth (空)
ANIMATOOL_HEADERS_JSON 自定义 Header JSON (空)
ANIMATOOL_DOWNLOAD_IMAGES 是否保存图片到本地 false
ANIMATOOL_OUTPUT_DIR 本地保存目录 ./animatool_outputs
COMFYUI_MODELS_DIR models 目录(用于本机预检查) (空)
ANIMATOOL_CHECK_MODELS 是否启用预检查 true

常见问题

Q: 报错连接不上 /prompt?

  • 检查 COMFYUI_URL 是否可达(云端建议先在浏览器访问 COMFYUI_URL/system_stats
  • 如果有鉴权,请确认 /prompt/history/view 都在同一套鉴权规则下
    • 常见坑:反代只给 /prompt 放行了,但 /view 被 401/403 拦住,会导致“生成成功但取图失败”

Q: 报错找不到模型?

本工具提交的是一个包含 UNETLoader/CLIPLoader/VAELoader 的工作流模板,加载的是云端磁盘上的文件名。请确认云端 models/ 下至少存在:

  • models/diffusion_models/anima-preview.safetensors
  • models/text_encoders/qwen_3_06b_base.safetensors
  • models/vae/qwen_image_vae.safetensors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

comfyui_animatool-0.1.0.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

comfyui_animatool-0.1.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file comfyui_animatool-0.1.0.tar.gz.

File metadata

  • Download URL: comfyui_animatool-0.1.0.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for comfyui_animatool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f3b2c7a294b0345d158d9d5d7800aa88e489c3ec76036b434878e95952f8cba4
MD5 6aad42ab1452c5cd898e2c002fd98941
BLAKE2b-256 f5dee7250b4930e380e4e54eee3f58545983915634a2fcf5689921e1612f3338

See more details on using hashes here.

File details

Details for the file comfyui_animatool-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for comfyui_animatool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 149bb2e6a8027caf4f181166d9e79956d1ab5cf645a715ca8bd84d1aa8f6bbd8
MD5 2179cebfef872823a84c3cdfb3c97af1
BLAKE2b-256 c2abe888009eed483103a1dda79c9e294cbc01d5af247f13eb6a94c8242ff02c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page