[BUG]: MCP OAuth callback unreachable when running in remote container / Codespaces — no manual token paste fallback
Describe the bug
When running Copilot CLI inside a remote container (e.g., GitHub Codespaces, Dev Containers), the MCP OAuth flow redirects to a localhost callback URL that is unreachable from the user's browser. There is no mechanism to manually paste the authorization code/callback URL back into the CLI, unlike Claude Desktop which provides a dialog for this.
Affected version
1.0.36
Steps to reproduce
- Run Copilot CLI inside a GitHub Codespace or remote dev container
- Add an HTTP MCP server that requires OAuth
- Run
/mcp→ trigger auth → browser opens and user authorises - Browser attempts to redirect to
http://127.0.0.1:<port>/?code=...&state=... - Redirect fails — localhost resolves to the user's local machine, not the container
- OAuth handshake never completes; MCP server remains unauthenticated
Expected behavior
The CLI should either: (a) detect that the callback was not received and prompt the user to paste the callback URL manually, or (b) provide a /mcp auth paste style command to accept the code out-of-band.
Workaround
Paste the callback URL to an AI agent running inside the container and have it curl the URL against the local listener. Not a user-friendly solution.
Additional context
Claude Desktop handles this via a dedicated token paste dialog. Related to #1491 (random port issue) but distinct — this is specifically about remote container environments where localhost is unreachable from the browser.
+1 this is broken when using the CLI in an SSH session
@.***
On Wed, 16 Sept 2026, 7:02 pm Peter, @.***> wrote:
petercort left a comment (github/copilot-cli#3009) https://github.com/github/copilot-cli/issues/3009#issuecomment-5697861409
+1 this is broken when using the CLI in an SSH session
— Reply to this email directly, view it on GitHub https://github.com/github/copilot-cli/issues/3009?email_source=notifications&email_token=B4FO3EG5P6YH476PTZESRYT5PKFNNA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNRZG44DMMJUGA42M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#issuecomment-5697861409, or unsubscribe https://github.com/notifications/unsubscribe-auth/B4FO3EBFPLBFFJP526VVMF35PKFNNAVCNFSNUABFKJSXA33TNF2G64TZHM2TQNJYGYYDMNRUHNEXG43VMU5TIMZTHE2DENRQGE22C5QC . Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS https://github.com/notifications/mobile/ios/B4FO3EHKMGPI45WHRPWOFXL5PKFNNA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNRZG44DMMJUGA42M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSVGM33PORSXEX3JN5ZQ and Android https://github.com/notifications/mobile/android/B4FO3ECHIXW6CM5YCFPC7UD5PKFNNA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNRZG44DMMJUGA42M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSXGM33PORSXEX3BNZSHE33JMQ. Download it today! You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thanks for the report. This is still valid: MCP OAuth relies only on a localhost callback listener and has no fallback for pasting the redirect URL or code, so it fails in Codespaces, dev containers and SSH sessions unless the port is forwarded. We've moved this to the backlog.