feat: 重构 MCP 配置管理,移除旧配置文件,更新为使用全局配置

This commit is contained in:
DrSmoothl
2026-03-30 23:32:13 +08:00
parent dc2bf02a42
commit abb1d071b1
10 changed files with 214 additions and 135 deletions

View File

@@ -4,9 +4,10 @@ MCP (Model Context Protocol) 客户端包。
提供 MCPManager 用于管理 MCP 服务器连接、发现工具、调用工具。
用法:
from src.config.config import global_config
from .manager import MCPManager
manager = await MCPManager.from_config("config/mcp_config.json")
manager = await MCPManager.from_app_config(global_config.mcp)
if manager:
tools = manager.get_openai_tools() # 获取 OpenAI 格式工具列表
result = await manager.call_tool(name, args) # 调用工具