🚀 Blue AI多智能体MCP系统
基于MCP(模型上下文协议)的企业多代理系统,使用GLM-4.6进行智能编排。
📋 概述
该架构实现了一个由专门代理组成的分布式系统,这些代理协同工作以:
- ✅ 分析需求并提出架构
- ✅ 设计现代且响应迅速的界面
- ✅ 按照最佳实践生成干净的代码
- ✅ 安全和质量审计代码
- ✅ 研究更新的堆栈和依赖关系
🏗️ 建筑
┌─────────────────────────────────────────────────────────────────┐
│ IDE/Client (stdio MCP) │
│ (Claude/Cursor/VS Code) │
└────────────────────────────┬────────────────────────────────────┘
│ stdio
▼
┌─────────────────────────────────────────────────────────────────┐
│ BLUE ORCHESTRATOR (Container) │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ LLM Router: GLM-4.6 (Reasoning & Structured Output) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ MCP Client (HttpTransport) → Internal Agent Network │ │
│ └──────────────────────────────────────────────────────────┘ │
└────────────────────────────┬────────────────────────────────────┘
│ HTTP/MCP
┌──────────────────┼──────────────────┬─────────────────┐
│ │ │ │
▼ ▼ ▼ ▼
┌──────────────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ ┌──────────────┐
│ Architect Agent │ │ Designer/UIX │ │ Coder Agent │ │ Auditor Agent │ │ Memory Agent │
│ (MCP Server) │ │ Agent (MCP) │ │ (MCP Server)│ │ (MCP Server) │ │ (MCP Server)│
└──────────────────┘ └──────────────┘ └──────────────┘ └─────────────────┘ └──────────────┘
│ │ │ │
└──────────────────┴──────────────────┴─────────────────┘
│
▼
┌─────────────────────────┐
│StackResearch Agent (MCP)│
└─────────────────────────┘🚀 快速安装
1.克隆和配置
git clone
cd blue-ai-mcp-system
cp .env.example .env
# Edit .env with your API keys2.配置API密钥
# .env file
OPENROUTER_API_KEY=your_openrouter_key_here
LOG_LEVEL=INFO3.构建和启动
# Build the Docker images
docker-compose build
# Start the system
docker-compose up -d
# Check the logs
docker-compose logs -f4.配置IDE
克劳德桌面
# Copy the configuration to Claude Desktop
cp config/claude-desktop-mcp.json ~/.config/claude-desktop/mcp_config.json
# Or manually add to the existing file光标
# Copy the configuration to Cursor
cp config/cursor-mcp.json ~/.cursor/mcp.json
# Or manually add to the existing fileVS Code
# Install the MCP Server extension
# Copy the configuration to VS Code settings
cp config/vscode-mcp.json ~/.vscode/settings.json
# Or manually add to the existing file🛠️ 可用代理
编排器代理
- 函数:全面管道协调
- 端口: 9080
- 工具:
build_feature,quick_code,research_stack
建筑师代理
- 函数:后端/前端架构设计
- 端口: 9081
- 工具:
propose_architecture,refine_architecture
设计师/UIX代理
- 函数:UI和UX设计
- 端口: 9082
- 工具:
design_ui,generate_component,create_design_system
编码代理
- 函数:干净的代码生成
- 端口: 9083
- 工具:
generate_code,refactor_code,generate_tests
审计代理人
- 函数:代码审查和安全
- 端口: 9084
- 工具:
review_code,security_scan,validate_imports
StackResearch代理
- 函数:技术和依赖性研究
- 端口: 9085
- 工具:
get_imports,get_stack_snapshot,search_best_practice
💻 使用
通过IDE(克劳德/光标/VS代码)
只需问助理:
Use o blue-orchestrator para criar uma aplicação de e-commerce com React e FastAPI通过API HTTP
# Teste individual de agentes
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "tools/call",
"params": {
"name": "build_feature",
"arguments": {
"spec": "Criar um sistema de autenticação com JWT",
"context": "Usar FastAPI backend e React frontend"
}
}
}'Docker Compose
# Ver status dos containers
docker-compose ps
# Ver logs específicos
docker-compose logs orchestrator
docker-compose logs coder-agent
# Restartar serviço específico
docker-compose restart architect-agent
# Parar tudo
docker-compose down📊 监测
健康检查
- 所有代理都暴露端点
/health - Docker Compose 提供自动健康检查
- 日志集中在
./logs/
Metricas
- 每个代理的响应时间
- 工具成功率
- LLM使用令牌
🔧 开发
添加新代理
- 在创建目录
agents/nome-agente/ - 实施
app.py通信工具MCP - 创建
Dockerfile.nome-agente嗯docker/ - 添加到
docker-compose.yml - 配置健康检查
睾丸
# Teste unitário de um agente
cd agents/coder
python -m pytest tests/
# Teste de integração
cd tests/integration
python test_pipeline.py🔐 安全
- API密钥永远不要提交真正的密钥
- 网络隔离独立 Docker 网络中的代理
- 非根容器以非 root 用户身份运行
- 健康检查持续可用性监控
- 输入验证所有工具的输入验证
📈 可扩展性
水平缩放
# Adicione no docker-compose.yml
coder-agent:
deploy:
replicas: 3资源限制
# Já configurado no docker-compose.yml
resources:
limits:
memory: 512M
reservations:
memory: 256M🐛 故障排除
常见问题
- 容器未启动: 检查日志
docker-compose logs [service] - MCP 未连接确认 Docker 网络和端口
- 无效的API密钥检查:
.env和 权限 - 工具超时: 调整超时
LLMRouter
调试模式
# Ative debug logs
export LOG_LEVEL=DEBUG
docker-compose up -d📚 附加文档
🤝 贡献
- 分叉工程
- Crie功能分支(
git checkout -b feature/nova-funcionalidade) - 提交您的更改(
git commit -m 'Add nova funcionalidade') - 推送对位分支(
git push origin feature/nova-funcionalidade) - Abra um Pull请求
📄 许可证
这个项目是MIT许可的。查看文件 LICENSE 为了细节。
🆘 支持
- 问题:
- 讨论:
- 电子邮件:suporte@blueai.com
______________________________________________________________________
⭐ 如果这个项目有帮助,请考虑在GitHub上给它一颗星!
