From 1ca27815cdbd1020dc6bcc330ce79875c320194f Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Sat, 6 Dec 2025 00:59:32 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Bmcp=E9=BB=98=E8=AE=A4=E4=B8=8D?= =?UTF-8?q?=E5=90=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config.example.toml | 73 ++++++++++++++++++- plugins/MaiBot_MCPBridgePlugin/plugin.py | 2 +- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/plugins/MaiBot_MCPBridgePlugin/config.example.toml b/plugins/MaiBot_MCPBridgePlugin/config.example.toml index a45a16ee..d66953db 100644 --- a/plugins/MaiBot_MCPBridgePlugin/config.example.toml +++ b/plugins/MaiBot_MCPBridgePlugin/config.example.toml @@ -33,6 +33,20 @@ version = "1.7.0" config_version = "1.7.0" enabled = false # 默认禁用,在 WebUI 中启用 +# ============================================================ +# 🆕 v1.5.4 快速入门(只读,WebUI 显示) +# ============================================================ +[guide] +# 🚀 快速入门 - 三步开始使用 +quick_start = "1. 从下方链接获取 MCP 服务器 2. 在「快速添加」填写信息 3. 保存后发送 /mcp reconnect" + +# 🌐 获取 MCP 服务器 - 复制链接到浏览器打开,获取免费 MCP 服务器 +# 魔搭 ModelScope 国内免费推荐,复制服务器 URL 到「快速添加」即可 +mcp_sources = "https://modelscope.cn/mcp (魔搭·推荐) | https://smithery.ai | https://glama.ai | https://mcp.so" + +# 📝 配置示例 - 复制到服务器列表可直接使用(免费时间服务器) +example_config = '{"name": "time", "enabled": true, "transport": "streamable_http", "url": "https://mcp.api-inference.modelscope.cn/server/mcp-server-time"}' + # ============================================================ # 全局设置 # ============================================================ @@ -61,12 +75,28 @@ heartbeat_enabled = true # 💓 心跳间隔(秒)- 建议 30-120 秒 heartbeat_interval = 60.0 +# 🧠 智能心跳 - 根据服务器稳定性自动调整心跳间隔(v1.5.2) +# 稳定服务器逐渐增加间隔,断开的服务器缩短间隔 +heartbeat_adaptive = true + +# 📈 最大间隔倍数 - 稳定服务器心跳间隔最高可达 基准间隔 × 此值(v1.5.3) +heartbeat_max_multiplier = 3.0 + # 🔄 自动重连 - 检测到断开时自动尝试重连 auto_reconnect = true # 🔄 最大重连次数 - 连续重连失败后暂停重连 max_reconnect_attempts = 3 +# ============================================================ +# v1.7.0 状态实时刷新 +# ============================================================ +# 📊 启用状态实时刷新 - 定期更新 WebUI 状态显示 +status_refresh_enabled = true + +# 📊 状态刷新间隔(秒)- 值越小刷新越频繁,但会增加少量磁盘写入 +status_refresh_interval = 10.0 + # ============================================================ # v1.2.0 高级功能(实验性) # ============================================================ @@ -110,7 +140,7 @@ post_process_prompt = '''用户问题:{query} trace_enabled = true # 📊 追踪记录上限 - 内存中保留的最大记录数 -trace_max_records = 50 +trace_max_records = 100 # 📝 追踪日志文件 - 是否将追踪记录写入日志文件 # 启用后记录写入 plugins/MaiBot_MCPBridgePlugin/logs/trace.jsonl @@ -153,6 +183,47 @@ tool_list = "(启动后自动生成)" # ''' disabled_tools = "" +# ============================================================ +# 🆕 v1.5.1 快速添加服务器 +# ============================================================ +# 表单式配置,无需手写 JSON +[quick_add] +# 📛 服务器名称 - 服务器唯一名称(英文,如 time-server) +server_name = "" + +# 📡 传输类型 - 远程服务器选 streamable_http/http/sse,本地选 stdio +server_type = "streamable_http" + +# 🌐 服务器 URL - 远程服务器必填(streamable_http/http/sse 类型) +server_url = "" + +# ⌨️ 启动命令 - stdio 类型必填(如 uvx、npx、python) +server_command = "" + +# 📝 命令参数 - stdio 类型使用,每行一个参数 +server_args = "" + +# 🔑 鉴权头(可选)- JSON 格式,如 {"Authorization": "Bearer xxx"} +server_headers = "" + +# ============================================================ +# 🆕 v1.6.0 配置导入导出 +# ============================================================ +# 支持从 Claude Desktop / Kiro / MaiBot 格式导入导出 +[import_export] +# 📥 导入配置 - 粘贴 Claude Desktop 或其他格式的 MCP 配置 JSON +# 粘贴配置后点击保存,2秒内自动导入。查看下方「导入结果」确认状态 +import_config = "" + +# 📋 导入结果(只读)- 显示导入操作的结果 +import_result = "" + +# 📤 导出格式 - claude: Claude Desktop 格式 | kiro: Kiro MCP 格式 | maibot: 本插件格式 +export_format = "claude" + +# 📤 导出结果(只读,可复制)- 点击保存后生成,可复制到 Claude Desktop 或其他支持 MCP 的应用 +export_result = "(点击保存后生成)" + # ============================================================ # 🆕 v1.4.0 权限控制 # ============================================================ diff --git a/plugins/MaiBot_MCPBridgePlugin/plugin.py b/plugins/MaiBot_MCPBridgePlugin/plugin.py index 28458719..aae3f4bd 100644 --- a/plugins/MaiBot_MCPBridgePlugin/plugin.py +++ b/plugins/MaiBot_MCPBridgePlugin/plugin.py @@ -1746,7 +1746,7 @@ class MCPBridgePlugin(BasePlugin): "plugin": { "enabled": ConfigField( type=bool, - default=True, + default=False, description="是否启用插件", label="启用插件", ),