A

Autogen-MCP多智能体对话平台

@DynamicEndpoints/Autogen_MCP
0 Stars 115 次浏览 DynamicEndpoints 更新于 2026-08-23

一个提供与微软AutoGen框架集成的MCP服务器,通过标准化接口启用多代理对话。

该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

AutoGen MCP 服务器

一个与 Microsoft 的 AutoGen 框架集成的 MCP 服务器,通过标准化接口实现多代理对话。该服务器允许您创建和管理能够通过自然语言交互进行协作和解决问题的 AI 代理。

功能

  • 创建和管理具有可自定义配置的 AutoGen 代理
  • 执行代理之间的一对一对话
  • 编排包含多个代理的群聊
  • 可配置的 LLM 设置和代码执行环境
  • 支持助理代理和用户代理
  • 内置错误处理和响应验证

安装

  1. 克隆仓库:
git clone https://github.com/yourusername/autogen-mcp.git
cd autogen-mcp
  1. 安装依赖项:
pip install -e .

配置

环境变量

  1. .env.example 复制为 .env
cp .env.example .env
  1. 配置环境变量:
# Path to the configuration file
AUTOGEN_MCP_CONFIG=config.json

# OpenAI API Key (optional, can also be set in config.json)
OPENAI_API_KEY=your-openai-api-key

服务器配置

  1. config.json.example 复制为 config.json
cp config.json.example config.json
  1. 配置服务器设置:
{
  "llm_config": {
    "config_list": [
      {
        "model": "gpt-4",
        "api_key": "your-openai-api-key"
      }
    ],
    "temperature": 0
  },
  "code_execution_config": {
    "work_dir": "workspace",
    "use_docker": false
  }
}

可用操作

服务器支持三种主要操作:

1. 创建代理

{
  "name": "create_agent",
  "arguments": {
    "name": "tech_lead",
    "type": "assistant",
    "system_message": "You are a technical lead with expertise in software architecture and design patterns."
  }
}

2. 一对一聊天

{
  "name": "execute_chat",
  "arguments": {
    "initiator": "agent1",
    "responder": "agent2",
    "message": "Let's discuss the system architecture."
  }
}

3. 群聊

{
  "name": "execute_group_chat",
  "arguments": {
    "agents": ["agent1", "agent2", "agent3"],
    "message": "Let's review the proposed solution."
  }
}

错误处理

常见的错误场景包括:

  1. 代理创建错误
{
  "error": "Agent already exists"
}
  1. 执行错误
{
  "error": "Agent not found"
}
  1. 配置错误
{
  "error": "AUTOGEN_MCP_CONFIG environment variable not set"
}

架构

服务器遵循模块化架构:

src/
├── autogen_mcp/
│   ├── __init__.py
│   ├── agents.py      # Agent management and configuration
│   ├── config.py      # Configuration handling and validation
│   ├── server.py      # MCP server implementation
│   └── workflows.py   # Conversation workflow management

许可证

MIT 许可证 - 详情请参阅 LICENSE 文件