Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(mcp): keep a sign-in app's configured return address when an edit of the same app leaves it out
milind-sonia2d7138ace67
diff --git a/server/mcp-registry.test.ts b/server/mcp-registry.test.tsindex e4246a24f6..59cc7c8dd3 100644--- a/server/mcp-registry.test.ts+++ b/server/mcp-registry.test.ts@@ -317,6 +317,18 @@ describe("a url server's sign-in app", () => {expect(parseStoredMcpServer("docs", { url, oauth: { clientId: "corp-app", redirectUri: "https://user:[email protected]/mcp-oauth/callback" } })).toMatchObject({ ok: false });});+ it("keeps a configured redirect uri through an edit that leaves it out, only for the same client id", () => {+ const configured = { ...saved, oauth: { clientId: "corp-app", redirectUri: "https://maus.example/mcp-oauth/callback" } };+ expect(parseMcpServerMutation("docs", { url, oauth: { clientId: "corp-app", scopes: ["offline_access"] } }, configured)).toEqual({+ ok: true,+ server: { type: "http", url, headers: {}, oauth: { clientId: "corp-app", scopes: ["offline_access"], redirectUri: "https://maus.example/mcp-oauth/callback" }, enabled: true },+ });+ expect(parseMcpServerMutation("docs", { url, oauth: { clientId: "other-app" } }, configured)).toEqual({+ ok: true,+ server: { type: "http", url, headers: {}, oauth: { clientId: "other-app" }, enabled: true },+ });+ });+it("keeps a saved secret behind a placeholder only for the same client id", () => {expect(parseMcpServerMutation("docs", { url, oauth: { clientId: "corp-app", clientSecret: true } }, saved)).toEqual({ok: true,diff --git a/server/mcp-registry.ts b/server/mcp-registry.tsindex e6935ffc59..b8026e9e41 100644--- a/server/mcp-registry.ts+++ b/server/mcp-registry.ts@@ -293,13 +293,14 @@ function resolveOAuthClient(const redirectError = mcpConfiguredRedirectError(incoming.redirectUri);if (redirectError) return { ok: false, error: redirectError };}+ const redirectUri = incoming.redirectUri ?? (saved?.clientId === incoming.clientId ? saved.redirectUri : undefined);return {ok: true,value: {clientId: incoming.clientId,...(clientSecret ? { clientSecret } : {}),...(scopes.length ? { scopes } : {}),- ...(incoming.redirectUri ? { redirectUri: incoming.redirectUri } : {}),+ ...(redirectUri ? { redirectUri } : {}),},};}