MCP工具的AutoGen扩展

🚨 此存储库现已存档 🚨
该项目的功能已直接集成到官方 autogen-ext 套餐,可从 .\ 现在,您可以直接在中使用它 autogen-ext 而不需要这个单独的包。
有关进一步的更新和改进,请参阅官方 autogen 存储库。
关于
MCP是一个开放标准,它实现了人工智能系统和数据源之间的安全双向连接,用单一的通用协议取代了分散的集成。这允许AI助手在不同工具和数据集之间移动时保持上下文。
安装
pip install autogen-ext-mcp特性
- MCP工具与AutoGen代理的无缝集成
- 连接到任何兼容MCP的数据源或工具
- MCP工具模式自动转换为AutoGen兼容格式
快速开始
from autogen_ext_mcp.tools import mcp_server_tools, StdioServerParams
from pathlib import Path
# Get desktop path cross-platform
desktop_path = str(Path.home() / "Desktop")
# Connect to FileSystem MCP server
server_params = StdioServerParams(
command="npx",
args=[
"-y",
"@modelcontextprotocol/server-filesystem",
desktop_path, # Allow access to Desktop directory
]
)
# Get tools
tools = await mcp_server_tools(server_params)
# Use tools with AutoGen agents
# The tools can be passed to any AutoGen agent that supports tool use样品
看看 示例目录 例如关于开始使用AutoGen MCP扩展的代码和详细说明。这些示例演示了将MCP工具与AutoGen代理集成的常见用例和最佳实践。
资源
贡献
欢迎投稿!请随时提交拉取请求。
