[BUG] GitHub MCP OAuth flow fails on claude.ai/code — localhost callback unreachable
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The mcp__github__authenticate tool generates an OAuth URL with
redirect_uri=http://localhost:{port}/callback
This only works when Claude Code runs as a local CLI (which spins up
a temporary HTTP server). On claude.ai/code (web) and mobile, the
localhost callback is unreachable:
ERR_CONNECTION_REFUSED on localhost
Steps to reproduce:
- Use Claude Code on claude.ai/code (web interface)
- Call mcp__github__authenticate
- Open the generated OAuth URL
- Complete Google/GitHub authorization
- Callback redirects to localhost → connection refused
Expected: OAuth should work on all Claude Code platforms
Suggested fix: Use a hosted callback endpoint (e.g., api.anthropic.com/callback)
that can relay the auth token back to the session, or provide a manual
token paste flow as fallback.
What Should Happen?
Expected: OAuth should work on all Claude Code platforms
Suggested fix: Use a hosted callback endpoint (e.g., api.anthropic.com/callback)
that can relay the auth token back to the session, or provide a manual
token paste flow as fallback.
<img width="1166" height="684" alt="Image" src="https://github.com/user-attachments/assets/b916c50c-bb2b-40b4-bf3f-e58dee2f586b" />
<img width="947" height="668" alt="Image" src="https://github.com/user-attachments/assets/cf774d88-a759-4f44-9caa-9bff99049449" />
Error Messages/Logs
ERR_CONNECTION_REFUSED on localhost
Steps to Reproduce
Steps to reproduce:
- Use Claude Code on claude.ai/code (web interface)
- Call mcp__github__authenticate
- Open the generated OAuth URL
- Complete Google/GitHub authorization
- Callback redirects to localhost → connection refused
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude Code 2.1.96
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗