MCP ComfyUI节点框架
  ](https://nodejs.org/)
一种先进的模型上下文协议(MCP)服务器框架,用于从研究论文、GitHub存储库和其他来源自动生成ComfyUI节点。
🚀 概述
MCP ComfyUI节点框架是一个强大的工具,它利用人工智能从各种来源自动分析和生成ComfyUI结点,包括:
- 研究论文 (arXiv,学术出版物)
- GitHub存储库 (开源项目)
- 文档 (API文件、技术规范)
- 代码示例 (实施参考)
主要特点
- 🤖 AI驱动的分析:使用高级LLM集成进行智能内容分析
- 🔧 自动节点生成:使用正确的键入创建生产就绪的ComfyUI节点
- 📚 多源支持:处理论文、存储库和文档
- 🎯 质量控制:多个质量级别(起草、开发、生产)
- 🔄 批处理:高效生成多个节点
- 📖 综合文档:自动生成README、安装指南和示例
- 🧪 测试框架:包括测试生成和验证
- 🔌 MCP集成:完全模型上下文协议兼容性
🛠️ 安装
先决条件
- Python 3.8或更高版本
- Node.js 18或更高版本
- ComfyUI安装(用于测试生成的节点)
快速安装
# Clone the repository
git clone https://github.com/A043-studios/mcp-comfyui-node-framework.git
cd mcp-comfyui-node-framework
# Run the installation script
chmod +x scripts/install.sh
./scripts/install.sh手动安装
# Install Python dependencies
pip install -r requirements.txt
# Install Node.js dependencies
npm install
# Set up environment
chmod +x scripts/setup-env.sh
./scripts/setup-env.sh⚡ 快速开始
1.配置框架
# Copy the template configuration
cp config/mcp-config.template.json config/mcp-config.json
# Edit configuration with your API keys
nano config/mcp-config.json2.启动MCP服务器
# Start the server
chmod +x scripts/start-server.sh
./scripts/start-server.sh3.生成第一个节点
from src.comfyui_mcp_server_v2 import ComfyUIMCPServer
# Initialize the server
server = ComfyUIMCPServer()
# Generate a node from a GitHub repository
result = server.generate_node(
source="https://github.com/danielgatis/rembg",
quality_level="production",
focus_areas="background removal, image segmentation"
)
print(f"Generated {result['nodes_generated']} nodes!")📋 使用示例
根据研究论文生成
# Generate nodes from an arXiv paper
result = server.generate_node(
source="https://arxiv.org/abs/2301.12345",
quality_level="production",
focus_areas="image processing, neural networks"
)从GitHub存储库生成
# Generate nodes from a repository
result = server.generate_node(
source="https://github.com/user/awesome-project",
quality_level="development",
focus_areas="computer vision, preprocessing"
)批量生成
# Generate multiple nodes
sources = [
"https://github.com/danielgatis/rembg",
"https://arxiv.org/abs/2301.12345",
"https://github.com/another/project"
]
for source in sources:
result = server.generate_node(source, quality_level="production")
print(f"Generated from {source}: {result['nodes_generated']} nodes")🎯 生成节点示例
该框架生成完整的、可用于生产的ComfyUI节点。以下是一个创建内容的示例:
class RembgBackgroundRemovalNode:
"""ComfyUI Node for AI-powered background removal using rembg"""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": ("IMAGE",),
"model": (["u2net", "birefnet-general", "isnet-anime"],
{"default": "u2net"}),
"return_mask": ("BOOLEAN", {"default": False}),
}
}
RETURN_TYPES = ("IMAGE", "MASK")
FUNCTION = "remove_background"
CATEGORY = "image/background"
# ... implementation📁 项目结构
mcp-comfyui-node-framework/
├── README.md # This file
├── LICENSE # MIT License
├── INSTALLATION.md # Detailed installation guide
├── requirements.txt # Python dependencies
├── package.json # Node.js configuration
├── src/ # Core framework source
│ ├── comfyui_mcp_server_v2.py # Main MCP server
│ ├── agents/ # AI agent implementations
│ ├── tools/ # Generation tools
│ └── utils/ # Utility functions
├── config/ # Configuration files
│ ├── mcp-config.template.json # Configuration template
│ └── agents.example.json # Agent configuration
├── scripts/ # Installation and setup scripts
├── examples/ # Example nodes and workflows
│ ├── nodes/ # Generated node examples
│ └── workflows/ # Example ComfyUI workflows
├── docs/ # Documentation
└── tests/ # Test suite🔧 配置
MCP配置
编辑 config/mcp-config.json 配置:
- LLM API密钥:OpenRouter、OpenAI等。
- 代理设置:研究、编码、文档代理
- 质量等级:草稿、开发、生产设置
- 输出首选项:文件组织、命名约定
代理配置
在中自定义代理行为 config/agents.example.json:
{
"research_agent": {
"model": "anthropic/claude-3.5-sonnet",
"temperature": 0.1,
"max_tokens": 4000
},
"coding_agent": {
"model": "anthropic/claude-3.5-sonnet",
"temperature": 0.0,
"max_tokens": 8000
}
}🧪 测试生成的节点
# Test a generated node
python tests/test_integration.py --node examples/nodes/rembg_background_removal_node.py
# Run full test suite
python -m pytest tests/📚 文档
🤝 贡献
我们欢迎捐款!请参阅我们的投稿指南:
- 分叉存储库
- 创建要素分支
- 进行更改
- 添加新功能的测试
- 提交拉取请求
📄 许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
🙏 致谢
📞 支持
- 问题:
- 讨论:
- 文档: 维基
______________________________________________________________________
由以下材料制成❤️ ComfyUI社区
