From 4c8685d427e12bcd40d3d6c870b33a6cfbbab7af Mon Sep 17 00:00:00 2001 From: SuYao Date: Tue, 29 Apr 2025 01:40:08 +0800 Subject: [PATCH] fix(McpOAuthClientProvider): update redirect URL (#5449) fix(McpOAuthClientProvider): update redirect URL to use 127.0.0.1 instead of localhost --- src/main/services/mcp/oauth/callback.ts | 2 +- src/main/services/mcp/oauth/provider.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/services/mcp/oauth/callback.ts b/src/main/services/mcp/oauth/callback.ts index 6884c53043..87ae6f95e3 100644 --- a/src/main/services/mcp/oauth/callback.ts +++ b/src/main/services/mcp/oauth/callback.ts @@ -21,7 +21,7 @@ export class CallBackServer { if (req.url?.startsWith(path)) { try { // Parse the URL to extract the authorization code - const url = new URL(req.url, `http://localhost:${port}`) + const url = new URL(req.url, `http://127.0.0.1:${port}`) const code = url.searchParams.get('code') if (code) { // Emit the code event diff --git a/src/main/services/mcp/oauth/provider.ts b/src/main/services/mcp/oauth/provider.ts index e56fada6af..a2a47fc15e 100644 --- a/src/main/services/mcp/oauth/provider.ts +++ b/src/main/services/mcp/oauth/provider.ts @@ -27,7 +27,7 @@ export class McpOAuthClientProvider implements OAuthClientProvider { } get redirectUrl(): string { - return `http://localhost:${this.config.callbackPort}${this.config.callbackPath}` + return `http://127.0.0.1:${this.config.callbackPort}${this.config.callbackPath}` } get clientMetadata() {