Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

MCP: name the other bots a shared server is set for, even before it starts for them

Bugfixer 2552f23571354
diff --git a/server/host/mcp-chat.ts b/server/host/mcp-chat.ts
index e8da58b607..bf73bcbe12 100644
--- a/server/host/mcp-chat.ts
+++ b/server/host/mcp-chat.ts
@@ -108,7 +108,7 @@ export function createMcpChat(deps: McpChatDeps) {
decide: (summary, applied) => appendDecision(DATA_DIR, { threadId, botId: sender.id, botName: sender.name, tool: "mcp_server", summary, decision: "auto-approved", source: applied }),
activity: (label, call) => showMcpActivity(store, { threadId, turnId: liveTurnByThread.get(threadId), ...(from ? { from } : {}) }, call, label),
language: () => threadLanguage(threadId),
- usedBy: (name) => store.bots.filter((bot) => bot.id !== sender.id && !bot.hidden && Object.hasOwn(mcpServersHost.mounted(bot), name) && canUseMcpServer(bot.toolScope, name)).map((bot) => bot.name),
+ usedBy: (name) => store.bots.filter((bot) => bot.id !== sender.id && !bot.hidden && mcpServersHost.given(bot).includes(name) && canUseMcpServer(bot.toolScope, name)).map((bot) => bot.name),
requestApproval: ({ action, name, subtitle, targetHash, fields }) => mcpRequests.propose({ action, name, botId: sender.id, threadId, targetHash }, subtitle, fields, from),
requestSignIn: (name, server) => mcpSignInCards.request({ bot: sender, threadId, ...(from ? { from } : {}) }, name, server),
...lentDeps(sender, threadId, generation),
diff --git a/server/host/mcp-servers-host.test.ts b/server/host/mcp-servers-host.test.ts
index 5bb3339f9b..409c17e87d 100644
--- a/server/host/mcp-servers-host.test.ts
+++ b/server/host/mcp-servers-host.test.ts
@@ -67,6 +67,7 @@ it("moves servers in one bot's folders to that bot once, says so once, and keeps
expect(host.mounted(ROSA), "a bot given no servers gets none").toEqual({});
expect(started.sort(), "Iris's own servers are started for Iris only, every bot's once for all").toEqual(["blender-own:iris", "blender:iris", "broken:iris", "notes:iris", "sketch-suite:iris"]);
expect(host.off(PAUL)).toEqual([{ name: "broken", error: "The server stopped before the MCP handshake finished." }]);
+ expect(host.given(PAUL).sort(), "a server that did not start is still set for Paul, so a change to it reaches him").toEqual(["broken", "notes"]);
expect(host.off(NOTES_ONLY), "a bot whose tool selection never reaches it is not told about it").toEqual([]);
expect(host.health.offFor("broken"), "nor a bot whose AI starts no servers").toEqual(["iris", "paul"]);
diff --git a/server/host/mcp-servers-host.ts b/server/host/mcp-servers-host.ts
index d839cdcedb..9b1a39477f 100644
--- a/server/host/mcp-servers-host.ts
+++ b/server/host/mcp-servers-host.ts
@@ -95,6 +95,8 @@ export function createMcpServersHost(deps: McpServersHostDeps) {
/** How Test starts a command server: as the turns of its bot, or of any bot. */
probeAs: (server: { bot?: string }) => (server.bot ? asBot(server.bot) : {}),
mounted: (bot: Bot): Record<string, McpServerSpec> => withRestarts(health.usable(bot.id, configured(bot)), restarts),
+ /** The servers set for this bot, started or not: who a change to one reaches. */
+ given: (bot: Bot): string[] => Object.keys(configured(bot)),
prepare: (bot: Bot): Promise<void> => health.prepare(bot.id, started(bot)),
off: (bot: Bot) => health.off(bot.id, started(bot)),
listing: <T extends { name: string }>(server: T): T & { offFor?: string[] } => {
diff --git a/server/routes/internal-mcp.ts b/server/routes/internal-mcp.ts
index e4ffba37d5..20724c1b08 100644
--- a/server/routes/internal-mcp.ts
+++ b/server/routes/internal-mcp.ts
@@ -70,7 +70,7 @@ export interface InternalMcpDeps {
decide(summary: string, applied: Applied): void;
activity(label: string, call: McpCall): void;
language(): string | undefined;
- /** The other bots that use this server now, by name. */
+ /** The other bots this server is set for, by name, even before it has started for them. */
usedBy(name: string): string[];
/** Shows the person a card for a change below Full access; the bot ends its turn and their answer resumes it. */
requestApproval(proposal: { action: McpCardAction; name: string; subtitle: string; targetHash: string; fields?: McpUpdateFields }): { text: string };