Files
MuMuAINovel/backend/app/mcp/__init__.py
T
2026-01-09 17:13:19 +08:00

36 lines
989 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""MCP模块 - 统一的MCP客户端管理
本模块提供MCPModel Context Protocol)客户端的统一管理接口。
推荐使用方式:
from app.mcp import mcp_client, MCPPluginConfig
# 注册插件
await mcp_client.register(MCPPluginConfig(
user_id="user123",
plugin_name="exa-search",
url="http://localhost:8000/mcp"
))
# 获取工具
tools = await mcp_client.get_tools("user123", "exa-search")
# 调用工具
result = await mcp_client.call_tool("user123", "exa-search", "web_search", {"query": "..."})
# 注册状态变更回调
from app.mcp.status_sync import register_status_sync
register_status_sync()
"""
from .facade import mcp_client, MCPClientFacade, MCPPluginConfig, MCPError, PluginStatus
from .status_sync import register_status_sync
__all__ = [
"mcp_client",
"MCPClientFacade",
"MCPPluginConfig",
"MCPError",
"PluginStatus",
"register_status_sync",
]