cloudflare / cloudflare/ai

remote-mcp-server: OAuth flow incorrectly redirects to localhost instead of the production URL

Open
#166 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
345
Avg merge
13h 31m
Merged PRs (30d)
1

Description

## 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
```ts
// 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.