mcp独立模块

This commit is contained in:
SengokuCola
2026-03-29 14:39:14 +08:00
parent 5876f246c0
commit f32edfa732
6 changed files with 19 additions and 26 deletions

View File

@@ -0,0 +1,18 @@
"""
MCP (Model Context Protocol) 客户端包。
提供 MCPManager 用于管理 MCP 服务器连接、发现工具、调用工具。
用法:
from .manager import MCPManager
manager = await MCPManager.from_config("config/mcp_config.json")
if manager:
tools = manager.get_openai_tools() # 获取 OpenAI 格式工具列表
result = await manager.call_tool(name, args) # 调用工具
await manager.close() # 关闭连接
"""
from .manager import MCPManager
__all__ = ["MCPManager"]