一个全面的MCP服务器,提供与Microsoft的AutoGen框架v0.9+的深度集成,包括最新的功能如提示、资源、高级工作流和增强的代理类型。该服务器通过标准化的模型上下文协议接口支持复杂的多代理对话。
create_agent - 创建具有高级配置的代理create_workflow - 构建完整的多代理工作流get_agent_status - 详细的代理指标和健康监控execute_chat - 增强的双代理对话execute_group_chat - 多代理组讨论execute_nested_chat - 分层对话结构execute_swarm - 基于群的协作问题解决execute_workflow - 运行预定义的工作流模板manage_agent_memory - 处理代理的学习和持久性configure_teachability - 启用/配置代理学习能力autogen-workflow创建复杂的多代理工作流,具有可定制的参数:
task_description,agent_count,workflow_typecode-review设置专门代理进行协作代码审查:
code,language,focus_areasresearch-analysis部署研究团队进行深入主题分析:
topic,depthautogen://agents/list活跃代理的实时列表,包括状态和能力
autogen://workflows/templates可用的工作流模板和配置
autogen://chat/history最近的对话历史和交互日志
autogen://config/current当前服务器配置和设置
要通过Smithery自动安装AutoGen服务器到Claude Desktop:
npx -y @smithery/cli install @DynamicEndpoints/autogen_mcp --client claude
git clone https://github.com/yourusername/autogen-mcp.git
cd autogen-mcp
npm install
pip install -r requirements.txt --user
npm run build
cp .env.example .env
cp config.json.example config.json
# 使用您的设置编辑.env和config.json
从模板创建.env文件:
# 必需
OPENAI_API_KEY=your-openai-api-key-here
# 可选 - 配置文件路径
AUTOGEN_MCP_CONFIG=config.json
# 增强功能
ENABLE_PROMPTS=true
ENABLE_RESOURCES=true
ENABLE_WORKFLOWS=true
ENABLE_TEACHABILITY=true
# 性能设置
MAX_CHAT_TURNS=10
DEFAULT_OUTPUT_FORMAT=json
更新config.json以匹配您的偏好:
{
"llm_config": {
"config_list": [
{
"model": "gpt-4o",
"api_key": "your-openai-api-key"
}
],
"temperature": 0.7
},
"enhanced_features": {
"prompts": { "enabled": true },
"resources": { "enabled": true },
"workflows": { "enabled": true }
}
}
添加到您的claude_desktop_config.json:
{
"mcpServers": {
"autogen": {
"command": "node",
"args": ["path/to/autogen-mcp/build/index.js"],
"env": {
"OPENAI_API_KEY": "your-key-here"
}
}
}
}
测试服务器功能:
# 运行全面测试
python test_server.py
# 测试CLI界面
python cli_example.py create_agent "researcher" "assistant" "您是一位研究专家"
python cli_example.py execute_workflow "code_generation" '{"任务":"Hello world","语言":"python"}'
服务器提供了几个内置提示:
可用资源提供实时数据:
autogen://agents/list - 当前活跃代理autogen://workflows/templates - 可用工作流模板autogen://chat/history - 最近的对话历史autogen://config/current - 服务器配置{
"workflow_name": "code_generation",
"input_data": {
"任务": "创建REST API端点",
"语言": "python",
"需求": ["FastAPI", "Pydantic", "错误处理"]
},
"质量检查": true
}
{
"workflow_name": "research",
"input_data": {
"主题": "2025年人工智能伦理",
"深度": "全面"
},
"输出格式": "markdown"
}
pip install -r requirements.txt --user安装所有依赖项npm install启用详细日志记录:
export LOG_LEVEL=DEBUG
python test_server.py
gpt-4o-mini进行更快、成本效益更高的操作# 全面测试套件
python test_server.py
# 单个工作流测试
python -c "
import asyncio
from src.autogen_mcp.workflows import WorkflowManager
wm = WorkflowManager()
print(asyncio.run(wm.execute_workflow('code_generation', {'任务': '测试'})))
"
npm run build
npm run lint
对于问题和疑问:
test_server.py中的测试示例MIT许可证 - 详情见LICENSE文件。
OPENAI_API_KEY=your-openai-api-key
### 服务器配置
1. 将`config.json.example`复制为`config.json`:
```bash
cp config.json.example config.json
{
"llm_config": {
"config_list": [
{
"model": "gpt-4",
"api_key": "your-openai-api-key"
}
],
"temperature": 0
},
"code_execution_config": {
"work_dir": "workspace",
"use_docker": false
}
}
服务器支持三种主要操作:
{
"name": "create_agent",
"arguments": {
"name": "tech_lead",
"type": "assistant",
"system_message": "您是具有软件架构和设计模式专业知识的技术负责人。"
}
}
{
"name": "execute_chat",
"arguments": {
"发起者": "agent1",
"响应者": "agent2",
"消息": "让我们讨论系统架构。"
}
}
{
"name": "execute_group_chat",
"arguments": {
"代理": ["agent1", "agent2", "agent3"],
"消息": "让我们审核提出的解决方案。"
}
}
常见的错误场景包括:
{
"error": "代理已存在"
}
{
"error": "未找到代理"
}
{
"error": "未设置AUTOGEN_MCP_CONFIG环境变量"
}
服务器遵循模块化架构:
src/
├── autogen_mcp/
│ ├── __init__.py
│ ├── agents.py # 代理管理和配置
│ ├── config.py # 配置处理和验证
│ ├── server.py # MCP服务器实现
│ └── workflows.py # 对话工作流管理
MIT许可证 - 详情见LICENSE文件