From e3d553c1af7110d70ed628e64bbb38c2151e3a36 Mon Sep 17 00:00:00 2001 From: kicer Date: Tue, 15 Sep 2026 21:15:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2=EF=BC=9Amcp=20=E8=B5=B7?= =?UTF-8?q?=E6=9D=A5=E5=90=8E=E9=87=8D=E5=90=AF=E4=B8=80=E6=AC=A1=20agent-?= =?UTF-8?q?core=EF=BC=88MCP=20=E5=B7=A5=E5=85=B7=E5=8F=AA=E5=9C=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E5=8F=91=E7=8E=B0=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原顺序「先 agent(建网络)再 mcp」下,agent 启动时 mcp 还在构建,工具发现必然失败且不重试。 现在起完 mcp 后 restart agent-core,并打印本次的 [mcp] 发现结果便于核对。 --- scripts/init.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/init.sh b/scripts/init.sh index b332986..796df92 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -258,6 +258,14 @@ else if [ -d "$MCP_DIR" ]; then log "启动 mcp($MCP_DIR)" ( cd "$MCP_DIR" && docker compose up -d --build ) + + # MCP 工具只在 agent-core【启动时】发现一次(app/server/mcp.js 的 init,不重试), + # 而 agent 必须先起(它创建 my-app-network),所以这里重启一次让 agent 发现已就绪的 mcp 服务。 + info "重启 agent-core 以发现 MCP 工具……" + docker compose restart agent-core >/dev/null + sleep 3 + info "本次 MCP 工具发现结果:" + docker compose logs --tail=80 agent-core | grep -E '\[mcp\]|\[startup\].*public_link' || true else warn "没找到 mcp 仓库($MCP_DIR),跳过。可用 MCP_DIR=<路径> 指定。" fi