Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(mcp): still keep a personal key private when scopes are typed without a client ID
AdityaUmale77c60ec6ef03
diff --git a/src/components/McpServersPanel.add.test.ts b/src/components/McpServersPanel.add.test.tsindex 6121e327cb..9bac06572d 100644--- a/src/components/McpServersPanel.add.test.ts+++ b/src/components/McpServersPanel.add.test.ts@@ -403,6 +403,25 @@ describe("Adding an MCP server on a Team Cloud", () => {expect(fixture.personalKeys.mail).toBe("Bearer kept-key-12345");});+ it("keeps a replacement personal key private when scopes are typed without a client ID", async () => {+ fixture.servers = [{ name: "mail", type: "http", url: "https://mail.example.com/mcp", headerKeys: ["Authorization"], enabled: true }];+ fixture.sharedHeaders.mail = { Authorization: "" };+ fixture.personalMcp = ["mail"];+ await act(async () => host.querySelector<HTMLButtonElement>("[aria-label='Refresh MCP servers']")!.click());+ await settle();+ await act(async () => host.querySelector<HTMLButtonElement>("[aria-label='Edit mail']")!.click());+ await type("input[aria-label='Authorization']", "Bearer replacement-key-67890");+ await type("input[placeholder='offline_access api://my-app/mcp.read']", "mail.read");+ await click("Save");++ expect(calls("PUT", "/api/mcp/servers/mail")[0]?.body).toMatchObject({ headers: { Authorization: "" }, oauth: { scopes: ["mail.read"] } });+ expect(calls("PUT", "/api/team/my-connections/mcp/mail/key")).toEqual([+ { url: "/api/team/my-connections/mcp/mail/key", body: { value: "Bearer replacement-key-67890", url: "https://mail.example.com/mcp" } },+ ]);+ expect(fixture.sharedHeaders.mail).toEqual({ Authorization: "" });+ expect(fixture.personalKeys.mail).toBe("Bearer replacement-key-67890");+ });+it("still writes replacement team keys to shared headers", async () => {await click("Add server");await type("textarea[aria-label='Server link or setup command']", 'claude mcp add --transport http mail https://mail.example.com/mcp -H "Authorization: Bearer $MAIL_KEY"');diff --git a/src/components/McpServersPanel.tsx b/src/components/McpServersPanel.tsxindex 2fe03c90d4..e2196d1b00 100644--- a/src/components/McpServersPanel.tsx+++ b/src/components/McpServersPanel.tsx@@ -279,7 +279,7 @@ export function McpServersPanel({ embedded = false, hostedCards, hideHosted = fatry {let body = item.body;let ownKey: string | undefined;- if (store.config?.team && existing.scope !== "team" && typeof body.url === "string" && !body.oauth) {+ if (store.config?.team && existing.scope !== "team" && typeof body.url === "string" && !(body.oauth as { clientId?: string } | undefined)?.clientId) {const connections = await api("/api/team/my-connections");if (connections.mcp.some((connection: { name: string }) => connection.name === item.name)) {const headers = (body.headers ?? {}) as Record<string, string | true>;