You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MCP connect on Fly (device sign-in): sign-in drops redirect_to, user lands on dashboard instead of the consent screen #3936
Connecting an MCP client to a Fly-launched instance (device sign-in mode) never reaches the consent screen. Found in the 0.9.4 release-candidate test: a client (mcptest.io) started OAuth against https://<app>.fly.dev/api/mcp, the user completed the GitHub device sign-in, and landed on the dashboard instead of /mcp/consent (permissions and repositories). The client never gets a code, so MCP cannot be connected on any Fly instance unless the user was already signed in to the dashboard in that browser.
Cause
/authorize redirects to /mcp/consent?request=<id>; unauthenticated, mountMcpBrowser (packages/api/mcp/browser.ts, loginUrl) sends the browser to /api/auth/github?redirect_to=<origin>/mcp/consent?request=<id>.
createOAuthStartHandler (packages/api/auth.ts) validates redirect_to and then, in device mode, discards it: res.redirect(\${FRONTEND_URL}/login`)`.
createDeviceFinishLogin also deletes authSession.redirectTo, and the login page sends the user to the dashboard after a device sign-in.
Fix
In device mode, carry the validated redirect_to through: store it in the session (or pass a validated same-origin path to /login), keep it until the device sign-in finishes, and return it in the finish response (e.g. { status: 'complete', redirectTo }) instead of deleting it.
The login page then does a full-page navigation to that URL (/mcp/consent is server-rendered, not a SPA route). Only same-origin paths validated by getValidatedRedirectTo are honoured.
Preserve the pending request's 10-minute TTL: if the device sign-in takes longer, the consent page should say "Request expired, return to your app and connect again" (already exists).
Same treatment for any other server-side redirect_to users (PR previews, /mcp/apps).
Tests: device mode /api/auth/github?redirect_to=/mcp/consent?request=x keeps the target; finish returns it; login page navigates to it; off-origin targets are dropped; web OAuth mode unchanged. Live check on Fly: mcptest.io (or claude mcp add + /mcp) signs in with a device code and lands on the consent screen, then completes.
Live check on propr-rc2: with the dashboard session already present, a repeat connect from mcptest.io went straight to the consent screen and completed. So only the device sign-in leg loses redirect_to.
Activity
propr-dev commentedon Nov 30, 2026
🤖 AI processing has started for this issue using codex agent with gpt-6.2-sol model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
codexgpt-6.2-sol3936/gpt-6.2-sol-mcp-connect-on-fly-device-20261130-2317-8mc3758-epic-runtime-abstraction-sc0issue-3936-20261130-2317-gpt-6.2-sol-8mc🔍 Track Task Execution
integry commentedon Nov 30, 2026
Live check on propr-rc2: with the dashboard session already present, a repeat connect from mcptest.io went straight to the consent screen and completed. So only the device sign-in leg loses
redirect_to.chore: preserve MCP return path through GitHub device sign-in