Skip to content

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

Keep custom MCP servers when the corresponding app bridge is absent

CI fixture97da560c9f31
diff --git a/server/drivers/turn-mcp.test.ts b/server/drivers/turn-mcp.test.ts
index 2b1c346dee..730b9e3d63 100644
--- a/server/drivers/turn-mcp.test.ts
+++ b/server/drivers/turn-mcp.test.ts
@@ -152,6 +152,12 @@ describe("where the connected-apps bridges mount", () => {
expect(env(servers[4]!)[TOOL_LIMIT_ENV]).toBe("0");
});
+ it("mounts custom servers when the corresponding app bridges are absent", () => {
+ const custom = { own_apps: composio, composio };
+ const servers = acpMcpServers(turn({ integrations: { custom } }));
+ expect(servers.map((server) => server.name)).toEqual(["own_apps", "composio"]);
+ });
+
it("a name collision still keeps the composio bridge over a server of the person's with the same name", () => {
const base = turn();
const servers = acpMcpServers({ ...base, integrations: { ...base.integrations!, composio,
diff --git a/server/drivers/turn-mcp.ts b/server/drivers/turn-mcp.ts
index 17fc7e7aa4..d3bcc7fdee 100644
--- a/server/drivers/turn-mcp.ts
+++ b/server/drivers/turn-mcp.ts
@@ -41,7 +41,9 @@ export function turnStdioMcpServers(turn: SendTurnInput, options: { schemaProfil
// server's tools come ahead of composio's pack, and a tool budget's remainder reaches them first. A residual name
// collision still keeps the built-in, the aggregation included.
for (const [name, server] of Object.entries(turn.integrations?.custom ?? {})) {
- if (servers.some((existing) => existing.name === name) || name === "composio" || name === OWN_APPS_SERVER) continue;
+ if (servers.some((existing) => existing.name === name)
+ || (name === "composio" && turn.integrations?.composio)
+ || (name === OWN_APPS_SERVER && turn.integrations?.composioOwn)) continue;
const apps = appMountFor(name, turn);
if (apps && !("url" in server)) observedCommands.set(name, apps);
const stdio = "url" in server ? mcpStdioServer(server, { nodeEnv: { ELECTRON_RUN_AS_NODE: "1" }, ...(apps ? { apps } : {}) })