comfyui-mcp-server-node
A lightweight MCP server that bridges AI agents with a local ComfyUI instance to generate and iteratively refine images, audio, and video through conversational tool calls.
README
comfyui-mcp-server-node
This is improved node.js version of Joe Norton's python project (https://github.com/joenorton/comfyui-mcp-server).
A lightweight MCP (Model Context Protocol) server that bridges AI agents (like Cursor, Claude, etc.) with a local ComfyUI instance. It enables AI agents to generate and iteratively refine images, audio, and video through conversational tool calls.
Features
- Image Generation: Generate images using Stable Diffusion through ComfyUI
- Audio Generation: Generate audio/music using AceStep workflow
- Workflow System: PARAM_* placeholder system for easy workflow customization
- Asset Management: Track, view, and manage generated assets
- Job Management: Monitor queue, check job status, cancel jobs
- Configuration: List available models
Quick Start
Option 1: Via npx (for MCP clients)
No local clone needed. Add to your MCP client configuration (Cursor, Claude, etc.):
"comfyui": {
"command": "npx",
"args": ["-y", "comfyui-mcp-server-node"],
"env": {
"COMFYUI_URL": "http://localhost:8188",
"COMFY_MCP_WORKFLOW_DIR": "/path/to/workflows",
"COMFY_MCP_ASSET_TTL_HOURS": "24"
}
}
Note: ComfyUI must be running at
COMFYUI_URLbefore the MCP client connects.
Option 2: Local development
git clone https://github.com/yar3333/comfyui-mcp-server-node.git
cd comfyui-mcp-server-node
npm install
npm run build
Then start:
| Command | Mode |
|---|---|
npm start |
stdio (for MCP clients) |
npm run dev |
stdio with ts-node |
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
COMFYUI_URL |
ComfyUI base URL | http://localhost:8188 |
COMFY_MCP_WORKFLOW_DIR |
Path to workflow directory | ./workflows |
COMFY_MCP_ASSET_TTL_HOURS |
Asset time-to-live in hours | 24 |
API Tools
Generation Tools
| Tool | Description |
|---|---|
<workflows> |
Available workflows automatically published as tools |
regenerate |
Regenerate a previously generated asset |
Viewing Tools
| Tool | Description |
|---|---|
view_image |
View a generated image inline in chat |
Job Management Tools
| Tool | Description |
|---|---|
get_queue_status |
Get current queue status from ComfyUI |
get_job |
Get job status by prompt_id |
wait_for_job |
Wait for a job to complete with timeout |
list_assets |
List generated assets with optional filtering |
get_asset_metadata |
Get full metadata for a specific asset |
cancel_job |
Cancel a running job by prompt_id |
Configuration Tools
| Tool | Description |
|---|---|
list_checkpoint_models |
List available checkpoint models from ComfyUI |
list_unet_models |
List available UNet models in standard (safetensors) format |
list_unet_gguf_models |
List available UNet models in GGUF format |
Workflow Tools
| Tool | Description |
|---|---|
list_workflows |
List available workflows in the workflow directory |
run_workflow |
Run a specific workflow with parameter overrides |
Workflow System
Workflows are stored as JSON files in the workflows/ directory. The system automatically discovers workflows and exposes them as MCP tools. Parameters are defined using the PARAM_* placeholder system:
PARAM_INT_SEED- Integer parameter for seedPARAM_FLOAT_CFG- Float parameter for CFG scalePARAM_STR_SAMPLER_NAME- String parameter for sampler namePARAM_PROMPT- String parameter for prompt
Test
Prerequisites: ComfyUI running at http://localhost:8188, server built and started.
# Run the test client
npx ts-node test_client.ts
# With custom prompt
npx ts-node test_client.ts -p "a beautiful sunset over mountains"
# Run unit tests
npm test
Project Structure
comfyui-mcp-server-node/
├── src/
│ ├── comfyui_client.ts # HTTP client for ComfyUI API
│ ├── asset_processor.ts # Image processing utilities
│ ├── server.ts # Main entry point
│ ├── models/ # Data models
│ │ ├── asset.ts
│ │ └── workflow.ts
│ ├── managers/ # Manager classes
│ │ ├── workflow_manager.ts
│ │ └── asset_registry.ts
│ └── tools/ # MCP tool implementations
│ ├── helpers.ts
│ ├── generation.ts
│ ├── asset.ts
│ ├── job.ts
│ ├── configuration.ts
│ └── workflow.ts
├── workflows/ # Workflow JSON files
├── test_client.ts # Test client
├── package.json
├── tsconfig.json
└── README.md
Changelog
v2.x.x
- add
list_checkpoint_modelstool - add
list_unet_modelstool - add
list_unet_gguf_modelstool - remove http mode (stdio looks enough)
- remove
list_modelstool - remove publish system (caused confusion for AI agents; use custom output node instead)
- remove default parameters (caused confusion for AI agents; use regular PARAM_* instead)
- remove output folder setting (use custom output node instead; for example: https://gist.github.com/kevinjwesley-Collab/a548ee5e6244ebf905f0669e1d7d4958)
v1.x.x
- add
wait_for_jobtool
License
MIT
Author
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。