Support custom post-auth redirect uri

This commit is contained in:
ReallyLiri 2025-05-03 19:07:30 +03:00
parent da1330d2aa
commit c205612e17
2 changed files with 8 additions and 2 deletions

View file

@ -79,7 +79,7 @@ To bypass authentication, or to emit custom headers on all requests to your remo
```json
"command": "npx",
"args": [
"-y"
"-y",
"mcp-remote",
"https://remote.mcp.server/sse"
]

View file

@ -300,7 +300,13 @@ export function setupOAuthCallbackServerWithLongPoll(options: OAuthCallbackServe
log('Auth code received, resolving promise')
authCompletedResolve(code)
res.send('Authorization successful! You may close this window and return to the CLI.')
const postAuthRedirectUri = req.query.postAuthRedirectUri as string | undefined
if (postAuthRedirectUri) {
log(`Redirecting to post-auth redirect URI: ${postAuthRedirectUri}`)
res.redirect(postAuthRedirectUri);
} else {
res.send('Authorization successful! You may close this window and return to the CLI.')
}
// Notify main flow that auth code is available
options.events.emit('auth-code-received', code)