feat: broadcast system notifications on MCP server register/unregister
Some checks failed
CI / Typecheck (push) Has been cancelled
CI / Broker tests (Postgres) (push) Has been cancelled
CI / Docker build (linux/amd64) (push) Has been cancelled
CI / Lint (push) Has been cancelled

Peers now receive [system] notifications when MCP servers join or
leave the mesh, with tool names and hosting peer info.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-04-08 00:16:58 +01:00
parent 32fc4a0c98
commit e09671cdcb
2 changed files with 43 additions and 0 deletions

View File

@@ -1354,6 +1354,11 @@ Your message mode is "${messageMode}".
content = `[system] Peer "${data.name ?? "unknown"}" joined the mesh`;
} else if (eventName === "peer_left") {
content = `[system] Peer "${data.name ?? "unknown"}" left the mesh`;
} else if (eventName === "mcp_registered") {
const tools = Array.isArray(data.tools) ? (data.tools as string[]).join(", ") : "";
content = `[system] New MCP server available: "${data.serverName}" (hosted by ${data.hostedBy}). Tools: ${tools}. Use mesh_tool_call to invoke.`;
} else if (eventName === "mcp_unregistered") {
content = `[system] MCP server "${data.serverName}" removed (was hosted by ${data.hostedBy})`;
} else {
content = `[system] ${eventName}: ${JSON.stringify(data)}`;
}