Skip to content

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

A bot's own MCP server starts only for that bot, and one that doesn't start is left out (#3751)

Milind Soni1931ecf70c54
diff --git a/docs/custom-mcp-servers.md b/docs/custom-mcp-servers.md
index cb46adc0a9..188ba83b34 100644
--- a/docs/custom-mcp-servers.md
+++ b/docs/custom-mcp-servers.md
@@ -231,6 +231,36 @@ turns before changing this selection; the next direct or channel turn gets the
new list. The list does not filter project-local `.mcp.json` files and is not a
shell sandbox. Individual tool approvals depend on the engine and approval mode.
+### A bot's own servers, and servers that don't start
+
+A bot can add a command server with `add_mcp_server` (saved switched off, as
+always). A conversation folder (`task-workspaces/<bot>/<conversation>`) goes
+when its conversation does, so when the command, its arguments or its
+environment point into one of the bot's conversation folders, those files are
+first copied into the bot's own folder under `tools/`, and the server runs
+from the copy.
+
+Where bots are boxed (a Cloud), each bot's turn sees only its own folders.
+There a server whose files are in the bot's own folder (`workspaces/<bot>`) or
+its conversation folders is that bot's own: it starts only for that bot, and
+the `config.json` entry says so with `"bot": "<bot id>"`. A command that uses
+another bot's files is refused there. On a desktop every bot reaches every
+folder, so such a server stays every bot's. Servers you add in Settings stay
+every bot's. The first time bots run boxed after an update, a server no bot
+owns whose files are in the folders of one existing bot becomes that bot's own
+the same way, once, and you hear about it once: "The Blender tool only works
+for Iris, so it's off for your other bots."
+
+Each enabled command server is also started once for each bot that uses it,
+the way that bot's AI starts it (in the bot's box on a Cloud, from its own
+folder), when it is added, changed or turned on, before a bot's first turn
+with it, and again whenever the bot's AI reports it did not connect. A server
+that doesn't start for a bot is left out of that bot's turns, so its failure
+doesn't follow every session or tool search; you hear about it once, the
+server's row in Settings says who it is off for, and it is tried again on its
+own every half hour (one that started is checked again every six hours). The
+checks are kept in `<data>/mcp-health.json`.
+
### Servers with hundreds of tools
Some servers offer more tools than a model can usefully read at once: Whop's
diff --git a/server/chat-apps-mcp.e2e.test.ts b/server/chat-apps-mcp.e2e.test.ts
index 2456d18647..6037d9879f 100644
--- a/server/chat-apps-mcp.e2e.test.ts
+++ b/server/chat-apps-mcp.e2e.test.ts
@@ -39,7 +39,8 @@ it("learns a server's apps, observes its tool call into an app row, and runs its
await api("POST", "/api/mcp/servers", { name: "board", command: process.execPath, args: ["--experimental-strip-types", "--no-warnings", FAKE_APP], env: { FAKE_APP_LOG: frames } }, 201);
await api("PATCH", "/api/mcp/servers/board", { enabled: true });
expect(await api("POST", "/api/mcp/servers/board/test")).toMatchObject({ ok: true });
- expect(logged().find((frame) => frame.method === "initialize").params.capabilities.extensions).toHaveProperty(APP_EXTENSION_KEY);
+ // The Test button's connection offers the apps extension; the automatic start checks need not.
+ expect(logged().filter((frame) => frame.method === "initialize").some((frame) => Object.hasOwn(frame.params.capabilities.extensions ?? {}, APP_EXTENSION_KEY))).toBe(true);
const catalog = JSON.parse(readFileSync(join(fixture.info.dataDir, "mcp-app-catalog.json"), "utf8"));
expect(catalog.servers.board).toMatchObject({ apps: true, uiExtension: "ok", tools: { show_board: { resourceUri: BOARD_URI } } });
expect((await api("GET", "/api/mcp/servers")).servers.find((server: any) => server.name === "board")).toMatchObject({ enabled: true, apps: true });
diff --git a/server/config.ts b/server/config.ts
index 8dc31c82e6..596e8bac37 100644
--- a/server/config.ts
+++ b/server/config.ts
@@ -20,7 +20,7 @@ import { PROVIDER_ICON_PRESETS, providerIconError } from "../shared/provider-ico
import { helperStoredShape, type HelperConfig } from "./side-jobs.ts";
import { loopGuardConfigSchema, type LoopGuardConfig } from "./host/loop-guard.ts";
import { migrateLegacyFeatureFlags } from "./legacy-feature-flags.ts";
-import { isRemoteMcpServer, parseStoredMcpServer } from "./mcp-registry.ts";
+import { isRemoteMcpServer, mcpServerServes, parseStoredMcpServer } from "./mcp-registry.ts";
import { parseJson, schemaIssue, type JsonObject, type JsonValue } from "./schema.ts";
import { deciderConfigSchema, type DeciderConfig } from "./decider/config.ts";
import { browserEngineConfigSchema, isValidCdpTarget, type BrowserEngineConfig } from "./browser/config.ts";
@@ -1283,7 +1283,7 @@ function skipMcpEntry(name: string, why: string): void {
console.error(`mcpServers.${JSON.stringify(name)} skipped — ${why}`);
}
-export function customMcpServers(cfg: AppConfig, only?: string[]): Record<string, CustomMcpServer> {
+export function customMcpServers(cfg: AppConfig, only?: string[], botId?: string): Record<string, CustomMcpServer> {
const out: Record<string, CustomMcpServer> = {};
for (const [name, raw] of Object.entries(cfg.mcpServers ?? {})) {
if (only && !only.includes(name)) continue;
@@ -1292,7 +1292,7 @@ export function customMcpServers(cfg: AppConfig, only?: string[]): Record<string
skipMcpEntry(name, `${parsed.error} Expected { "command": "npx", "args": [...], "env": { ... } } or { "type": "http", "url": "https://…", "headers": { ... } }`);
continue;
}
- if (!parsed.server.enabled || parsed.server.runsOn) continue; // a server of another computer's never starts here
+ if (!parsed.server.enabled || parsed.server.runsOn || !mcpServerServes(parsed.server, botId)) continue; // another computer's or bot's own
out[name] = isRemoteMcpServer(parsed.server)
? { type: parsed.server.type, url: parsed.server.url, headers: parsed.server.headers }
: { command: parsed.server.command, args: parsed.server.args, env: parsed.server.env };
diff --git a/server/drivers/agents-call.ts b/server/drivers/agents-call.ts
index 6beeb4cc46..00c86757ae 100644
--- a/server/drivers/agents-call.ts
+++ b/server/drivers/agents-call.ts
@@ -867,8 +867,11 @@ export async function callTool(called: string, input: Json, context: ToolCallCon
headerKeys ? `Header names on file: ${headerKeys}.` : "",
].filter(Boolean).join(" ");
const local = transport === "command" ? " Enabling a local command runs that command on their computer." : "";
+ const keptIn = Array.isArray(saved.keptIn) ? saved.keptIn.filter((path): path is string => typeof path === "string") : [];
+ const own = (saved.own === true ? " It uses files in your own folder, so it works only for you, not for other bots." : "")
+ + (keptIn.length ? ` Its files were in this conversation's temporary folder, so they were copied to ${keptIn.join(", ")} in your own folder, and it runs from there: change them there.` : "");
return {
- text: `Saved MCP server “${serverName}”${where} switched off. It stays off in MCP server settings until the user turns it on.${local}${named ? ` ${named}` : ""}`,
+ text: `Saved MCP server “${serverName}”${where} switched off. It stays off in MCP server settings until the user turns it on.${local}${own}${named ? ` ${named}` : ""}`,
};
}
return { text: `Unknown tool: ${name}`, isError: true };
diff --git a/server/drivers/claude.test.ts b/server/drivers/claude.test.ts
index b6e4818801..a4378c07a9 100644
--- a/server/drivers/claude.test.ts
+++ b/server/drivers/claude.test.ts
@@ -2937,6 +2937,14 @@ describe("ClaudeDriver turns (fake CLI)", () => {
expect(dumpedPid(dump)).not.toBe(failedLaunch);
});
+ it("reports which of the turn's own MCP servers did not connect, and none of OpenMausBot's", async () => {
+ await create(undefined, { FAKE_CLAUDE_MCP_FAILED: "agents,blender,stranger" });
+ const custom = { blender: { command: "/usr/bin/python3", args: ["/srv/blender.py"], env: {} }, notes: { command: "npx", args: ["notes-mcp"], env: {} } };
+ const turn = await instance.adapter.sendTurn({ threadId: "t-custom-failed", text: "one", integrations: { custom } });
+ await recorder.until((e) => e.type === "turn.completed" && e.turnId === turn.turnId);
+ expect(recorder.events.filter((e) => e.type === "session.started").map((e) => (e as { mcpFailed?: string[] }).mcpFailed)).toEqual([["blender"]]);
+ });
+
it("books each turn of a retained process at its own cost, not the process's running total", async () => {
await create();
const dump = join(scratch, "dump.json");
diff --git a/server/drivers/claude.ts b/server/drivers/claude.ts
index 99843cc2d1..9c55b76551 100644
--- a/server/drivers/claude.ts
+++ b/server/drivers/claude.ts
@@ -39,7 +39,7 @@ import { newEventId, newId } from "../contracts.ts";
import { askInputSummary, commandSummary, toolDetailPreview } from "../tool-summary.ts";
import { classifyError, computeBackoff, interruptibleDelay, RETRY_MAX_ATTEMPTS, USAGE_LIMIT } from "./retry.ts";
import { claudeApiErrorMessage, claudeEngineReset, claudeLimitRefusal, claudeUsageLimit, claudeLimitMessage, type ClaudeLimit } from "./claude-limits.ts";
-import { TEAM_TOOLS_FAILED, teamToolsFailed } from "./team-tools.ts";
+import { TEAM_TOOLS_FAILED, failedCustomMcp, teamToolsFailed } from "./team-tools.ts";
import { engineIdleMs, sessionIdlePolicy } from "./session-idle.ts";
import { promptHalves, withVolatileNote } from "./prompt-split.ts";
import { parseVersionTriple, versionAtLeast } from "./acp/version-probe.ts";
@@ -1509,7 +1509,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeConfig> = {
}, STEERED_CONTINUATION_SILENCE_MS * steerSilenceScale());
held.continuationSilence.unref?.();
}
- emit({ ...base(threadId, currentTurnId()), type: "session.started", sessionId: o.session_id, model: o.model, ...(retry.rebuilt ? { rebuilt: true } : {}) });
+ emit({ ...base(threadId, currentTurnId()), type: "session.started", sessionId: o.session_id, model: o.model, ...(retry.rebuilt ? { rebuilt: true } : {}), ...failedCustomMcp(o.mcp_servers, session.turn?.input.integrations?.custom) });
if (retry.rebuilt) emit({ ...base(threadId, currentTurnId()), type: "runtime.notice", message: rebuiltSessionNotice("Claude Code") });
retry.rebuilt = false;
} else if (o.subtype === "compact_boundary") {
diff --git a/server/drivers/team-tools.ts b/server/drivers/team-tools.ts
index 37bb3e5ac5..5fcac956fe 100644
--- a/server/drivers/team-tools.ts
+++ b/server/drivers/team-tools.ts
@@ -7,3 +7,13 @@ export function teamToolsFailed(server: unknown): boolean {
const record = server && typeof server === "object" ? server as { name?: unknown; status?: unknown } : null;
return record?.name === "agents" && record.status === "failed";
}
+
+/** The servers of `custom` that Claude Code's `system/init` `mcp_servers` lists as failed, for `session.started`. */
+export function failedCustomMcp(servers: unknown, custom: Readonly<Record<string, unknown>> | undefined): { mcpFailed?: string[] } {
+ if (!Array.isArray(servers) || !custom) return {};
+ const failed = servers.flatMap((server) => {
+ const record = server && typeof server === "object" ? server as { name?: unknown; status?: unknown } : null;
+ return typeof record?.name === "string" && record.status === "failed" && Object.hasOwn(custom, record.name) ? [record.name] : [];
+ });
+ return failed.length ? { mcpFailed: failed } : {};
+}
diff --git a/server/host/mcp-servers-host.test.ts b/server/host/mcp-servers-host.test.ts
new file mode 100644
index 0000000000..cc40f79ac0
--- /dev/null
+++ b/server/host/mcp-servers-host.test.ts
@@ -0,0 +1,110 @@
+import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, expect, it } from "vitest";
+
+import type { AppConfig } from "../config.ts";
+import { claimedNotice, createMcpServersHost } from "./mcp-servers-host.ts";
+
+const dirs: string[] = [];
+afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });
+
+const IRIS = { id: "iris", name: "Iris" }, PAUL = { id: "paul", name: "Paul" }, ROSA = { id: "rosa", name: "Rosa", mcpServers: [] as string[] };
+const NOTES_ONLY = { id: "nina", name: "Nina", toolScope: { allow: ["mcp:notes:*"] } }, NO_SERVERS = { id: "otto", name: "Otto" };
+
+function script(data: string, ...parts: string[]): string {
+ const path = join(data, ...parts);
+ mkdirSync(join(path, ".."), { recursive: true });
+ writeFileSync(path, "import mcp\n");
+ return path;
+}
+
+function setup(options: { boxed?: boolean; data?: string; bots?: Array<{ id: string; name: string; mcpServers?: string[]; toolScope?: unknown }> } = {}) {
+ const data = options.data ?? mkdtempSync(join(tmpdir(), "omb-mcp-host-"));
+ if (!options.data) dirs.push(data);
+ const cfg: AppConfig = {
+ mcpServers: {
+ "sketch-suite": { command: "/usr/bin/python3", args: [script(data, "task-workspaces", "iris", "t1", "native-sketch", "server.py")], enabled: true },
+ blender: { command: "/usr/bin/python3", args: [script(data, "task-workspaces", "iris", "t2", "blender-mcp", "server.py")], enabled: true },
+ "blender-own": { command: "/usr/bin/python3", args: [script(data, "workspaces", "iris", "tools", "blender-mcp", "server.py")], enabled: true },
+ notes: { command: "npx", args: ["-y", "@x/notes-mcp"], enabled: true },
+ broken: { command: "/usr/bin/false", args: [], enabled: true },
+ },
+ } as AppConfig;
+ const told: Array<{ text: string; about: string }> = [];
+ const started: string[] = [];
+ const host = createMcpServersHost({
+ dataDir: data,
+ cfg: () => cfg,
+ persist: (next) => { cfg.mcpServers = next; },
+ bots: () => options.bots ?? [IRIS, PAUL, ROSA, NOTES_ONLY, NO_SERVERS],
+ startsServers: (botId) => botId !== NO_SERVERS.id,
+ boxed: () => options.boxed ?? true,
+ policy: (servers) => servers,
+ tell: (text, about) => told.push({ text, about: about.id }),
+ // The image's python has no `mcp` module: these start only in Iris's own box, where it is installed.
+ start: async (name, server, botId) => {
+ started.push(`${name}:${botId}`);
+ if (name === "broken") return { ok: false, error: "The server stopped before the MCP handshake finished." };
+ return server.command === "/usr/bin/python3" && botId !== "iris" ? { ok: false, error: "No module named 'mcp'" } : { ok: true };
+ },
+ });
+ return { cfg, host, told, started, data };
+}
+
+it("moves servers in one bot's folders to that bot once, says so once, and keeps them out of every other bot's turns", async () => {
+ const { cfg, host, told, started, data } = setup();
+ host.boot();
+ await host.health.settled();
+ expect(told).toEqual([
+ { text: "The Blender, Blender-own and Sketch-suite tools only work for Iris, so they're off for your other bots.", about: "iris" },
+ { text: "The Broken tool doesn't start, so it's off for now. It comes back on its own once it starts.", about: "iris" },
+ ]);
+ expect((cfg.mcpServers!.blender as { args: string[] }).args).toEqual([join(data, "workspaces", "iris", "tools", "blender-mcp-2", "server.py")]);
+ expect(Object.keys(host.mounted(IRIS)).sort()).toEqual(["blender", "blender-own", "notes", "sketch-suite"]);
+ expect(Object.keys(host.mounted(PAUL)).sort()).toEqual(["notes"]);
+ 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.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"]);
+
+ host.boot();
+ await host.health.settled();
+ expect(told, "a second start says nothing new").toHaveLength(2);
+ host.botDeleted("iris");
+ expect(Object.keys(cfg.mcpServers!).sort()).toEqual(["broken", "notes"]);
+});
+
+it("where every bot reaches every folder (a desktop), keeps such servers every bot's and says nothing about them", async () => {
+ const { cfg, host, told, data } = setup({ boxed: false });
+ host.boot();
+ await host.health.settled();
+ expect(Object.values(cfg.mcpServers!).some((server) => "bot" in (server as object))).toBe(false);
+ expect((cfg.mcpServers!.blender as { args: string[] }).args[0], "nothing moved").toBe(join(data, "task-workspaces", "iris", "t2", "blender-mcp", "server.py"));
+ expect(told.map((entry) => entry.text)).toEqual(["The Broken tool doesn't start, so it's off for now. It comes back on its own once it starts."]);
+ expect(existsSync(join(data, "mcp-bot-servers.json")), "a later boxed start still moves them over").toBe(false);
+});
+
+it("moves servers over once: a server added in Settings afterwards stays every bot's across restarts", () => {
+ const first = setup();
+ first.host.boot();
+ first.cfg.mcpServers!.shared = { command: "/usr/bin/python3", args: [script(first.data, "workspaces", "iris", "tools", "shared", "server.py")], enabled: true };
+ const again = createMcpServersHost({
+ dataDir: first.data, cfg: () => first.cfg, persist: (next) => { first.cfg.mcpServers = next; }, bots: () => [IRIS, PAUL], policy: (servers) => servers,
+ tell: () => {}, startsServers: () => true, boxed: () => true, start: async () => ({ ok: true }),
+ });
+ again.boot();
+ expect(first.cfg.mcpServers!.shared).not.toHaveProperty("bot");
+ expect(Object.keys(again.mounted(PAUL))).toContain("shared");
+});
+
+it("never makes a server the own of a deleted bot whose folder was left behind", () => {
+ const { cfg, host } = setup({ bots: [PAUL, ROSA] });
+ host.boot();
+ expect(Object.values(cfg.mcpServers!).some((server) => "bot" in (server as object)), "Iris is gone").toBe(false);
+});
+
+it("says it in one plain line per bot", () => {
+ expect(claimedNotice("Iris", ["blender"])).toBe("The Blender tool only works for Iris, so it's off for your other bots.");
+});
diff --git a/server/host/mcp-servers-host.ts b/server/host/mcp-servers-host.ts
new file mode 100644
index 0000000000..8da54e81ed
--- /dev/null
+++ b/server/host/mcp-servers-host.ts
@@ -0,0 +1,104 @@
+// Which config.json MCP servers each bot's turns start: every bot's and the bot's own, minus any that does not start.
+import { existsSync } from "node:fs";
+import { join } from "node:path";
+
+import { writeFileAtomic } from "../atomic.ts";
+import type { AppConfig } from "../config.ts";
+import { customMcpServers } from "../config.ts";
+import type { McpServerSpec, StdioMcpSpec } from "../contracts.ts";
+import { addBotMcpServer, claimBotMcpServers, withoutBotMcpServers, type BotMcpServerAdd } from "../mcp-bot-servers.ts";
+import { createMcpHealth, nameList, toolLabel, type McpHealthDeps } from "../mcp-health.ts";
+import { probeMcpServer } from "../mcp-probe.ts";
+import { isRemoteMcpServer, parseStoredMcpServer } from "../mcp-registry.ts";
+import { canUseMcpServer } from "../../shared/tool-scope.ts";
+
+type Bot = { id: string; name: string; mcpServers?: string[]; toolScope?: unknown };
+
+export interface McpServersHostDeps {
+ dataDir: string;
+ cfg(): AppConfig;
+ persist(next: Record<string, unknown>): void;
+ bots(): readonly Bot[];
+ /** The organisation's MCP policy over a bot's servers. */
+ policy<T extends object>(servers: Record<string, T>): Record<string, T>;
+ /** One plain line for the person about `bot`. */
+ tell(text: string, bot: { id: string; name: string }): void;
+ /** Whether this bot's AI starts config.json servers at all. */
+ startsServers(botId: string): boolean;
+ /** Whether bots' turns run boxed here, each seeing only its own folders. */
+ boxed(): boolean;
+ start?: McpHealthDeps["start"];
+}
+
+const CLAIMED_FILE = (dataDir: string) => join(dataDir, "mcp-bot-servers.json");
+
+/** What the person hears once when servers in one bot's folder became that bot's own. */
+export function claimedNotice(botName: string, names: readonly string[]): string {
+ const tools = names.toSorted().map(toolLabel);
+ return tools.length === 1
+ ? `The ${tools[0]} tool only works for ${botName}, so it's off for your other bots.`
+ : `The ${nameList(tools)} tools only work for ${botName}, so they're off for your other bots.`;
+}
+
+/** The enabled command servers this computer starts, by name, with the bot each is for. */
+export function enabledCommandServers(cfg: AppConfig): Record<string, StdioMcpSpec & { bot?: string }> {
+ const out: Record<string, StdioMcpSpec & { bot?: string }> = {};
+ for (const [name, raw] of Object.entries(cfg.mcpServers ?? {})) {
+ const parsed = parseStoredMcpServer(name, raw);
+ if (!parsed.ok || isRemoteMcpServer(parsed.server) || !parsed.server.enabled || parsed.server.runsOn) continue;
+ const { command, args, env, bot } = parsed.server;
+ out[name] = { command, args, env, ...(bot ? { bot } : {}) };
+ }
+ return out;
+}
+
+export function createMcpServersHost(deps: McpServersHostDeps) {
+ const configured = (bot: Bot): Record<string, McpServerSpec> => deps.policy(customMcpServers(deps.cfg(), bot.mcpServers, bot.id));
+ /** None on an AI that starts no servers, and only those its tool selection reaches. */
+ const started = (bot: Bot): string[] => (deps.startsServers(bot.id) ? Object.keys(configured(bot)).filter((name) => canUseMcpServer(bot.toolScope, name)) : []);
+ const start: McpHealthDeps["start"] = deps.start ?? (async (_name, server, botId) => {
+ const own = join(deps.dataDir, "workspaces", botId);
+ const result = await probeMcpServer({ ...server, enabled: true }, undefined, undefined, { asBot: { id: botId, cwd: existsSync(own) ? own : deps.dataDir } });
+ return result.ok ? { ok: true } : { ok: false, error: result.error };
+ });
+ const health = createMcpHealth({
+ file: join(deps.dataDir, "mcp-health.json"),
+ servers: () => enabledCommandServers(deps.cfg()),
+ users: (name) => deps.bots().filter((bot) => started(bot).includes(name)),
+ start,
+ tell: deps.tell,
+ });
+
+ return {
+ health,
+ mounted: (bot: Bot): Record<string, McpServerSpec> => health.usable(bot.id, 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[] } => {
+ const offFor = health.offFor(server.name);
+ return offFor.length ? { ...server, offFor } : server;
+ },
+ botAdd: (current: Record<string, unknown>, body: unknown, botId: string): BotMcpServerAdd => addBotMcpServer(current, body, botId, deps.dataDir, deps.boxed()),
+ botDeleted(botId: string): void {
+ const next = withoutBotMcpServers(deps.cfg().mcpServers, botId);
+ if (next) deps.persist(next);
+ },
+ /** At start: the first time bots run boxed here, servers in one existing bot's folders become its own (said once);
+ * then every server is checked. A server added after that stays as it was added. */
+ boot(): void {
+ if (deps.boxed() && !existsSync(CLAIMED_FILE(deps.dataDir))) {
+ const bots = deps.bots();
+ const claimed = claimBotMcpServers(deps.cfg().mcpServers, deps.dataDir, (botId) => bots.some((bot) => bot.id === botId));
+ if (claimed) deps.persist(claimed.next);
+ writeFileAtomic(CLAIMED_FILE(deps.dataDir), JSON.stringify({ claimedAt: Date.now() }), { mode: 0o600 });
+ for (const [botId, names] of Object.entries(claimed?.claimed ?? {})) {
+ const bot = bots.find((candidate) => candidate.id === botId);
+ if (bot && bots.length > 1) deps.tell(claimedNotice(bot.name, names), bot);
+ }
+ }
+ health.checkAll();
+ },
+ };
+}
+
+export type McpServersHost = ReturnType<typeof createMcpServersHost>;
diff --git a/server/host/team-connections-host.test.ts b/server/host/team-connections-host.test.ts
index 1f60c824cd..38b2bb3c56 100644
--- a/server/host/team-connections-host.test.ts
+++ b/server/host/team-connections-host.test.ts
@@ -162,29 +162,31 @@ describe("apps each person connects", () => {
});
});
+const BOT = { id: "bot-1", name: "Bot" };
+
describe("MCP servers each person connects", () => {
it("gives a member's own turn her key, never the team's, and no other turn either", async () => {
const { host, dataDir } = setup();
adaConnected(host, dataDir);
- const own = await host.turnMcp({}, "ada-chat", "g");
+ const own = await host.turnMcp(BOT, "ada-chat", "g");
expect(own.mail).toEqual({ type: "http", url: "https://mail.example/mcp", headers: { Authorization: "Bearer ada-own-mail-key" } });
expect(own.console, "the team's server is the team's, with its key").toEqual({ type: "http", url: "https://console.example/mcp", headers: { Authorization: "Bearer team-console-key" } });
for (const thread of ["room-chat", "main-chat", "cleo-chat"]) {
- const elsewhere = await host.turnMcp({}, thread, "g");
+ const elsewhere = await host.turnMcp(BOT, thread, "g");
expect(elsewhere.mail, thread).toBeUndefined();
expect(JSON.stringify(elsewhere), thread).not.toContain("ada-own-mail-key");
expect(JSON.stringify(elsewhere), thread).not.toContain("team-mail-key");
}
const admin = setup({ requester: { "ada-chat": BEN } });
adaConnected(admin.host, admin.dataDir);
- expect((await admin.host.turnMcp({}, "ada-chat", "g")).mail, "Ben writing in Ada's chat").toBeUndefined();
- expect(host.engineMcp({}).mail, "with no conversation in view: the team's only").toBeUndefined();
+ expect((await admin.host.turnMcp(BOT, "ada-chat", "g")).mail, "Ben writing in Ada's chat").toBeUndefined();
+ expect(host.engineMcp(BOT).mail, "with no conversation in view: the team's only").toBeUndefined();
});
it("pins a member's key to the server's address: re-pointed, it is not sent", async () => {
const { host, dataDir } = setup({ servers: { mail: { type: "http", url: "https://elsewhere.example/mcp", headers: {}, enabled: true } } });
adaConnected(host, dataDir);
- expect((await host.turnMcp({}, "ada-chat", "g")).mail).toBeUndefined();
+ expect((await host.turnMcp(BOT, "ada-chat", "g")).mail).toBeUndefined();
});
it("keeps members' keys in a folder of its own that no backup carries", () => {
diff --git a/server/host/team-connections-host.ts b/server/host/team-connections-host.ts
index 3ec29ca5d5..e8c6f5d32b 100644
--- a/server/host/team-connections-host.ts
+++ b/server/host/team-connections-host.ts
@@ -21,6 +21,7 @@ import type { ConnectorScopes } from "../../shared/connector-scopes.ts";
type Bot = { id: string; name: string; connectorTools?: Parameters<typeof Composio.mcpIntegration>[1]["connectorTools"]; connectorScopes?: ConnectorScopes };
type Integration = { command: string; args: string[]; env: Record<string, string> };
+type McpBot = { id: string; name: string; mcpServers?: string[] };
export interface TeamConnectionsHostDeps {
team: CloudTeam | null;
@@ -36,7 +37,7 @@ export interface TeamConnectionsHostDeps {
mint(capability: { botId: string; threadId: string; generation: string; connectorsFor?: string }): string;
mcpOAuth: McpOAuthManager;
/** The bot's enabled MCP servers, as policy allows them, before any sign-in is attached. */
- botMcp(bot: { mcpServers?: string[] }): Record<string, McpServerSpec>;
+ botMcp(bot: McpBot): Record<string, McpServerSpec>;
isSessionLive(id: string): boolean;
/** The connected-apps service a member's own installation is made on; null: none here. */
brokerUrl(): string | null;
@@ -207,7 +208,7 @@ export function createTeamConnectionsHost(deps: TeamConnectionsHostDeps) {
/** A turn's MCP servers: the team's (never a `person` server's team credential), plus, in a member's own turn, the
* `person` servers they connected, with their own key or sign-in. */
- async turnMcp(bot: { mcpServers?: string[] }, threadId: string, generation: string): Promise<Record<string, McpServerSpec>> {
+ async turnMcp(bot: McpBot, threadId: string, generation: string): Promise<Record<string, McpServerSpec>> {
const all = deps.botMcp(bot), names = personMcp();
const out = await withMcpSignIn(without(all, names), deps.mcpOAuth);
const person = names.length ? turnPerson(threadId, generation) : null;
@@ -222,7 +223,7 @@ export function createTeamConnectionsHost(deps: TeamConnectionsHostDeps) {
},
/** The bot's servers with no conversation in view (the setup preview, approval keys, chat apps): the team's only. */
- engineMcp(bot: { mcpServers?: string[] }): Record<string, McpServerSpec> {
+ engineMcp(bot: McpBot): Record<string, McpServerSpec> {
return withoutPendingSignIn(without(deps.botMcp(bot), personMcp()), deps.mcpOAuth);
},
diff --git a/server/index.ts b/server/index.ts
index 452f4a3436..886a7da3e2 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -7,7 +7,7 @@ import { homedir } from "node:os";
import { rm as removeDirectory } from "node:fs/promises";
import { createServer, type IncomingMessage, type ServerResponse } from "node:http";
import { ToolResults, TOOL_RESULT_MAX_CHARS } from "./tool-results.ts";
-import { join } from "node:path";
+import { join, relative } from "node:path";
import { authorizeExternalRuntime, externalRuntimeIsActive, type ExternalRuntimeGrant } from "./external-runtime.ts";
import { z } from "zod";
import { selectReplay, replayToolCalls, DEFAULT_REBUILD_BYTES, MAX_SUMMARY_BYTES } from "./context-rebuild.ts";
@@ -174,7 +174,6 @@ import {
type AppConfig,
vpsSshAlias,
DATA_DIR, EVENTS_DIR,
- customMcpServers,
onConfigSaved,
CLAUDE_API_INSTANCE,
openCodeProviderKeys,
@@ -196,7 +195,7 @@ import { assertWithinBudget, noteSpend, spendAlertText, spendState, takeSpendAle
import { fleetAvailable, fleetSocketPath } from "./fleet-client.ts";
import { HOSTED_CONTRACT_HEADER, HOSTED_CONTRACT_METADATA, HOSTED_CONTRACT_VERSION } from "./hosted-contract.ts";
import { cliProbeEnvironment, testCliBinary } from "./cli-probe.ts";
-import { buildMentionNotification, buildNotification, buildSpendNotification, type Notification } from "./notify.ts";
+import { buildMentionNotification, buildNoticeNotification, buildNotification, buildSpendNotification, type Notification } from "./notify.ts";
import {
isModelVariant,
TurnNotStartedError, TurnAuthenticationRefusedError, TurnUsageLimitRefusedError,
@@ -211,8 +210,8 @@ import { RETRY_MAX_ATTEMPTS } from "./drivers/retry.ts";
import { recoveryCapabilityError } from "./automatic-recovery.ts";
import { createQuotaSwitchHost } from "./host/quota-switch.ts";
import { decodeGeneratedImage } from "./generated-image.ts";
+import { createMcpServersHost } from "./host/mcp-servers-host.ts";
import {
- addDisabledMcpServer,
isRemoteMcpServer,
listMcpServers,
parseStoredMcpServer,
@@ -1399,7 +1398,7 @@ function bookTurnUsage(row: Omit<UsageRow, "at" | "costSource">, tokensReported
}
}
-const providerAuthSessions = new ProviderAuthSessions();
+const providerAuthSessions = new ProviderAuthSessions(); const mcpServersHost = createMcpServersHost({ dataDir: DATA_DIR, cfg: () => cfg, persist: persistMcpServers, bots: () => store.bots, policy: (servers) => managedPolicy.filterMcp(servers), tell: (text, about) => notify(buildNoticeNotification(about, store.bot(about.id)?.threadId ?? "", text)), startsServers: (botId) => { const bot = store.bot(botId); return Boolean(bot && registry.get(bot.modelSelection.instanceId)?.adapter.capabilities.customMcp === true); }, boxed: () => botBox.enabled() });
const mcpOAuth = new McpOAuthManager({
file: join(DATA_DIR, "mcp-oauth.json"),
isOwnerLive: (owner) => owner === "loopback" || sessions.isLive(owner),
@@ -1414,7 +1413,7 @@ const mcpOAuth = new McpOAuthManager({
const teamConnections = createTeamConnectionsHost({ team: CLOUD_TEAM, dataDir: DATA_DIR, cfg: () => cfg, adminOrigin: CLOUD_HOME?.adminOrigin ?? null, harnessUrl: `http://127.0.0.1:${PORT}`, audienceOf: teamHost.audienceOf,
requester: (threadId, generation) => { const owner = directRequestOwners.get(threadId); return provenRequestPerson(owner, generation ?? owner?.generation ?? "", (id) => linePersonKey(store.messagesFor(threadId).find((message) => message.id === id))); },
mint: (capability) => mintInternalCapability({ ...capability, depth: 0, kind: "connectors", skillAuthoring: false, createdBots: 0, openedThreads: 0 }), mcpOAuth, isSessionLive: (id) => sessions.isLive(id),
- botMcp: (bot) => managedPolicy.filterMcp(customMcpServers(cfg, bot.mcpServers)), brokerUrl: () => (CLOUD_TEAM ? cloudConnectedAppsBrokerUrl() || null : null), composio }); teamConnections.primeApps();
+ botMcp: (bot) => mcpServersHost.mounted(bot), brokerUrl: () => (CLOUD_TEAM ? cloudConnectedAppsBrokerUrl() || null : null), composio }); teamConnections.primeApps();
// OpenCode reads provider keys (ANTHROPIC_API_KEY, OPENAI_API_KEY, …) from its environment. Wired before the first catalog probe below.
let openCodeOrganisationManaged = (): boolean => false;
const openCodeKeysAllowed = (): boolean => openCodeProviderKeysAllowed({
@@ -2911,7 +2910,7 @@ const teamComputers = new TeamComputers(join(DATA_DIR, "team-computers.json"), E
let followupsReady = false;
const sendSequencer = new SendSequencer();
// Before the new-bot default is read: a saved default may name the engine.
-await retryComputerEngineMove();
+await retryComputerEngineMove(); mcpServersHost.boot();
if (store.needsSeed()) await Promise.race([cloudCreditStarted, new Promise(resolve => setTimeout(resolve, 15_000).unref())]);
if (store.needsSeed()) { firstEngineRead(); await refreshUnsetModelSelections(); }
else enginesRead = registry.readAtStart(enginesByUse([cfg.defaultModelSelection, ...store.bots.map((bot) => bot.modelSelection)]), firstEngineRead).then(async ({ engines, changed }) => {
@@ -3048,7 +3047,7 @@ function previewSystemPrompt(bot: BotRecord) {
{ id: "composio", label: "Connected apps", text: caps?.composioMcp && bot.composio !== false && composio.configured(cfg) ? composioSystemPrompt(bot.connectorTools) + describeConnectorScopes(bot.connectorScopes) : "" },
{ id: "highlevel", label: "HighLevel", text: caps?.highlevelMcp === true && highlevelHost.mounts(bot) ? highlevelHost.prompt(bot) : "" },
...phones.previewParts(bot, caps?.deviceMcp === true),
- { id: "mcp", label: "MCP servers", text: caps?.customMcp ? customMcpPrompt(Object.keys(engineMcpServers(bot))) : "" }, { id: "to-connect", label: "Connections to make", text: cloudConnections.prompt(bot) },
+ { id: "mcp", label: "MCP servers", text: caps?.customMcp ? customMcpPrompt(Object.keys(engineMcpServers(bot)), mcpServersHost.off(bot)) : "" }, { id: "to-connect", label: "Connections to make", text: cloudConnections.prompt(bot) },
{ id: "browser", label: "Browser", text: previewPlan.browser ? browserPromptFor(bot, agentsMounted) : "" },
{ id: "coordination", label: "Team", text: agentsMounted && coordination ? ` ${coordination}` : "" },
{ id: "credential", label: "Credentials", text: agentsMounted ? CREDENTIAL_PROMPT : "" },
@@ -4643,7 +4642,7 @@ store.onChange((change) => {
break;
case "bot.deleted":
sentThreads.delete(change.botId);
- try { commandAllowlist.clear(change.botId); }
+ try { commandAllowlist.clear(change.botId); mcpServersHost.botDeleted(change.botId); }
catch { console.error("[command-allowlist] Could not remove deleted bot's saved rules."); }
broadcast({ kind: "bot.deleted", botId: change.botId });
break;
@@ -6528,7 +6527,7 @@ bus.subscribe((event: RuntimeEvent) => {
if (bot && event.sessionId && event.providerInstanceId) {
store.setResumeCursor(bot.id, event.providerInstanceId, event.sessionId, event.threadId);
}
- if (typeof event.model === "string" && event.model) sessionModelByThread.set(event.threadId, event.model);
+ if (typeof event.model === "string" && event.model) sessionModelByThread.set(event.threadId, event.model); if (bot && event.mcpFailed?.length) mcpServersHost.health.engineFailed(bot.id, event.mcpFailed);
break;
case "item.completed":
if (event.itemType === "assistant_text") {
@@ -8101,7 +8100,7 @@ async function startTurn(
}
// User MCP servers' tools are never pre-allowed: every call rides the normal permission flow.
if (instance.adapter.capabilities.customMcp === true && !proactive.fence.confines(threadId)) {
- const custom = await teamConnections.turnMcp(bot, threadId, dispatchClaimId);
+ const custom = await mcpServersHost.prepare(bot).then(() => teamConnections.turnMcp(bot, threadId, dispatchClaimId));
attachCustomMcp(integrations, custom, cfg, { botId: bot.id, threadId });
if (Object.keys(custom).length) Object.assign(integrations, chatAppsMcp.turnMounts(custom, bot.toolScope));
}
@@ -8555,7 +8554,7 @@ async function startTurn(
{ id: "plan", label: "Surface", text: surfacePrompt({ computer: mountedComputer, browser: Boolean(integrations.browser) }, { pinned: plan.pinned, note: plan.note + vpsUnavailableNote + vmUpdateNote + (computerSkipped && plan.computer !== "off" ? computerSkippedNote(redactSecretsInText(computerSkipped)) : ""), canSelect: computerSelectionTurns.has(threadId), cloudHome: Boolean(CLOUD_HOME), botOpened: plan.botOpened }) },
{ id: "cloud-home", label: "My Cloud", text: CLOUD_HOME ? cloudHomePrompt(Boolean(integrations.agents) && lendingEnabled(), syncedFolders(DATA_DIR), sharedComputers.known(CLOUD_HOME_LENDER)) + firstHourHooks.prompt(bot.id, threadId) : "" },
{ id: "composio", label: "Connected apps", text: integrations.composio ? composioSystemPrompt(liveBot?.connectorTools ?? bot.connectorTools) + describeConnectorScopes((liveBot ?? bot).connectorScopes) : "" },
- { id: "mcp", label: "MCP servers", text: customMcpPrompt(Object.keys(integrations.custom ?? {})) }, { id: "to-connect", label: "Connections to make", text: cloudConnections.prompt(liveBot ?? bot) + teamConnections.prompt(threadId, integrations) },
+ { id: "mcp", label: "MCP servers", text: customMcpPrompt(Object.keys(integrations.custom ?? {}), mcpServersHost.off(bot)) }, { id: "to-connect", label: "Connections to make", text: cloudConnections.prompt(liveBot ?? bot) + teamConnections.prompt(threadId, integrations) },
{ id: "browser", label: "Browser", text: integrations.browser ? browserPromptFor(bot, Boolean(integrations.agents)) : "" },
{ id: "data", label: "Data", text: integrations.data ? BUILT_IN_DATA_SYSTEM_PROMPT : "" },
{ id: "highlevel", label: "HighLevel", text: integrations.highlevel ? highlevelHost.prompt(liveBot ?? bot) : "" },
@@ -10041,7 +10040,7 @@ async function runClaimedGroupMemberTurn(
return true;
}
if (instance.adapter.capabilities.customMcp === true) {
- attachCustomMcp(integrations, await teamConnections.turnMcp(bot, threadId, internalGeneration), cfg, { botId: bot.id, threadId });
+ attachCustomMcp(integrations, await mcpServersHost.prepare(bot).then(() => teamConnections.turnMcp(bot, threadId, internalGeneration)), cfg, { botId: bot.id, threadId });
}
// An interrupt during connected-app setup must still stop the queued room operation before it starts a process.
if (isCancelled?.()) return false;
@@ -10395,7 +10394,7 @@ async function runClaimedGroupMemberTurn(
{ id: "user-profile", label: "About the user", text: userProfileSystemPrompt(teamHost.profileFor(threadId, cfg.profile)) }, { id: "people", label: "People", text: teamMessages.prompt(bot.id, threadId, Boolean(integrations.agents)) },
{ id: "files", label: "File locations", text: workspace ? workspaceLocationsPrompt(bot.id, cwd, readyBot.cwd, { attachFile: Boolean(integrations.agents) && !CLOUD_HOME && !HOSTED_WORKSPACE }) : "" },
{ id: "shell", label: "Long-running commands", text: workspace ? longCommandsPrompt(roomComputerPromptKind) : "" },
- { id: "mcp", label: "MCP servers", text: customMcpPrompt(Object.keys(integrations.custom ?? {})) + teamConnections.prompt(threadId, integrations) },
+ { id: "mcp", label: "MCP servers", text: customMcpPrompt(Object.keys(integrations.custom ?? {}), mcpServersHost.off(bot)) + teamConnections.prompt(threadId, integrations) },
{ id: "computer", label: "Computer", text: computerPrompt(roomComputerPromptKind) },
{ id: "team-computer", label: "Team computer", text: teamComputerPrompt(roomTeamComputer) },
{ id: "plan", label: "Surface", text: surfacePrompt({ computer: roomTeamComputer ? "cloud" : roomVmTarget ? "vm" : surfaceOfComputerKind(roomComputerKind), browser: Boolean(integrations.browser) }, { note: roomPlan.note, cloudHome: Boolean(CLOUD_HOME) }) },
@@ -12050,7 +12049,7 @@ function mcpServerResponse() {
const auth = mcpOAuth.authState(server.name, server.url);
const listed = server.oauth ? { ...server, oauth: { ...server.oauth, redirectUri: mcpOAuthRedirectUri(server.url) } } : server;
return auth === "none" ? listed : { ...listed, auth };
- }).map(server =>
+ }).map(mcpServersHost.listing).map(server =>
managedPolicy.mcpAllowed(server.name, "url" in server ? server.url : undefined) ? server : { ...server, managedBy: policy!.organizationName });
return { servers, ...(policy && !policy.mcp.allowCustom ? { managed: { organizationName: policy.organizationName, allowlist: policy.mcp.allowlist } } : {}) };
}
@@ -12610,7 +12609,7 @@ ROUTES.push(createMcpServerRoutes({
cloudHome: CLOUD_HOME,
fallbackPublicUrl: FALLBACK_PUBLIC_URL,
mcpConfigBusy: { get: () => mcpConfigBusy, set: (busy) => { mcpConfigBusy = busy; } },
- mcpServerResponse, mcpPolicyRefusal, persistMcpServers, savedCustomDomain, appCatalog: chatAppsMcp, forgetPeople: (name) => teamConnections.forgetServer(name),
+ mcpServerResponse, mcpPolicyRefusal, persistMcpServers, savedCustomDomain, appCatalog: chatAppsMcp, forgetPeople: (name) => teamConnections.forgetServer(name), health: mcpServersHost.health,
}));
ROUTES.push(createSetupImportRoutes({ local: DESKTOP_MANAGED && !CLOUD_HOME && !HOSTED_WORKSPACE, cfg, mcpPolicyRefusal, persistMcpServers,
mcpConfigBusy: { get: () => mcpConfigBusy, set: (busy) => { mcpConfigBusy = busy; } } }));
@@ -14584,7 +14583,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {
try {
const redeemed = secretCards.redeemMcpServer(await readInternalBody(), internalSender.id, internalCapability.threadId);
if (!redeemed.ok) return json(res, 400, { error: redeemed.error });
- const added = addDisabledMcpServer(cfg.mcpServers ?? {}, redeemed.value);
+ const added = mcpServersHost.botAdd(cfg.mcpServers ?? {}, redeemed.value, internalSender.id);
if (!added.ok) return json(res, added.status, { error: added.error });
const refusal = mcpPolicyRefusal(added.name, added.server);
if (refusal) return json(res, 403, { error: refusal, code: "managed_policy" });
@@ -14592,7 +14591,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {
const server = added.server;
const remote = isRemoteMcpServer(server);
return json(res, 201, {
- name: added.name,
+ name: added.name, ...(!remote && server.bot ? { own: true } : {}), ...(added.moved?.length ? { keptIn: added.moved.map(({ to }) => relative(workspaceDir(internalSender.id), to)) } : {}),
enabled: false,
transport: remote ? server.type : "command",
target: remote ? server.url : server.command,
diff --git a/server/mausbot-notifications.ts b/server/mausbot-notifications.ts
index 0198374759..eea1b0dde6 100644
--- a/server/mausbot-notifications.ts
+++ b/server/mausbot-notifications.ts
@@ -30,6 +30,7 @@ const LEAN: Record<NotifyKind, Lean> = {
mention: "needs-you",
spend: "needs-you",
brief: "needs-you",
+ notice: "fyi",
};
const LIST_LIMIT = 40;
diff --git a/server/mcp-bot-servers.test.ts b/server/mcp-bot-servers.test.ts
new file mode 100644
index 0000000000..287cd0a24c
--- /dev/null
+++ b/server/mcp-bot-servers.test.ts
@@ -0,0 +1,162 @@
+import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join, resolve } from "node:path";
+import { afterEach, describe, expect, it } from "vitest";
+
+import { customMcpServers, type AppConfig } from "./config.ts";
+import { addBotMcpServer, botFolderUse, claimBotMcpServers, keepInBotFolder, withoutBotMcpServers } from "./mcp-bot-servers.ts";
+
+const dirs: string[] = [];
+afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });
+
+function dataDir(): string {
+ const dir = mkdtempSync(join(tmpdir(), "omb-mcp-bot-servers-"));
+ dirs.push(dir);
+ return dir;
+}
+
+function file(path: string, text = "print('hi')\n"): string {
+ mkdirSync(join(path, ".."), { recursive: true });
+ writeFileSync(path, text);
+ return path;
+}
+
+const python = (script: string) => ({ command: "/usr/bin/python3", args: [script], env: {} });
+
+describe("whose folders a command server's files are in", () => {
+ it("names the bot of a workspace path, and the conversation entry of a task-workspace path", () => {
+ const data = resolve("/data"), at = (...parts: string[]) => join(data, ...parts);
+ expect(botFolderUse(python(at("workspaces", "iris", "tools", "blender-mcp", "server.py")), data)).toEqual({ botId: "iris", temporary: [] });
+ expect(botFolderUse(python(at("task-workspaces", "iris", "t1", "blender-mcp", "server.py")), data))
+ .toEqual({ botId: "iris", temporary: [at("task-workspaces", "iris", "t1", "blender-mcp")] });
+ expect(botFolderUse({ command: "node", args: [`--root=${at("task-workspaces", "iris", "t2")}`], env: {} }, data))
+ .toEqual({ botId: "iris", temporary: [at("task-workspaces", "iris", "t2")] });
+ expect(botFolderUse({ command: "python3", args: ["-m", "srv"], env: { PYTHONPATH: at("workspaces", "iris", "tools", "lib") } }, data))
+ .toEqual({ botId: "iris", temporary: [] });
+ });
+
+ it("is no bot's for a command outside the data folder, and several bots' when it mixes them", () => {
+ const data = resolve("/data");
+ expect(botFolderUse({ command: "npx", args: ["-y", "@x/notes-mcp"], env: {} }, data)).toBeNull();
+ expect(botFolderUse(python(resolve("/elsewhere", "workspaces", "iris", "server.py")), data)).toBeNull();
+ expect(botFolderUse({ command: "/usr/bin/python3", args: [join(data, "workspaces", "iris", "a.py"), join(data, "workspaces", "paul", "b.py")], env: {} }, data)).toBe("several");
+ });
+});
+
+describe("keeping a conversation folder's server in the bot's own folder", () => {
+ it("copies the folder under tools/, picks a free name, and points the server there", () => {
+ const data = dataDir();
+ file(join(data, "workspaces", "iris", "tools", "blender-mcp", "server.py"), "existing\n");
+ const script = file(join(data, "task-workspaces", "iris", "t1", "blender-mcp", "server.py"), "made in a chat\n");
+ file(join(data, "task-workspaces", "iris", "t1", "blender-mcp", "helper.py"));
+ const server = { ...python(script), env: { BLENDER_ADDON: join(data, "task-workspaces", "iris", "t1", "blender-mcp", "addon") }, enabled: true };
+ const kept = keepInBotFolder(server, botFolderUse(server, data) as never, data);
+ if (!kept.ok) throw new Error(kept.error);
+ const target = join(data, "workspaces", "iris", "tools", "blender-mcp-2");
+ expect(kept.server.args).toEqual([join(target, "server.py")]);
+ expect(kept.server.env.BLENDER_ADDON).toBe(join(target, "addon"));
+ expect(readFileSync(join(target, "server.py"), "utf8")).toBe("made in a chat\n");
+ expect(existsSync(join(target, "helper.py"))).toBe(true);
+ expect(readFileSync(join(data, "workspaces", "iris", "tools", "blender-mcp", "server.py"), "utf8")).toBe("existing\n");
+ });
+
+ it("refuses to write through a tools link the bot pointed elsewhere", () => {
+ const data = dataDir();
+ const elsewhere = join(data, "elsewhere");
+ mkdirSync(elsewhere, { recursive: true });
+ mkdirSync(join(data, "workspaces", "iris"), { recursive: true });
+ symlinkSync(elsewhere, join(data, "workspaces", "iris", "tools"));
+ const server = { ...python(file(join(data, "task-workspaces", "iris", "t1", "srv", "server.py"))), enabled: true };
+ const kept = keepInBotFolder(server, botFolderUse(server, data) as never, data);
+ expect(kept.ok).toBe(false);
+ expect(existsSync(join(elsewhere, "srv"))).toBe(false);
+ });
+
+ it("says so when the conversation folder is gone", () => {
+ const data = dataDir();
+ const server = { ...python(join(data, "task-workspaces", "iris", "gone", "srv", "server.py")), enabled: true };
+ expect(keepInBotFolder(server, botFolderUse(server, data) as never, data)).toEqual({ ok: false, error: expect.stringMatching(/folder is gone/) });
+ });
+});
+
+describe("existing installs", () => {
+ it("makes the servers in one bot's folders that bot's own, keeping chat-folder files, and leaves every bot's servers alone", () => {
+ const data = dataDir();
+ const sketch = file(join(data, "task-workspaces", "iris", "t1", "native-sketch", "server.py"));
+ const blender = file(join(data, "task-workspaces", "iris", "t2", "blender-mcp", "server.py"));
+ const irisOwn = file(join(data, "workspaces", "iris", "tools", "blender-mcp", "server.py"));
+ const raw = {
+ "sketch-suite": { ...python(sketch), enabled: true },
+ blender: { ...python(blender), enabled: true },
+ "blender-own": { ...python(irisOwn), enabled: true },
+ notes: { command: "npx", args: ["-y", "@x/notes-mcp"], env: {}, enabled: true },
+ docs: { type: "http", url: "https://docs.example/mcp", headers: {}, enabled: true },
+ };
+ const claimed = claimBotMcpServers(raw, data, (botId) => botId === "iris");
+ expect(claimed?.claimed).toEqual({ iris: ["sketch-suite", "blender", "blender-own"] });
+ const next = claimed!.next as Record<string, { bot?: string; args?: string[] }>;
+ expect(next["sketch-suite"]).toMatchObject({ bot: "iris", args: [join(data, "workspaces", "iris", "tools", "native-sketch", "server.py")] });
+ expect(next.blender).toMatchObject({ bot: "iris", args: [join(data, "workspaces", "iris", "tools", "blender-mcp-2", "server.py")] });
+ expect(next["blender-own"]).toMatchObject({ bot: "iris", args: [irisOwn] });
+ expect(next.notes).toBe(raw.notes);
+ expect(next.docs).toBe(raw.docs);
+ expect(claimBotMcpServers(claimed!.next, data, () => true), "a second pass changes nothing").toBeNull();
+
+ const cfg = { mcpServers: claimed!.next } as AppConfig;
+ expect(Object.keys(customMcpServers(cfg, undefined, "iris")).sort()).toEqual(["blender", "blender-own", "docs", "notes", "sketch-suite"]);
+ expect(Object.keys(customMcpServers(cfg, undefined, "paul")).sort(), "another bot never starts them").toEqual(["docs", "notes"]);
+ expect(Object.keys(customMcpServers(cfg)).sort(), "nor does a turn of no bot").toEqual(["docs", "notes"]);
+ });
+
+ it("still makes it the bot's own when its chat folder is gone", () => {
+ const data = dataDir();
+ const raw = { lost: { ...python(join(data, "task-workspaces", "iris", "t9", "srv", "server.py")), enabled: true } };
+ expect(claimBotMcpServers(raw, data, () => true)?.next.lost).toMatchObject({ bot: "iris", args: [raw.lost.args[0]] });
+ });
+
+ it("never makes a server the own of a bot that no longer exists: its leftover folder is nobody's", () => {
+ const data = dataDir();
+ const raw = { leftover: { ...python(file(join(data, "workspaces", "gone", "tools", "srv", "server.py"))), enabled: true } };
+ expect(claimBotMcpServers(raw, data, (botId) => botId === "iris")).toBeNull();
+ });
+
+ it("drops a deleted bot's own servers and nothing else", () => {
+ const raw = { mine: { ...python("/d/workspaces/iris/s.py"), enabled: true, bot: "iris" }, notes: { command: "npx", args: [], env: {}, enabled: true } };
+ expect(withoutBotMcpServers(raw, "iris")).toEqual({ notes: raw.notes });
+ expect(withoutBotMcpServers(raw, "paul")).toBeNull();
+ });
+});
+
+describe("a bot adding a server where bots are boxed", () => {
+ it("makes one in its own folder its own, saved off as always", () => {
+ const data = dataDir();
+ const script = file(join(data, "task-workspaces", "iris", "t1", "srv", "server.py"));
+ const added = addBotMcpServer({}, { name: "blender", ...python(script) }, "iris", data, true);
+ if (!added.ok) throw new Error(added.error);
+ expect(added.server).toMatchObject({ bot: "iris", enabled: false, args: [join(data, "workspaces", "iris", "tools", "srv", "server.py")] });
+ expect(added.moved).toEqual([{ from: join(data, "task-workspaces", "iris", "t1", "srv"), to: join(data, "workspaces", "iris", "tools", "srv") }]);
+ expect(added.next.blender).toBe(added.server);
+ });
+
+ it("refuses one that uses another bot's files, and keeps a plain command every bot's", () => {
+ const data = dataDir();
+ expect(addBotMcpServer({}, { name: "theirs", ...python(join(data, "workspaces", "paul", "s.py")) }, "iris", data, true))
+ .toMatchObject({ ok: false, status: 400, error: expect.stringMatching(/another bot's folder/) });
+ const plain = addBotMcpServer({}, { name: "notes", command: "npx", args: ["-y", "@x/notes-mcp"] }, "iris", data, true);
+ expect(plain.ok && plain.server).toEqual({ command: "npx", args: ["-y", "@x/notes-mcp"], env: {}, enabled: false });
+ });
+});
+
+describe("a bot adding a server where every bot reaches every folder (a desktop)", () => {
+ it("still keeps files from a conversation folder in its own folder, but the server stays every bot's", () => {
+ const data = dataDir();
+ const script = file(join(data, "task-workspaces", "iris", "t1", "srv", "server.py"));
+ const added = addBotMcpServer({}, { name: "blender", ...python(script) }, "iris", data, false);
+ if (!added.ok) throw new Error(added.error);
+ expect(added.server).toEqual({ ...python(join(data, "workspaces", "iris", "tools", "srv", "server.py")), enabled: false });
+ expect(added.moved).toHaveLength(1);
+ const theirs = addBotMcpServer({}, { name: "theirs", ...python(join(data, "workspaces", "paul", "s.py")) }, "iris", data, false);
+ expect(theirs.ok && theirs.server, "another bot's files are reachable here").toMatchObject({ args: [join(data, "workspaces", "paul", "s.py")] });
+ expect(theirs.ok && "bot" in theirs.server).toBe(false);
+ });
+});
diff --git a/server/mcp-bot-servers.ts b/server/mcp-bot-servers.ts
new file mode 100644
index 0000000000..fc29d16fe8
--- /dev/null
+++ b/server/mcp-bot-servers.ts
@@ -0,0 +1,177 @@
+// Where bots are boxed (a Cloud), a bot's turn sees only its own folders, so a command MCP server whose program or files
+// are in one bot's folder is that bot's own: no other bot can reach those files, and it starts only for that bot. Files in
+// one of a bot's conversation folders (task-workspaces/<bot>/<thread>) go when that conversation does, boxed or not, so a
+// server the bot adds from there is copied into the bot's own folder first, under tools/.
+import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, realpathSync } from "node:fs";
+import { basename, delimiter, isAbsolute, join, relative, resolve, sep } from "node:path";
+
+import type { StdioMcpSpec } from "./contracts.ts";
+import { addDisabledMcpServer, isRemoteMcpServer, parseStoredMcpServer, type DisabledMcpServerAdd, type StoredStdioMcpServer } from "./mcp-registry.ts";
+
+const ID = /^[A-Za-z0-9_-]{1,128}$/;
+/** What one server's files copied out of a conversation folder may add up to. */
+export const MAX_KEPT_BYTES = 512 * 1024 ** 2;
+const MAX_KEPT_FILES = 50_000;
+
+export interface BotFolderUse {
+ botId: string;
+ /** Entries of the bot's conversation folders the server uses (`task-workspaces/<bot>/<thread>/<entry>`, or the whole
+ * conversation folder when it names that). */
+ temporary: string[];
+}
+
+/** One value of a command, argument or environment variable, as the paths it may hold. */
+function pathsIn(value: string): string[] {
+ const text = value.startsWith("--") && value.includes("=") ? value.slice(value.indexOf("=") + 1) : value;
+ return text.split(delimiter).filter((part) => isAbsolute(part));
+}
+
+function values(server: StdioMcpSpec): string[] {
+ return [server.command, ...server.args, ...Object.values(server.env)].flatMap(pathsIn);
+}
+
+function segments(path: string, root: string): string[] | null {
+ const rel = relative(root, path);
+ if (!rel || rel.startsWith("..") || isAbsolute(rel)) return null;
+ return rel.split(sep);
+}
+
+/** The bot whose folders this server's paths are in, "several" when they are in more than one bot's, else null. */
+export function botFolderUse(server: StdioMcpSpec, dataDir: string): BotFolderUse | "several" | null {
+ const workspaces = join(dataDir, "workspaces"), tasks = join(dataDir, "task-workspaces");
+ let botId: string | null = null;
+ const temporary: string[] = [];
+ for (const value of values(server)) {
+ const full = resolve(value);
+ const own = segments(full, workspaces), task = segments(full, tasks);
+ const owner = own?.[0] ?? task?.[0];
+ if (!owner || !ID.test(owner)) continue;
+ if (botId && botId !== owner) return "several";
+ botId = owner;
+ if (task && task.length >= 2 && ID.test(task[1]!)) {
+ const entry = join(tasks, owner, task[1]!, ...(task.length >= 3 ? [task[2]!] : []));
+ if (!temporary.includes(entry)) temporary.push(entry);
+ }
+ }
+ return botId ? { botId, temporary } : null;
+}
+
+/** Bytes and files under `path`, never following a link; null once past the limits. */
+function size(path: string, total = { bytes: 0, files: 0 }): { bytes: number; files: number } | null {
+ const stat = lstatSync(path);
+ total.bytes += stat.size;
+ total.files += 1;
+ if (total.bytes > MAX_KEPT_BYTES || total.files > MAX_KEPT_FILES) return null;
+ if (stat.isDirectory()) {
+ for (const name of readdirSync(path)) if (!size(join(path, name), total)) return null;
+ }
+ return total;
+}
+
+function rebase(value: string, from: string, to: string): string {
+ const rebasePath = (path: string) => (path === from ? to : path.startsWith(from + sep) ? to + path.slice(from.length) : path);
+ if (value.startsWith("--") && value.includes("=")) {
+ const at = value.indexOf("=") + 1;
+ return value.slice(0, at) + value.slice(at).split(delimiter).map(rebasePath).join(delimiter);
+ }
+ return value.split(delimiter).map(rebasePath).join(delimiter);
+}
+
+export type KeptServer =
+ | { ok: true; server: StoredStdioMcpServer; moved: Array<{ from: string; to: string }> }
+ | { ok: false; error: string };
+
+/** Copies the server's files out of the bot's conversation folders into `workspaces/<bot>/tools/` and points the
+ * server there. */
+export function keepInBotFolder(server: StoredStdioMcpServer, use: BotFolderUse, dataDir: string): KeptServer {
+ if (!use.temporary.length) return { ok: true, server, moved: [] };
+ const own = join(dataDir, "workspaces", use.botId), tools = join(own, "tools");
+ try {
+ mkdirSync(tools, { recursive: true, mode: 0o700 });
+ // Security: a bot may have made tools/ a link to somewhere else; files are only ever written inside its own folder.
+ if (!lstatSync(tools).isDirectory() || segments(realpathSync(tools), realpathSync(own))?.length !== 1) {
+ return { ok: false, error: "Its tools folder is not a plain folder inside this bot's own folder." };
+ }
+ } catch {
+ return { ok: false, error: "This bot's own folder could not be prepared." };
+ }
+ const moved: Array<{ from: string; to: string }> = [];
+ for (const from of use.temporary) {
+ if (!existsSync(from)) return { ok: false, error: "Its files were in a conversation's temporary folder, and that folder is gone." };
+ if (!size(from)) return { ok: false, error: `Its folder is too big to keep: over ${MAX_KEPT_BYTES / 1024 ** 2} MB or ${MAX_KEPT_FILES.toLocaleString("en-US")} files.` };
+ const name = basename(from);
+ let to = join(tools, name);
+ for (let n = 2; existsSync(to); n += 1) {
+ if (n > 99) return { ok: false, error: "Its tools folder already has too many copies of this name." };
+ to = join(tools, `${name}-${n}`);
+ }
+ cpSync(from, to, { recursive: true, errorOnExist: true, force: false, preserveTimestamps: true, verbatimSymlinks: true });
+ moved.push({ from, to });
+ }
+ const rebaseAll = (value: string) => moved.reduce((current, { from, to }) => rebase(current, from, to), value);
+ return {
+ ok: true,
+ moved,
+ server: {
+ ...server,
+ command: rebaseAll(server.command),
+ args: server.args.map(rebaseAll),
+ env: Object.fromEntries(Object.entries(server.env).map(([key, value]) => [key, rebaseAll(value)])),
+ },
+ };
+}
+
+export type BotMcpServerAdd = DisabledMcpServerAdd & { moved?: Array<{ from: string; to: string }> };
+
+/** A bot's add_mcp_server: saved off as always, with files from one of its conversation folders kept in its own folder.
+ * `boxed`: no bot reaches another's folders, so a server using this bot's files becomes its own, and one using another
+ * bot's files is refused; unboxed, every bot reaches them and the server stays every bot's. */
+export function addBotMcpServer(current: Record<string, unknown>, body: unknown, botId: string, dataDir: string, boxed: boolean): BotMcpServerAdd {
+ const added = addDisabledMcpServer(current, body);
+ if (!added.ok || isRemoteMcpServer(added.server)) return added;
+ const use = botFolderUse(added.server, dataDir);
+ if (!use) return added;
+ const theirs = use === "several" || use.botId !== botId;
+ if (theirs && boxed) {
+ return { ok: false, status: 400, error: "That command uses files in another bot's folder, which only that bot can reach. Use files in your own folder." };
+ }
+ if (theirs) return added;
+ const kept = keepInBotFolder(added.server, use, dataDir);
+ if (!kept.ok) return { ok: false, status: 400, error: `This server could not be kept: ${kept.error}` };
+ const server = boxed ? { ...kept.server, bot: botId } : kept.server;
+ return { ...added, server, next: { ...current, [added.name]: server }, moved: kept.moved };
+}
+
+export interface ClaimedMcpServers {
+ next: Record<string, unknown>;
+ /** By bot: the servers that became its own. */
+ claimed: Record<string, string[]>;
+}
+
+/** Existing installs where bots are boxed: every server no bot owns yet whose files are in the folders of one bot that
+ * exists becomes that bot's own, its conversation-folder files kept in its own folder. Null when nothing changes. */
+export function claimBotMcpServers(raw: Record<string, unknown> | undefined, dataDir: string, isBot: (botId: string) => boolean): ClaimedMcpServers | null {
+ const next: Record<string, unknown> = { ...raw };
+ const claimed: Record<string, string[]> = {};
+ for (const [name, value] of Object.entries(raw ?? {})) {
+ const parsed = parseStoredMcpServer(name, value);
+ if (!parsed.ok || isRemoteMcpServer(parsed.server) || parsed.server.bot || parsed.server.runsOn) continue;
+ const use = botFolderUse(parsed.server, dataDir);
+ if (!use || use === "several" || !isBot(use.botId)) continue;
+ let kept: KeptServer;
+ try { kept = keepInBotFolder(parsed.server, use, dataDir); } catch (error) { kept = { ok: false, error: String(error) }; }
+ if (!kept.ok) console.warn(`[mcp] ${name}: kept in place for its bot: ${kept.error}`);
+ next[name] = { ...(kept.ok ? kept.server : parsed.server), bot: use.botId };
+ (claimed[use.botId] ??= []).push(name);
+ }
+ return Object.keys(claimed).length ? { next, claimed } : null;
+}
+
+/** Without the servers that were this deleted bot's own; null when it had none. */
+export function withoutBotMcpServers(raw: Record<string, unknown> | undefined, botId: string): Record<string, unknown> | null {
+ const kept = Object.entries(raw ?? {}).filter(([name, value]) => {
+ const parsed = parseStoredMcpServer(name, value);
+ return !(parsed.ok && !isRemoteMcpServer(parsed.server) && parsed.server.bot === botId);
+ });
+ return kept.length === Object.keys(raw ?? {}).length ? null : Object.fromEntries(kept);
+}
diff --git a/server/mcp-health.test.ts b/server/mcp-health.test.ts
new file mode 100644
index 0000000000..620c32712b
--- /dev/null
+++ b/server/mcp-health.test.ts
@@ -0,0 +1,101 @@
+import { mkdtempSync, readFileSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, describe, expect, it } from "vitest";
+
+import type { StdioMcpSpec } from "./contracts.ts";
+import { RECHECK_FAILED_MS, createMcpHealth, offNotice, type McpHealthDeps } from "./mcp-health.ts";
+
+const dirs: string[] = [];
+afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });
+
+const IRIS = { id: "iris", name: "Iris" }, PAUL = { id: "paul", name: "Paul" };
+const blender: StdioMcpSpec & { bot?: string } = { command: "/usr/bin/python3", args: ["/data/workspaces/iris/tools/blender-mcp/server.py"], env: {}, bot: "iris" };
+const notes: StdioMcpSpec = { command: "npx", args: ["-y", "@x/notes-mcp"], env: {} };
+
+function fixture(options: { startsFor?: (name: string, botId: string) => boolean; servers?: Record<string, StdioMcpSpec & { bot?: string }> } = {}) {
+ const dir = mkdtempSync(join(tmpdir(), "omb-mcp-health-"));
+ dirs.push(dir);
+ let now = 1_000_000;
+ const starts: string[] = [];
+ const told: Array<{ text: string; about: string }> = [];
+ const servers: Record<string, StdioMcpSpec & { bot?: string }> = options.servers ?? { blender, notes };
+ const deps: McpHealthDeps = {
+ file: join(dir, "mcp-health.json"),
+ servers: () => servers,
+ users: (name) => (servers[name]?.bot ? [IRIS] : [IRIS, PAUL]),
+ start: async (name, _server, botId) => {
+ starts.push(`${name}:${botId}`);
+ return (options.startsFor ?? (() => true))(name, botId) ? { ok: true } : { ok: false, error: "The server stopped before the MCP handshake finished." };
+ },
+ tell: (text, about) => told.push({ text, about: about.id }),
+ now: () => now,
+ };
+ return { deps, health: createMcpHealth(deps), starts, told, tick: (ms: number) => { now += ms; }, servers };
+}
+
+describe("checking that command servers start", () => {
+ it("checks a server every bot uses once for all of them, and a bot's own for that bot, once each", async () => {
+ const { health, starts } = fixture();
+ await health.prepare("paul", ["notes"]);
+ await health.prepare("iris", ["notes", "blender"]);
+ await health.prepare("iris", ["notes", "blender"]);
+ expect(starts).toEqual(["notes:paul", "blender:iris"]);
+ });
+
+ it("leaves a server that does not start out of every turn that would start it, and says so once", async () => {
+ const { health, told, deps } = fixture({ startsFor: (name) => name !== "notes" });
+ health.checkAll();
+ await health.settled();
+ expect(Object.keys(health.usable("paul", { blender, notes }))).toEqual(["blender"]);
+ expect(Object.keys(health.usable("iris", { blender, notes }))).toEqual(["blender"]);
+ expect(health.off("paul", ["notes"])).toEqual([{ name: "notes", error: "The server stopped before the MCP handshake finished." }]);
+ expect(health.offFor("notes")).toEqual(["iris", "paul"]);
+ expect(told).toEqual([{ text: "The Notes tool doesn't start, so it's off for now. It comes back on its own once it starts.", about: "iris" }]);
+ health.engineFailed("paul", ["notes"]);
+ await health.settled();
+ const again = createMcpHealth({ ...deps });
+ expect(again.usable("paul", { notes }), "kept across a restart").toEqual({});
+ again.engineFailed("iris", ["notes"]);
+ await again.settled();
+ expect(told, "not again for the same server, nor after a restart").toHaveLength(1);
+ expect(JSON.parse(readFileSync(deps.file, "utf8")).notes.told).toBeTruthy();
+ });
+
+ it("names the bot whose own server does not start", async () => {
+ const { health, told } = fixture({ startsFor: (name) => name !== "blender" });
+ await health.prepare("iris", ["blender"]);
+ expect(told).toEqual([{ text: "Iris's Blender tool doesn't start, so it's off for now. It comes back on its own once it starts.", about: "iris" }]);
+ expect(offNotice("blender", null)).toBe("The Blender tool doesn't start, so it's off for now. It comes back on its own once it starts.");
+ });
+
+ it("tries a server that did not start again on its own, and again at once when a bot's AI says it failed", async () => {
+ let fixed = false;
+ const { health, starts, tick } = fixture({ startsFor: (name) => name !== "notes" || fixed });
+ await health.prepare("paul", ["notes"]);
+ tick(RECHECK_FAILED_MS - 1);
+ await health.prepare("paul", ["notes"]);
+ expect(starts).toEqual(["notes:paul"]);
+ fixed = true;
+ tick(1);
+ await health.prepare("paul", ["notes"]);
+ expect(health.usable("paul", { notes }), "the turn that starts the check again does not wait for it").toEqual({});
+ await health.settled();
+ expect(Object.keys(health.usable("paul", { notes }))).toEqual(["notes"]);
+ fixed = false;
+ health.engineFailed("paul", ["notes"]);
+ await health.settled();
+ expect(starts).toEqual(["notes:paul", "notes:paul", "notes:paul"]);
+ expect(health.usable("iris", { notes })).toEqual({});
+ });
+
+ it("checks a server afresh once its command line changes", async () => {
+ const servers: Record<string, StdioMcpSpec> = { notes };
+ const { health, starts } = fixture({ servers });
+ await health.prepare("paul", ["notes"]);
+ servers.notes = { ...notes, args: ["-y", "@x/notes-mcp@2"] };
+ expect(health.usable("paul", servers), "an edited server is not judged by the old check").toEqual(servers);
+ await health.prepare("paul", ["notes"]);
+ expect(starts).toEqual(["notes:paul", "notes:paul"]);
+ });
+});
diff --git a/server/mcp-health.ts b/server/mcp-health.ts
new file mode 100644
index 0000000000..dc549f4127
--- /dev/null
+++ b/server/mcp-health.ts
@@ -0,0 +1,162 @@
+// Whether each command MCP server starts, started the way a bot's AI would start it. One that does not start is left
+// out of turns (an engine that mounts it anyway fails it on every session, and Claude Code then repeats the failure
+// under every tool search), the person hears about it once, and it is tried again on its own. A bot's own server is
+// checked for that bot; any other server starts the same for every bot on this computer, so one check stands for all.
+import { createHash } from "node:crypto";
+import { readFileSync, statSync } from "node:fs";
+import { isAbsolute } from "node:path";
+
+import { writeFileAtomic } from "./atomic.ts";
+import type { McpServerSpec, StdioMcpSpec } from "./contracts.ts";
+
+/** A server that did not start is tried again after this long; one that started is trusted this long. */
+export const RECHECK_FAILED_MS = 30 * 60_000;
+export const RECHECK_STARTED_MS = 6 * 60 * 60_000;
+const CHECKS_AT_ONCE = 2;
+/** The check of a server that is no bot's own. */
+const EVERY_BOT = "*";
+
+export interface McpStartCheck { ok: boolean; at: number; error?: string }
+interface ServerHealth { key: string; checks: Record<string, McpStartCheck>; told?: string }
+type Bot = { id: string; name: string };
+type CommandServer = StdioMcpSpec & { bot?: string };
+
+export interface McpHealthDeps {
+ file: string;
+ /** The enabled command servers, by name. */
+ servers(): Record<string, CommandServer>;
+ /** The bots whose turns start `name`. */
+ users(name: string): Bot[];
+ /** Starts the server as `botId`'s AI would and lists its tools. */
+ start(name: string, server: StdioMcpSpec, botId: string): Promise<{ ok: true } | { ok: false; error: string }>;
+ /** Says it to the person, once. */
+ tell(text: string, about: Bot): void;
+ now?(): number;
+}
+
+/** The server's identity for its checks: what runs, and the files its command line names, so a fix shows. */
+export function startKey(server: StdioMcpSpec): string {
+ const files = [server.command, ...server.args].filter((value) => isAbsolute(value)).map((path) => {
+ try { const stat = statSync(path); return [path, stat.size, stat.mtimeMs]; } catch { return [path, null]; }
+ });
+ return createHash("sha256").update(JSON.stringify([server.command, server.args, Object.entries(server.env).sort(), files])).digest("hex").slice(0, 32);
+}
+
+/** A server's name as a tool's name in a sentence: "blender" is "Blender". */
+export const toolLabel = (name: string) => name.charAt(0).toUpperCase() + name.slice(1);
+export const nameList = (names: readonly string[]) => names.length <= 1 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
+
+/** The one plain line about a server that does not start. */
+export function offNotice(name: string, owner: Bot | null): string {
+ return `${owner ? `${owner.name}'s ${toolLabel(name)} tool` : `The ${toolLabel(name)} tool`} doesn't start, so it's off for now. It comes back on its own once it starts.`;
+}
+
+export function createMcpHealth(deps: McpHealthDeps) {
+ const now = deps.now ?? Date.now;
+ let state: Record<string, ServerHealth> = {};
+ try { state = JSON.parse(readFileSync(deps.file, "utf8")) as Record<string, ServerHealth>; } catch {}
+ const save = () => { try { writeFileAtomic(deps.file, JSON.stringify(state), { mode: 0o600 }); } catch (error) { console.warn("[mcp] could not save server checks:", error); } };
+ const running = new Map<string, Promise<void>>();
+ const waiting: Array<() => void> = [];
+ let active = 0;
+ const slot = async <T,>(work: () => Promise<T>): Promise<T> => {
+ if (active >= CHECKS_AT_ONCE) await new Promise<void>((resolve) => waiting.push(resolve));
+ active += 1;
+ try { return await work(); } finally { active -= 1; waiting.shift()?.(); }
+ };
+
+ const standsFor = (server: CommandServer, botId: string) => (server.bot ? botId : EVERY_BOT);
+ const checkOf = (name: string, server: CommandServer, botId: string): McpStartCheck | undefined => {
+ const health = state[name];
+ return health && health.key === startKey(server) ? health.checks?.[standsFor(server, botId)] : undefined;
+ };
+ const due = (check: McpStartCheck | undefined) => !check || now() - check.at >= (check.ok ? RECHECK_STARTED_MS : RECHECK_FAILED_MS);
+
+ const record = (name: string, server: CommandServer, botId: string, result: { ok: true } | { ok: false; error: string }) => {
+ const key = startKey(server);
+ const health = state[name]?.key === key && state[name]!.checks ? state[name]! : (state[name] = { key, checks: {} });
+ health.checks[standsFor(server, botId)] = result.ok ? { ok: true, at: now() } : { ok: false, at: now(), error: result.error };
+ const tell = !result.ok && health.told !== key;
+ if (tell) health.told = key;
+ save();
+ if (!tell) return;
+ const about = deps.users(name).find((bot) => bot.id === botId) ?? deps.users(name)[0];
+ if (about) deps.tell(offNotice(name, server.bot ? about : null), about);
+ };
+
+ const check = (name: string, server: CommandServer, botId: string): Promise<void> => {
+ const id = `${name}\u0000${standsFor(server, botId)}`;
+ const pending = running.get(id);
+ if (pending) return pending;
+ const work = slot(() => deps.start(name, server, botId))
+ .catch((error: unknown) => ({ ok: false as const, error: error instanceof Error ? error.message : String(error) }))
+ .then((result) => record(name, server, botId, result))
+ .finally(() => running.delete(id));
+ running.set(id, work);
+ return work;
+ };
+
+ const checkUsers = (name: string, force: boolean) => {
+ const server = deps.servers()[name];
+ if (!server) return;
+ for (const bot of deps.users(name)) {
+ if (force || due(checkOf(name, server, bot.id))) void check(name, server, bot.id);
+ if (!server.bot) return;
+ }
+ };
+
+ return {
+ /** Before a turn: waits for the first check of each of the bot's command servers, and starts any check due again in
+ * the background, so a turn waits for a server at most once. */
+ async prepare(botId: string, names: readonly string[]): Promise<void> {
+ const servers = deps.servers(), first: Promise<void>[] = [];
+ for (const name of names) {
+ const server = servers[name];
+ if (!server) continue;
+ const last = checkOf(name, server, botId);
+ if (!last) first.push(check(name, server, botId));
+ else if (due(last)) void check(name, server, botId);
+ }
+ await Promise.all(first);
+ },
+ /** `mounted` without the command servers that did not start. */
+ usable<T extends McpServerSpec>(botId: string, mounted: Record<string, T>): Record<string, T> {
+ const servers = deps.servers();
+ return Object.fromEntries(Object.entries(mounted).filter(([name]) => !servers[name] || checkOf(name, servers[name], botId)?.ok !== false));
+ },
+ /** Which of `names` are left out of this bot's turns, with why. */
+ off(botId: string, names: readonly string[]): Array<{ name: string; error: string }> {
+ const servers = deps.servers();
+ return names.flatMap((name) => {
+ const last = servers[name] ? checkOf(name, servers[name], botId) : undefined;
+ return last && !last.ok ? [{ name, error: last.error ?? "It did not start." }] : [];
+ });
+ },
+ /** Who a server is off for, by bot id. */
+ offFor(name: string): string[] {
+ const server = deps.servers()[name];
+ return server ? deps.users(name).filter((bot) => checkOf(name, server, bot.id)?.ok === false).map((bot) => bot.id) : [];
+ },
+ /** The bot's AI reported these did not connect: each is checked again now. */
+ engineFailed(botId: string, names: readonly string[]): void {
+ const servers = deps.servers();
+ for (const name of names) if (servers[name]) void check(name, servers[name], botId);
+ },
+ /** A server was added, changed or turned on: checked again now. */
+ changed(name: string): void {
+ delete state[name];
+ save();
+ checkUsers(name, true);
+ },
+ /** In the background, every enabled command server not checked yet. */
+ checkAll(): void {
+ for (const name of Object.keys(deps.servers())) checkUsers(name, false);
+ },
+ /** Settles once every check started so far has. */
+ async settled(): Promise<void> {
+ while (running.size) await Promise.all(running.values());
+ },
+ };
+}
+
+export type McpHealth = ReturnType<typeof createMcpHealth>;
diff --git a/server/mcp-own-servers.e2e.test.ts b/server/mcp-own-servers.e2e.test.ts
new file mode 100644
index 0000000000..f80d686049
--- /dev/null
+++ b/server/mcp-own-servers.e2e.test.ts
@@ -0,0 +1,88 @@
+import { copyFileSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { expect, it } from "vitest";
+
+import { launchVerificationServer } from "../scripts/control-omb.ts";
+
+const FAKE_MCP = fileURLToPath(new URL("./testing/fake-mcp-server.ts", import.meta.url));
+
+// This fixture runs bots unboxed, as a desktop does, so a server a bot adds stays every bot's; where bots are boxed it is
+// that bot's own (server/host/mcp-servers-host.test.ts).
+it("a bot's server from a conversation folder is kept in its own folder, and a server that doesn't start rides along on no bot's turns", async () => {
+ const scratch = mkdtempSync(join(tmpdir(), "omb-own-mcp-"));
+ const gate = join(scratch, "finish");
+ const fixture = await launchVerificationServer({ FAKE_CLAUDE_MODE: "slow", FAKE_CLAUDE_SLOW_FINISH_GATE: gate });
+ const api = async (method: string, path: string, body?: unknown, expected = 200, token?: string) => {
+ const response = await fetch(fixture.info.url + path, {
+ method, headers: { "content-type": "application/json", origin: fixture.info.url, ...(token ? { authorization: `Bearer ${token}` } : {}) },
+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),
+ });
+ const result = await response.json() as any;
+ expect(response.status, `${method} ${path}: ${JSON.stringify(result).slice(0, 400)}`).toBe(expected);
+ return result;
+ };
+ let sends = 0;
+ const turnOf = async (bot: { id: string; threadId: string }) => {
+ sends += 1;
+ const text = `Use your tools, take ${sends}`;
+ await api("POST", `/api/bots/${bot.id}/messages`, { threadId: bot.threadId, text, sendId: `own-mcp-e2e-send-${String(sends).padStart(4, "0")}` }, 202);
+ let dump: any;
+ await expect.poll(() => {
+ try { dump = JSON.parse(readFileSync(fixture.fixtureDumpPath, "utf8")); } catch { return false; }
+ return String(dump.cwd).includes(bot.id) && JSON.stringify(dump.prompt).includes(text);
+ }, { timeout: 20_000 }).toBe(true);
+ return { mounts: dump.mcpConfig.mcpServers as Record<string, any>, settled: async () => {
+ await expect.poll(async () => (await api("GET", `/api/threads/${bot.threadId}/messages`)).messages
+ .some((message: any) => message.role === "bot" && String(message.text).startsWith("reply to:") && String(message.text).includes(text)), { timeout: 20_000 }).toBe(true);
+ } };
+ };
+ try {
+ const iris = (await api("POST", "/api/bots", { name: "Iris" }, 201)).bot;
+ const paul = (await api("POST", "/api/bots", { name: "Paul" }, 201)).bot;
+ const first = await turnOf(iris);
+ const token: string = first.mounts.agents.env.OMB_COMMS_TOKEN;
+
+ // Iris writes a server into this conversation's folder and adds it, as it did on the Cloud.
+ const chatFolder = join(fixture.info.dataDir, "task-workspaces", iris.id, iris.threadId, "sketch");
+ mkdirSync(chatFolder, { recursive: true });
+ copyFileSync(FAKE_MCP, join(chatFolder, "server.ts"));
+ const added = await api("POST", "/api/internal/mcp-servers", { name: "sketch", command: process.execPath, args: ["--experimental-strip-types", "--no-warnings", join(chatFolder, "server.ts")] }, 201, token);
+ expect(added).toMatchObject({ name: "sketch", keptIn: [join("tools", "sketch")], enabled: false });
+ expect(added.own).toBeUndefined();
+ const kept = join(fixture.info.dataDir, "workspaces", iris.id, "tools", "sketch", "server.ts");
+ const stored = JSON.parse(readFileSync(join(fixture.info.dataDir, "config.json"), "utf8")).mcpServers.sketch;
+ expect(stored).toMatchObject({ args: ["--experimental-strip-types", "--no-warnings", kept] });
+ expect(stored.bot).toBeUndefined();
+ writeFileSync(gate, "");
+ await first.settled();
+ await api("PATCH", "/api/mcp/servers/sketch", { enabled: true });
+
+ // The person adds one that can't start anywhere.
+ await api("POST", "/api/mcp/servers", { name: "broken", command: process.execPath, args: ["-e", "process.exit(1)"] }, 201);
+ await api("PATCH", "/api/mcp/servers/broken", { enabled: true });
+
+ let listed: any[] = [];
+ await expect.poll(async () => {
+ listed = (await api("GET", "/api/mcp/servers")).servers;
+ return listed.find((server) => server.name === "broken")?.offFor?.length ?? 0;
+ }, { timeout: 20_000 }).toBe(3);
+ expect(listed.find((server) => server.name === "sketch")).toMatchObject({ enabled: true });
+ expect(listed.find((server) => server.name === "sketch").offFor).toBeUndefined();
+
+ const pauls = (await turnOf(paul)).mounts;
+ expect(pauls.agents).toBeDefined();
+ expect(JSON.stringify(pauls.sketch), "every bot reaches Iris's folder here").toContain(JSON.stringify(kept).slice(1, -1));
+ expect(pauls.broken, "a server that doesn't start for Paul").toBeUndefined();
+ const iriss = (await turnOf(iris)).mounts;
+ expect(JSON.stringify(iriss.sketch), "Iris's turn starts it from its own folder").toContain(JSON.stringify(kept).slice(1, -1));
+ expect(iriss.broken).toBeUndefined();
+
+ const notices = (await api("GET", "/api/notifications")).notifications.filter((entry: any) => entry.kind === "notice");
+ expect(notices.map((entry: any) => entry.body)).toEqual(["The Broken tool doesn't start, so it's off for now. It comes back on its own once it starts."]);
+ } finally {
+ await fixture.close();
+ rmSync(scratch, { recursive: true, force: true });
+ }
+}, 90_000);
diff --git a/server/mcp-probe.ts b/server/mcp-probe.ts
index 25467eb8e8..b1d8cb20bd 100644
--- a/server/mcp-probe.ts
+++ b/server/mcp-probe.ts
@@ -31,6 +31,8 @@ const UNAUTHORIZED = /unauthori[sz]ed|forbidden|not authenticated|authentication
export interface McpProbeOptions {
extension?: boolean;
observe?(info: { tools: unknown[]; uiExtension: "ok" | "refused" | "unknown" }): void;
+ /** Start a command server as this bot's AI would: in its box where turns are boxed, from its own folder. */
+ asBot?: { id: string; cwd: string };
}
const MAX_STDOUT_BYTES = MAX_REMOTE_MCP_BYTES;
@@ -157,9 +159,10 @@ function probeStdioMcpServer(
let child: ReturnType<typeof spawnCli>;
try {
child = spawnCli(server.command, server.args, {
- cwd: process.cwd(),
+ cwd: options.asBot?.cwd ?? process.cwd(),
env: probeEnvironment(server),
stdio: ["pipe", "pipe", "pipe"],
+ ...(options.asBot ? { box: { botId: options.asBot.id, allowEnv: Object.keys(server.env) } } : {}),
});
} catch {
resolve({ ok: false, error: publicProbeError("spawn") });
diff --git a/server/mcp-registry.ts b/server/mcp-registry.ts
index 3d2962b409..97627fea9f 100644
--- a/server/mcp-registry.ts
+++ b/server/mcp-registry.ts
@@ -20,6 +20,9 @@ export interface StoredStdioMcpServer extends StdioMcpSpec {
/** Characters of one tool result allowed into context; 0 = never trim, absent = OMB_MCP_RESULT_BUDGET, else 8,000. */
resultBudget?: number;
runsOn?: McpRunsOn;
+ /** The id of the bot whose own server this is: its program or files are in that bot's folder, so it starts only for
+ * that bot. Absent: every bot's. */
+ bot?: string;
/** "Show its apps in chat": stored only as `false`; on by default. */
apps?: false;
}
@@ -49,6 +52,7 @@ export interface StdioMcpServerListing {
resultBudget?: number;
runsOn?: McpRunsOn;
apps: boolean;
+ bot?: string;
}
export interface RemoteMcpServerListing {
name: string;
@@ -67,6 +71,11 @@ export function isRemoteMcpServer(server: McpServerSpec): server is RemoteMcpSpe
return "url" in server;
}
+/** Whether `botId` may start this server: every bot may start one that is no bot's own. */
+export function mcpServerServes(server: McpServerSpec & { bot?: string }, botId: string | undefined): boolean {
+ return !server.bot || server.bot === botId;
+}
+
export const MAX_MCP_SERVERS = 20;
const MAX_ARGS = 64;
const MAX_ENV = 64;
@@ -123,6 +132,8 @@ function urlError(value: string): string | null {
return null;
}
+const BOT_ID = /^[A-Za-z0-9_-]{1,128}$/u;
+
const runsOnSchema = z.object({
environmentId: z.string().regex(/^[\w-]{1,128}$/u),
label: z.string().trim().min(1).max(120),
@@ -136,9 +147,10 @@ const stdioEntrySchema = z.object({
resultBudget: resultBudgetSchema.optional(),
runsOn: runsOnSchema.optional(),
apps: z.boolean().optional(),
+ bot: z.string().regex(BOT_ID).optional(),
}).strict();
-/** `runsOn: null` says it runs here after all; left out, an edit keeps the computer it runs on. */
+/** `runsOn: null` says it runs here after all; left out, an edit keeps the computer it runs on and the bot it is for. */
const stdioMutationSchema = stdioEntrySchema.extend({
env: z.record(z.string(), z.union([z.string().max(16_384), z.literal(true)])).optional(),
runsOn: runsOnSchema.nullable().optional(),
@@ -255,10 +267,16 @@ function parseStdio(raw: unknown, mutation: boolean, existing?: StoredMcpServer)
...(parsed.data.resultBudget !== undefined ? { resultBudget: parsed.data.resultBudget } : {}),
...runsOnFor(parsed.data.runsOn, mutation, existing),
...appsFor(parsed.data.apps, mutation, existing),
+ ...botFor(parsed.data.bot, mutation, existing),
},
};
}
+function botFor(value: string | undefined, mutation: boolean, existing?: StoredMcpServer): { bot?: string } {
+ const bot = value ?? (mutation && existing && !isRemoteMcpServer(existing) ? existing.bot : undefined);
+ return bot ? { bot } : {};
+}
+
function parseRemote(raw: unknown, mutation: boolean, existing?: StoredMcpServer): Parsed {
const parsed = (mutation ? remoteMutationSchema : remoteEntrySchema).safeParse(raw);
if (!parsed.success) {
@@ -397,6 +415,7 @@ export function listMcpServers(raw: Record<string, unknown> | undefined): McpSer
...(server.resultBudget !== undefined ? { resultBudget: server.resultBudget } : {}),
...(server.runsOn ? { runsOn: server.runsOn } : {}),
apps: server.apps !== false,
+ ...(server.bot ? { bot: server.bot } : {}),
}];
});
}
diff --git a/server/notify.ts b/server/notify.ts
index e0d6ba25bd..09c6175d17 100644
--- a/server/notify.ts
+++ b/server/notify.ts
@@ -23,6 +23,11 @@ export function buildSpendNotification(
return { kind: "spend", botId: bot.id, botName: bot.name, threadId, title: text.title, body: summarize(text.body, 200) };
}
+/** Something OpenMausBot did on its own about `bot` that the person hears once, in one plain line. */
+export function buildNoticeNotification(bot: Pick<NotifyBot, "id" | "name">, threadId: string, text: string): Notification {
+ return { kind: "notice", botId: bot.id, botName: bot.name, threadId, title: bot.name, body: summarize(text, 240) };
+}
+
export function buildNotification(
kind: NotifyKind,
bot: Omit<NotifyBot, "threadId"> & { threadId?: string },
diff --git a/server/openai-tools.e2e.test.ts b/server/openai-tools.e2e.test.ts
index 86237fd82d..0cd2d9ad22 100644
--- a/server/openai-tools.e2e.test.ts
+++ b/server/openai-tools.e2e.test.ts
@@ -125,6 +125,8 @@ it.each(["openaiCompat", "groq", "meta"] as const)("%s runs structured MCP calls
await api("POST", `/api/instances/${instanceId}/refresh-models`, {});
const mcpScript = join(fixture.info.dataDir, "fixture-mcp.mjs");
writeFileSync(mcpScript, MCP_FIXTURE);
+ // A server is started once to check it starts for the bots that use it; the starter bot uses none of these.
+ for (const starter of (await api("GET", "/api/bots")).bots) await api("PATCH", `/api/bots/${starter.id}`, { mcpServers: [] });
for (const mode of ["allow", "deny", "cancel", "text", "ordinary", "selected", "scope-empty", ...(instanceId === "openaiCompat" ? ["announced"] : []), "tools-off"]) {
scenario = mode;
const artifact = join(fixture.info.dataDir, `${mode}-artifact.txt`);
diff --git a/server/routes/mcp-servers.ts b/server/routes/mcp-servers.ts
index e46ac8f417..6db342ce97 100644
--- a/server/routes/mcp-servers.ts
+++ b/server/routes/mcp-servers.ts
@@ -29,6 +29,8 @@ export interface McpServerRouteDeps {
appCatalog?: Pick<ChatAppsMcp, "probeOptions" | "serverChanged" | "forgetServer"> & Partial<Pick<ChatAppsMcp, "hasApps">>;
/** A Team Cloud: each member's own key and sign-in for a removed server go with it. */
forgetPeople?(name: string): void;
+ /** Whether each command server starts for each bot: checked again when one is added, changed or turned on. */
+ health?: { changed(name: string): void };
}
/** A server of another computer's: its program, files or address are there, so it is never started or signed in to here. */
@@ -51,7 +53,7 @@ export function createMcpServerRoutes(deps: McpServerRouteDeps): RouteHandler {
};
const {
cfg, sessions, mcpOAuth, cloudHome: CLOUD_HOME, fallbackPublicUrl: FALLBACK_PUBLIC_URL, mcpConfigBusy,
- mcpServerResponse, mcpPolicyRefusal, persistMcpServers, savedCustomDomain, appCatalog, forgetPeople,
+ mcpServerResponse, mcpPolicyRefusal, persistMcpServers, savedCustomDomain, appCatalog, forgetPeople, health,
} = deps;
const MAX_CONCURRENT_MCP_PROBES = 2;
const personalHeaderRefusal = (name: string, server: StoredMcpServer) =>
@@ -183,6 +185,7 @@ export function createMcpServerRoutes(deps: McpServerRouteDeps): RouteHandler {
if (refusal) return json(res, 403, { error: refusal, code: "managed_policy" });
persistMcpServers({ ...current, [name]: parsed.server });
appCatalog?.serverChanged(name);
+ health?.changed(name);
return json(res, 201, withServerDetails(mcpServerResponse()));
} finally {
mcpConfigBusy.set(false);
@@ -257,6 +260,7 @@ export function createMcpServerRoutes(deps: McpServerRouteDeps): RouteHandler {
const { apps: _apps, ...rest } = existing.server;
persistMcpServers({ ...current, [name]: key === "enabled" ? { ...existing.server, enabled: body.enabled } : { ...rest, ...(body.apps ? {} : { apps: false }) } });
if (body[key] === true) appCatalog?.serverChanged(name);
+ if (key === "enabled") health?.changed(name);
return json(res, 200, withServerDetails(mcpServerResponse()));
}
@@ -269,6 +273,7 @@ export function createMcpServerRoutes(deps: McpServerRouteDeps): RouteHandler {
persistMcpServers({ ...current, [name]: parsed.server });
appCatalog?.forgetServer(name);
appCatalog?.serverChanged(name);
+ health?.changed(name);
// A sign-in belongs to one address: a token never follows the entry elsewhere.
const before = isRemoteMcpServer(existing.server) ? existing.server.url : null;
const after = isRemoteMcpServer(parsed.server) ? parsed.server.url : null;
diff --git a/server/system-prompt.ts b/server/system-prompt.ts
index 19111fa90a..f0fae9a00d 100644
--- a/server/system-prompt.ts
+++ b/server/system-prompt.ts
@@ -200,10 +200,11 @@ function connectorServiceLabel(slug: string): string {
.join(" ");
}
-export function customMcpPrompt(names: string[]): string {
- if (names.length === 0) return "";
+export function customMcpPrompt(names: string[], off: ReadonlyArray<{ name: string; error: string }> = []): string {
const list = names.map((name) => `"${name}"`).join(", ");
- return ` The user also added ${names.length === 1 ? "an MCP server" : "MCP servers"} for you: ${list}. Use their available tools under the engine's normal approval rules.`;
+ const mounted = names.length === 0 ? "" : ` The user also added ${names.length === 1 ? "an MCP server" : "MCP servers"} for you: ${list}. Use their available tools under the engine's normal approval rules.`;
+ const left = off.map(({ name, error }) => ` The MCP server "${name}" is off for you because it doesn't start for you (${error}); it is tried again on its own.`).join("");
+ return mounted + left;
}
export const CREDENTIAL_PROMPT =
" If a supported API key is missing for the service actually needed, use request_credential to create a secure credential request; a 1Password service account token, for signing in with logins from a 1Password vault, is one too (credential_id onePasswordToken). Before requesting a computer-provider key, inspect the configured targets with select_computer; an existing self-hosted VPS does not need Boat credentials. Do not request a different provider's key merely because a task mentions cloud. For any other secret (a Stripe or npm token, a webhook signing secret), give request_credential a label, reason and delivery: ref for add_mcp_server, file for your own commands. A freshly QR-paired mobile app or the desktop app can show the secure entry card. Never claim it opened unless the request succeeded, and never ask the user to paste credentials into chat.";
diff --git a/server/team-personal-mcp-broker.e2e.test.ts b/server/team-personal-mcp-broker.e2e.test.ts
index 8a79d5a954..33fad037b6 100644
--- a/server/team-personal-mcp-broker.e2e.test.ts
+++ b/server/team-personal-mcp-broker.e2e.test.ts
@@ -73,7 +73,7 @@ describe.skipIf(process.platform === "win32")("a member's own MCP server and the
expect(BOX_BROKER_PORT).toBe(18080);
// Ada's own turn in her private chat, as the server mounts it for a boxed engine.
- const custom = await host.turnMcp({}, "ada-chat", "gen-1");
+ const custom = await host.turnMcp({ id: "scout", name: "Scout" }, "ada-chat", "gen-1");
expect((custom["mi-boda-hq"] as RemoteMcpSpec).headers).toEqual({ Authorization: ADA_KEY });
mounted = brokerRemoteMcp(custom, { botId: "scout", threadId: "ada-chat" }, broker);
});
diff --git a/shared/notification.ts b/shared/notification.ts
index ff99fe52df..095b66516a 100644
--- a/shared/notification.ts
+++ b/shared/notification.ts
@@ -25,7 +25,10 @@ export type NotifyKind =
| "spend"
/** The main agent's brief has something new that needs the person, or a
* meeting prep or reminder it posted with no AI turn. Personal installs only. */
- | "brief";
+ | "brief"
+ /** Something OpenMausBot changed on its own that the person hears about
+ * once: a tool turned off for the bots it doesn't start for. */
+ | "notice";
export interface Notification {
kind: NotifyKind;
diff --git a/shared/runtime-events.ts b/shared/runtime-events.ts
index baf32225ea..fbe3e5cd7f 100644
--- a/shared/runtime-events.ts
+++ b/shared/runtime-events.ts
@@ -43,6 +43,8 @@ export type RuntimeEvent = RuntimeEventBase &
/** the provider refused the turn's resumeCursor and this new session
* was started from the turn's recoveryText */
rebuilt?: boolean;
+ /** the turn's `custom` MCP servers the engine reported could not connect */
+ mcpFailed?: string[];
}
| { type: "session.model-variants"; model: string; variants: ModelVariantState }
| { type: "session.exited"; reason?: string }
diff --git a/src/components/McpServersPanel.tsx b/src/components/McpServersPanel.tsx
index 35a5c84e6e..203cec7feb 100644
--- a/src/components/McpServersPanel.tsx
+++ b/src/components/McpServersPanel.tsx
@@ -89,6 +89,7 @@ export function McpServersPanel({ embedded = false, whopCard = false, hideWhop =
onWhopConnection?: (connected: boolean) => void;
} = {}) {
const { state: store, dispatch } = useStore();
+ const botName = (id: string) => store.bots?.find((bot) => bot.id === id)?.name ?? id;
const policy = store.config?.managedPolicy;
const restricted = Boolean(policy && !policy.mcp.allowCustom);
const [servers, setServers] = useState<McpServerListing[] | null>(null);
@@ -556,6 +557,8 @@ export function McpServersPanel({ embedded = false, whopCard = false, hideWhop =
</div>
{server.managedBy && <div className="mt-1 text-[12px] text-ink-secondary">{t("policy.mcpBlocked", { organization: server.managedBy })}</div>}
{server.runsOn && <div data-mcp-runs-on className="mt-1 text-[12px] text-ink-secondary">{t("mcp.runsOn", { computer: server.runsOn.label })}</div>}
+ {server.bot && <div data-mcp-own-bot className="mt-1 text-[12px] text-ink-secondary">{t("mcp.ownBot", { bot: botName(server.bot) })}</div>}
+ {server.offFor?.length ? <div data-mcp-off-for className="mt-1 text-[12px] text-ink-secondary">{t("mcp.offFor", { bots: server.offFor.map(botName).join(", ") })}</div> : null}
<div className="mt-1 truncate font-mono text-[12px] text-ink-secondary">{isRemoteMcpListing(server) ? server.url : [server.command, ...server.args].join(" ")}</div>
{isRemoteMcpListing(server)
? server.headerKeys.length > 0 && <div className="mt-1 truncate text-[11px] text-ink-secondary">{t("mcp.headersSaved", { keys: server.headerKeys.join(", ") })}</div>
diff --git a/src/components/NotificationsPanel.tsx b/src/components/NotificationsPanel.tsx
index 2f3cc4f25b..dfad9b0517 100644
--- a/src/components/NotificationsPanel.tsx
+++ b/src/components/NotificationsPanel.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
-import { AlertTriangle, AtSign, Bell, CheckCircle2, CircleHelp, HandHelping, LogIn, Newspaper, Pin, RotateCcw, Wallet, X, type LucideIcon } from "lucide-react";
+import { AlertTriangle, AtSign, Bell, CheckCircle2, CircleHelp, HandHelping, Info, LogIn, Newspaper, Pin, RotateCcw, Wallet, X, type LucideIcon } from "lucide-react";
import { api, useStore, openNotificationTarget, type Action } from "@/state/store";
import { cn } from "@/lib/cn";
import { t } from "@/lib/i18n";
@@ -23,6 +23,7 @@ const KIND_LOOK: Record<NotifyKind, { Icon: LucideIcon; className: string; statu
"routine-deferred": { Icon: RotateCcw, className: "text-accent", status: "notifications.status.deferred" },
spend: { Icon: Wallet, className: "text-accent", status: "notifications.status.spend" },
brief: { Icon: Newspaper, className: "text-accent", status: "notifications.status.brief" },
+ notice: { Icon: Info, className: "text-accent", status: "notifications.status.notice" },
};
interface TitledThread { threadId: string; title: string }
diff --git a/src/components/bot-settings/AccessSection.tsx b/src/components/bot-settings/AccessSection.tsx
index 82127973c5..36f181c68b 100644
--- a/src/components/bot-settings/AccessSection.tsx
+++ b/src/components/bot-settings/AccessSection.tsx
@@ -7,7 +7,7 @@ import { useBotEditor } from "./BotEditorContext";
import { cn } from "@/lib/cn";
import { t } from "@/lib/i18n";
import type { LocaleKey } from "@/locales";
-import { mcpServersForBot, useMcpServers } from "@/lib/mcp-servers";
+import { mcpServersForBot, mcpServersOfBot, useMcpServers } from "@/lib/mcp-servers";
import { placeFacts, placeViewFor, usePlaceSeat } from "@/lib/place-view";
import { shortPath } from "@/lib/short-path";
import { useDesktopCapabilities } from "../DesktopCapabilities";
@@ -124,8 +124,9 @@ export function WorkingFolder({ bot }: { bot: Bot }) {
*/
export function McpServersCard({ bot, patch }: { bot: Bot; patch: (patch: { mcpServers: string[] | null }) => void }) {
const { dispatch } = useStore();
- const { servers, error, refresh } = useMcpServers();
- const mounted = new Set((servers ? mcpServersForBot(servers, bot.mcpServers) : []).map((server) => server.name));
+ const { servers: all, error, refresh } = useMcpServers();
+ const servers = all ? mcpServersOfBot(all, bot.id) : null;
+ const mounted = new Set((servers ? mcpServersForBot(servers, bot.mcpServers, bot.id) : []).map((server) => server.name));
const usesAll = bot.mcpServers == null;
const toggle = (name: string) => {
@@ -166,6 +167,7 @@ export function McpServersCard({ bot, patch }: { bot: Bot; patch: (patch: { mcpS
<div className="min-w-0 flex-1">
<div className="truncate font-mono text-[13px] text-ink">{server.name}</div>
{!server.enabled && <div className="text-[12px] text-ink-secondary">{t("botAccess.mcpDisabled")}</div>}
+ {server.enabled && server.offFor?.includes(bot.id) && <div className="text-[12px] text-ink-secondary">{t("mcp.offFor", { bots: bot.name })}</div>}
</div>
<Switch
checked={mounted.has(server.name)}
diff --git a/src/components/mcp-draft.ts b/src/components/mcp-draft.ts
index dcb188192a..7c49ea0447 100644
--- a/src/components/mcp-draft.ts
+++ b/src/components/mcp-draft.ts
@@ -25,7 +25,13 @@ export interface McpOAuthClientListing {
clientSecretConfigured: boolean;
redirectUri: string;
}
-export type McpServerListing = (StdioMcpListing | RemoteMcpListing) & { scope?: "team" | "person"; managedBy?: string; runsOn?: { environmentId: string; label: string }; apps?: boolean };
+export type McpServerListing = (StdioMcpListing | RemoteMcpListing) & {
+ scope?: "team" | "person"; managedBy?: string; runsOn?: { environmentId: string; label: string }; apps?: boolean;
+ /** The bot whose own server this is. */
+ bot?: string;
+ /** The bots it is off for, because it doesn't start for them. */
+ offFor?: string[];
+};
export function isRemoteMcpListing(server: McpServerListing): server is RemoteMcpListing {
return "url" in server;
diff --git a/src/lib/mcp-servers.test.ts b/src/lib/mcp-servers.test.ts
index bf698ebc62..7f375a55af 100644
--- a/src/lib/mcp-servers.test.ts
+++ b/src/lib/mcp-servers.test.ts
@@ -8,7 +8,7 @@ vi.mock("react", async (importOriginal) => ({
useSyncExternalStore: (_subscribe: unknown, snapshot: () => unknown) => snapshot(),
}));
-import { mcpServersForBot } from "./mcp-servers";
+import { mcpServersForBot, mcpServersOfBot } from "./mcp-servers";
describe("mcpServersForBot", () => {
const all = [
@@ -18,13 +18,20 @@ describe("mcpServersForBot", () => {
];
it("gives a bot without a list every enabled server", () => {
- expect(mcpServersForBot(all, undefined).map((s) => s.name)).toEqual(["notes", "linear"]);
- expect(mcpServersForBot(all, null).map((s) => s.name)).toEqual(["notes", "linear"]);
+ expect(mcpServersForBot(all, undefined, "b1").map((s) => s.name)).toEqual(["notes", "linear"]);
+ expect(mcpServersForBot(all, null, "b1").map((s) => s.name)).toEqual(["notes", "linear"]);
});
it("narrows to the bot's own names and never revives a disabled server", () => {
- expect(mcpServersForBot(all, ["linear", "off", "gone"]).map((s) => s.name)).toEqual(["linear"]);
- expect(mcpServersForBot(all, [])).toEqual([]);
+ expect(mcpServersForBot(all, ["linear", "off", "gone"], "b1").map((s) => s.name)).toEqual(["linear"]);
+ expect(mcpServersForBot(all, [], "b1")).toEqual([]);
+ });
+
+ it("never gives a bot another bot's own server", () => {
+ const owned = [...all, { name: "blender", enabled: true, bot: "ingo" }];
+ expect(mcpServersForBot(owned, undefined, "ingo").map((s) => s.name)).toEqual(["notes", "linear", "blender"]);
+ expect(mcpServersForBot(owned, ["blender"], "pepe")).toEqual([]);
+ expect(mcpServersOfBot(owned, "pepe").map((s) => s.name)).toEqual(["notes", "linear", "off"]);
});
});
diff --git a/src/lib/mcp-servers.ts b/src/lib/mcp-servers.ts
index c88ae8deb1..6f14171e0d 100644
--- a/src/lib/mcp-servers.ts
+++ b/src/lib/mcp-servers.ts
@@ -5,6 +5,10 @@ import { api } from "@/state/store";
export interface McpServerSummary {
name: string;
enabled: boolean;
+ /** The bot whose own server this is. */
+ bot?: string;
+ /** The bots it is off for, because it doesn't start for them. */
+ offFor?: string[];
}
let cached: { servers: McpServerSummary[] | null; error: boolean } = { servers: null, error: false };
@@ -20,7 +24,7 @@ const subscribe = (listener: () => void) => {
export function updateMcpServers(servers: McpServerSummary[]): void {
generation += 1;
inflight = null;
- cached = { servers: servers.map(({ name, enabled }) => ({ name, enabled: Boolean(enabled) })), error: false };
+ cached = { servers: servers.map(({ name, enabled, bot, offFor }) => ({ name, enabled: Boolean(enabled), ...(bot ? { bot } : {}), ...(offFor?.length ? { offFor } : {}) })), error: false };
for (const listener of listeners) listener();
}
@@ -54,8 +58,13 @@ export function useMcpServers(): { servers: McpServerSummary[] | null; error: bo
return { ...current, refresh: () => loadMcpServers(true) };
}
-export function mcpServersForBot(all: McpServerSummary[], own: string[] | null | undefined): McpServerSummary[] {
- const enabled = all.filter((server) => server.enabled);
+/** The servers a bot can be given: every bot's, and its own. */
+export function mcpServersOfBot(all: McpServerSummary[], botId: string): McpServerSummary[] {
+ return all.filter((server) => !server.bot || server.bot === botId);
+}
+
+export function mcpServersForBot(all: McpServerSummary[], own: string[] | null | undefined, botId: string): McpServerSummary[] {
+ const enabled = mcpServersOfBot(all, botId).filter((server) => server.enabled);
if (own == null) return enabled;
return enabled.filter((server) => own.includes(server.name));
}
diff --git a/src/locales/de.json b/src/locales/de.json
index 2066090e8b..280e9417ca 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -2543,5 +2543,8 @@
"cloudWelcome.files.foldersLent": "Bots auf {name} nutzen die Dateien auf diesem Computer von selbst, solange er wach und OpenMausBot geöffnet ist. Du musst nichts einrichten.",
"secretCard.ref": "OpenMausBot bewahrt es für eine einzige Nutzung durch seine eigenen Werkzeuge auf. Dein Bot sieht es nie, und es landet nie im Chat.",
"secretCard.file": "Wird in einer privaten Datei gespeichert, die die Befehle deines Bots 24 Stunden lang lesen können, und danach gelöscht. Es landet nie im Chat.",
- "secretCard.resumed": "Bot fortgesetzt"
+ "secretCard.resumed": "Bot fortgesetzt",
+ "notifications.status.notice": "Hinweis",
+ "mcp.ownBot": "Nur für {bot}: Die Dateien liegen im eigenen Ordner von {bot}.",
+ "mcp.offFor": "Aus für {bots}, weil er dort nicht startet. Er wird von selbst erneut geprüft."
}
diff --git a/src/locales/en.json b/src/locales/en.json
index 78ed55d409..69c424d217 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -1247,6 +1247,7 @@
"notifications.status.deferred": "Deferred",
"notifications.status.spend": "Spend",
"notifications.status.brief": "Brief",
+ "notifications.status.notice": "Notice",
"settings.roomTurns.title": "Group turns",
"settings.roomTurns.subtitle": "Set the usual maximum for a bot turn in a group. A conversation can choose its own.",
"settings.roomTurns.label": "Maximum turn length",
@@ -4968,6 +4969,8 @@
"mcp.auth.signedIn": "Signed in",
"mcp.auth.needsSignIn": "Needs sign-in",
"mcp.runsOn": "Runs on {computer}, so it isn't started here.",
+ "mcp.ownBot": "Only for {bot}: its files are in {bot}'s own folder.",
+ "mcp.offFor": "Off for {bots}, because it doesn't start for them. It's checked again on its own.",
"mcp.auth.signIn": "Sign in",
"mcp.auth.signOut": "Sign out",
"mcp.auth.cancel": "Cancel",
diff --git a/src/locales/es.json b/src/locales/es.json
index 20f8095b9d..b6114a0a92 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -1062,6 +1062,7 @@
"notifications.status.failed": "Falló",
"notifications.status.deferred": "Aplazado",
"notifications.status.spend": "Gasto",
+ "notifications.status.notice": "Aviso",
"settings.roomTurns.title": "Turnos en grupos",
"settings.roomTurns.subtitle": "Define el máximo habitual de un turno de bot en un grupo. Cada conversación puede elegir el suyo.",
"settings.roomTurns.label": "Duración máxima del turno",
@@ -4330,6 +4331,8 @@
"mcp.auth.signedIn": "Sesión iniciada",
"mcp.auth.needsSignIn": "Requiere iniciar sesión",
"mcp.runsOn": "Se ejecuta en {computer}, así que no se inicia aquí.",
+ "mcp.ownBot": "Solo para {bot}: sus archivos están en la carpeta propia de {bot}.",
+ "mcp.offFor": "Apagado para {bots}, porque no arranca para ellos. Se vuelve a comprobar solo.",
"mcp.auth.signIn": "Iniciar sesión",
"mcp.auth.signOut": "Cerrar sesión",
"mcp.auth.cancel": "Cancelar",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index 3d2f50a3a8..30191fa01f 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -2525,5 +2525,8 @@
"cloudWelcome.files.foldersLent": "Les bots de {name} utilisent d’eux-mêmes les fichiers de cet ordinateur tant qu’il est allumé et qu’OpenMausBot est ouvert. Rien à configurer.",
"secretCard.ref": "OpenMausBot le conserve pour un seul usage par ses propres outils. Votre bot ne le voit jamais, et il n’est jamais ajouté au chat.",
"secretCard.file": "Enregistré dans un fichier privé que les commandes de votre bot peuvent lire pendant 24 heures, puis supprimé. Il n’est jamais ajouté au chat.",
- "secretCard.resumed": "Le bot a repris"
+ "secretCard.resumed": "Le bot a repris",
+ "notifications.status.notice": "Info",
+ "mcp.ownBot": "Uniquement pour {bot} : ses fichiers sont dans le dossier de {bot}.",
+ "mcp.offFor": "Désactivé pour {bots}, car il ne démarre pas pour eux. Il est revérifié automatiquement."
}
diff --git a/src/locales/hi.json b/src/locales/hi.json
index e3e343ee0d..2aba54887b 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -2525,5 +2525,8 @@
"cloudWelcome.files.foldersLent": "{name} पर बॉट्स इस कंप्यूटर की फ़ाइलें अपने-आप इस्तेमाल करते हैं, जब तक यह जागा हुआ है और OpenMausBot खुला है। कुछ भी सेट अप नहीं करना है।",
"secretCard.ref": "OpenMausBot इसे अपने ही टूल के एक बार के इस्तेमाल के लिए रखता है। आपका बॉट इसे कभी नहीं देखता, और यह कभी चैट में नहीं जुड़ता।",
"secretCard.file": "यह एक निजी फ़ाइल में सेव होता है जिसे आपके बॉट के कमांड 24 घंटे तक पढ़ सकते हैं, फिर यह मिटा दिया जाता है। यह कभी चैट में नहीं जुड़ता।",
- "secretCard.resumed": "बॉट फिर से चल पड़ा"
+ "secretCard.resumed": "बॉट फिर से चल पड़ा",
+ "notifications.status.notice": "सूचना",
+ "mcp.ownBot": "सिर्फ़ {bot} के लिए: इसकी फ़ाइलें {bot} के अपने फ़ोल्डर में हैं।",
+ "mcp.offFor": "{bots} के लिए बंद है, क्योंकि यह उनके लिए शुरू नहीं होता। इसे अपने-आप फिर से जाँचा जाता है।"
}
diff --git a/src/locales/it.json b/src/locales/it.json
index 05283b4a06..1c89780dc2 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -1175,6 +1175,7 @@
"notifications.status.deferred": "Rimandato",
"notifications.status.spend": "Spesa",
"notifications.status.brief": "Riepilogo",
+ "notifications.status.notice": "Avviso",
"settings.roomTurns.title": "Turni di gruppo",
"settings.roomTurns.subtitle": "Imposta il massimo abituale per un turno di bot in un gruppo. Una conversazione può sceglierne uno suo.",
"settings.roomTurns.label": "Durata massima del turno",
@@ -4592,6 +4593,8 @@
"mcp.auth.signedIn": "Accesso effettuato",
"mcp.auth.needsSignIn": "Accesso necessario",
"mcp.runsOn": "Gira su {computer}, quindi qui non viene avviato.",
+ "mcp.ownBot": "Solo per {bot}: i suoi file sono nella cartella di {bot}.",
+ "mcp.offFor": "Spento per {bots}, perché per loro non si avvia. Viene ricontrollato da solo.",
"mcp.auth.signIn": "Accedi",
"mcp.auth.signOut": "Esci",
"mcp.auth.cancel": "Annulla",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 79b2894dea..84e6bb79dd 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -1209,6 +1209,7 @@
"notifications.status.deferred": "延期",
"notifications.status.spend": "支出",
"notifications.status.brief": "概要",
+ "notifications.status.notice": "お知らせ",
"settings.roomTurns.title": "グループのターン",
"settings.roomTurns.subtitle": "グループ内でのボットの 1 ターンの標準上限を設定します。会話ごとに別の上限も選べます。",
"settings.roomTurns.label": "ターンの最大長",
@@ -4782,6 +4783,8 @@
"mcp.auth.signedIn": "サインイン済み",
"mcp.auth.needsSignIn": "サインインが必要",
"mcp.runsOn": "{computer}で動くため、ここでは起動しません。",
+ "mcp.ownBot": "{bot} 専用です。ファイルが {bot} 自身のフォルダーにあります。",
+ "mcp.offFor": "{bots} では起動しないため、オフになっています。自動で再確認されます。",
"mcp.auth.signIn": "サインイン",
"mcp.auth.signOut": "サインアウト",
"mcp.auth.cancel": "キャンセル",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 6413ff60b4..434dc0cd24 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -1202,6 +1202,7 @@
"notifications.status.deferred": "Odroczone",
"notifications.status.spend": "Wydatki",
"notifications.status.brief": "Podsumowanie",
+ "notifications.status.notice": "Informacja",
"settings.roomTurns.title": "Tury w grupach",
"settings.roomTurns.subtitle": "Ustaw zwykły maksymalny czas trwania tury bota w grupie. Rozmowa może ustawić własny.",
"settings.roomTurns.label": "Maksymalna długość tury",
@@ -4673,6 +4674,8 @@
"mcp.auth.signedIn": "Zalogowano",
"mcp.auth.needsSignIn": "Wymaga logowania",
"mcp.runsOn": "Działa na komputerze {computer}, więc nie jest uruchamiany tutaj.",
+ "mcp.ownBot": "Tylko dla bota {bot}: jego pliki są w folderze bota {bot}.",
+ "mcp.offFor": "Wyłączony dla: {bots}, bo się dla nich nie uruchamia. Jest sprawdzany ponownie automatycznie.",
"mcp.auth.signIn": "Zaloguj się",
"mcp.auth.signOut": "Wyloguj się",
"mcp.auth.cancel": "Anuluj",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index eb7ce02700..19ebbeca8c 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -1120,6 +1120,7 @@
"notifications.status.failed": "Falhou",
"notifications.status.deferred": "Adiado",
"notifications.status.spend": "Gastos",
+ "notifications.status.notice": "Aviso",
"settings.roomTurns.title": "Turnos em grupos",
"settings.roomTurns.subtitle": "Defina o máximo habitual para um turno de bot em um grupo. Cada conversa pode escolher o seu.",
"settings.roomTurns.label": "Duração máxima do turno",
@@ -4560,6 +4561,8 @@
"mcp.auth.signedIn": "Conectado",
"mcp.auth.needsSignIn": "Precisa de login",
"mcp.runsOn": "Roda em {computer}, então não é iniciado aqui.",
+ "mcp.ownBot": "Só para {bot}: os arquivos estão na pasta do próprio {bot}.",
+ "mcp.offFor": "Desligado para {bots}, porque não inicia para eles. É verificado de novo sozinho.",
"mcp.auth.signIn": "Entrar",
"mcp.auth.signOut": "Sair",
"mcp.auth.cancel": "Cancelar",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 642929c469..b5c88be9d8 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -1208,6 +1208,7 @@
"notifications.status.deferred": "Отложено",
"notifications.status.spend": "Расход",
"notifications.status.brief": "Сводка",
+ "notifications.status.notice": "Уведомление",
"settings.roomTurns.title": "Ходы в группе",
"settings.roomTurns.subtitle": "Задайте обычный максимум для хода бота в группе. Беседа может задать свой.",
"settings.roomTurns.label": "Максимальная длительность хода",
@@ -4751,6 +4752,8 @@
"mcp.auth.signedIn": "Вход выполнен",
"mcp.auth.needsSignIn": "Требуется вход",
"mcp.runsOn": "Работает на {computer}, поэтому здесь не запускается.",
+ "mcp.ownBot": "Только для бота {bot}: его файлы лежат в папке бота {bot}.",
+ "mcp.offFor": "Выключен для: {bots}, потому что у них он не запускается. Он сам проверяется снова.",
"mcp.auth.signIn": "Войти",
"mcp.auth.signOut": "Выйти",
"mcp.auth.cancel": "Отмена",
diff --git a/src/locales/tr.json b/src/locales/tr.json
index 77f2c8f3d7..ab0773b2f9 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -776,6 +776,7 @@
"notifications.status.failed": "Başarısız oldu",
"notifications.status.deferred": "Ertelendi",
"notifications.status.spend": "Harcama",
+ "notifications.status.notice": "Bilgi",
"settings.roomTurns.title": "Grup turları",
"settings.roomTurns.subtitle": "Bir gruptaki bot turu için olağan maksimum süreyi belirleyin. Bir sohbet kendi süresini seçebilir.",
"settings.roomTurns.label": "Maksimum tur süresi",
@@ -4996,5 +4997,7 @@
"cloudWelcome.files.foldersLent": "{name} üzerindeki botlar, bu bilgisayar uyanık ve OpenMausBot açık olduğu sürece dosyalarını kendiliğinden kullanır. Ayarlanacak bir şey yok.",
"secretCard.ref": "OpenMausBot onu kendi araçlarının tek bir kullanımı için saklar. Botunuz onu asla görmez ve sohbete asla eklenmez.",
"secretCard.file": "Botunuzun komutlarının 24 saat boyunca okuyabileceği özel bir dosyaya kaydedilir, sonra silinir. Sohbete asla eklenmez.",
- "secretCard.resumed": "Bot devam etti"
+ "secretCard.resumed": "Bot devam etti",
+ "mcp.ownBot": "Yalnızca {bot} için: dosyaları {bot} botunun kendi klasöründe.",
+ "mcp.offFor": "{bots} için kapalı, çünkü onlarda başlamıyor. Kendiliğinden yeniden denetlenir."
}
diff --git a/src/locales/uk.json b/src/locales/uk.json
index b8c9cd940d..4499f59b3a 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -2970,5 +2970,8 @@
"cloudWelcome.files.foldersLent": "Боти в {name} самі користуються файлами на цьому комп’ютері, поки він не спить і OpenMausBot відкритий. Нічого налаштовувати не треба.",
"secretCard.ref": "OpenMausBot зберігає його для одного використання власними інструментами. Ваш бот ніколи його не бачить, і воно ніколи не потрапляє в чат.",
"secretCard.file": "Зберігається в приватному файлі, який команди вашого бота можуть читати 24 години, а потім видаляється. Воно ніколи не потрапляє в чат.",
- "secretCard.resumed": "Бот продовжив роботу"
+ "secretCard.resumed": "Бот продовжив роботу",
+ "notifications.status.notice": "Повідомлення",
+ "mcp.ownBot": "Лише для бота {bot}: його файли лежать у папці бота {bot}.",
+ "mcp.offFor": "Вимкнено для: {bots}, бо в них він не запускається. Його знову перевіряють автоматично."
}
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 077a9eef43..f1cfa84fe1 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -776,6 +776,7 @@
"notifications.status.failed": "Thất bại",
"notifications.status.deferred": "Đã hoãn",
"notifications.status.spend": "Chi tiêu",
+ "notifications.status.notice": "Thông báo",
"settings.roomTurns.title": "Lượt trong group",
"settings.roomTurns.subtitle": "Đặt mức tối đa thông thường cho một lượt của bot trong group. Mỗi cuộc trò chuyện có thể chọn giới hạn riêng.",
"settings.roomTurns.label": "Thời lượng lượt tối đa",
@@ -4996,5 +4997,7 @@
"cloudWelcome.files.foldersLent": "Bot trên {name} tự dùng các tệp trên máy tính này khi máy đang thức và OpenMausBot đang mở. Không cần thiết lập gì.",
"secretCard.ref": "OpenMausBot giữ nó cho một lần dùng bởi chính công cụ của mình. Bot của bạn không bao giờ thấy nó, và nó không bao giờ được thêm vào cuộc trò chuyện.",
"secretCard.file": "Được lưu vào một tệp riêng tư mà các lệnh của bot có thể đọc trong 24 giờ, sau đó bị xóa. Nó không bao giờ được thêm vào cuộc trò chuyện.",
- "secretCard.resumed": "Bot đã tiếp tục"
+ "secretCard.resumed": "Bot đã tiếp tục",
+ "mcp.ownBot": "Chỉ dành cho {bot}: các tệp của nó nằm trong thư mục riêng của {bot}.",
+ "mcp.offFor": "Đã tắt cho {bots} vì nó không khởi động được với họ. Nó sẽ tự được kiểm tra lại."
}
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index 098e4193ca..3bd5dc25b0 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -4380,5 +4380,8 @@
"cloudWelcome.files.foldersLent": "只要這台電腦處於喚醒狀態且 OpenMausBot 已開啟,{name} 上的機器人就會自動使用這台電腦上的檔案,無需任何設定。",
"secretCard.ref": "OpenMausBot 會保管它,只供自己的工具使用一次。你的機器人永遠看不到它,它也不會出現在聊天中。",
"secretCard.file": "儲存在一個私密檔案中,你的機器人的指令可在 24 小時內讀取,之後刪除。它不會出現在聊天中。",
- "secretCard.resumed": "機器人已繼續"
+ "secretCard.resumed": "機器人已繼續",
+ "notifications.status.notice": "通知",
+ "mcp.ownBot": "僅限 {bot}:它的檔案在 {bot} 自己的資料夾中。",
+ "mcp.offFor": "已為 {bots} 關閉,因為它在他們那裡無法啟動。會自動再檢查。"
}
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 475cec19cd..bc5bb0a313 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -3368,5 +3368,8 @@
"cloudWelcome.files.foldersLent": "只要这台电脑处于唤醒状态且 OpenMausBot 已打开,{name} 上的机器人就会自动使用这台电脑上的文件,无需任何设置。",
"secretCard.ref": "OpenMausBot 会保管它,只供自己的工具使用一次。你的机器人永远看不到它,它也不会出现在聊天中。",
"secretCard.file": "保存在一个私密文件中,你的机器人的命令可在 24 小时内读取,之后删除。它不会出现在聊天中。",
- "secretCard.resumed": "机器人已继续"
+ "secretCard.resumed": "机器人已继续",
+ "notifications.status.notice": "通知",
+ "mcp.ownBot": "仅限 {bot}:它的文件在 {bot} 自己的文件夹中。",
+ "mcp.offFor": "已为 {bots} 关闭,因为它在他们那里无法启动。会自动再次检查。"
}