ai
ai copied to clipboard
remote-mcp-server: OAuth flow incorrectly redirects to localhost instead of the production URL
Issue Description
After deploying the remote-mcp-server to Cloudflare, the OAuth flow incorrectly redirects to localhost instead of the production URL. The OAuth callback returns to http://localhost:61576/oauth/callback instead of using the deployed Cloudflare domain.
Relevant Code
// The user must be successfully logged in and have approved the scopes, so we
// can complete the authorization request
const { redirectTo } = await c.env.OAUTH_PROVIDER.completeAuthorization({
request: oauthReqInfo,
userId: email,
metadata: {
label: "Test User",
},
scope: oauthReqInfo.scope,
props: {
userEmail: email,
},
});
Expected Behavior
The OAuth callback should redirect to the deployed Cloudflare domain URL instead of localhost.