[BUG] Claude Code HTTP MCP OAuth login drops path base
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?
Summary
Claude Code drops the base path during OAuth login for HTTP MCP servers mounted under a non-root path.
For a server configured as:
http://localhost:5210/doc-mcp
Claude Code opens:
http://localhost:5210/login?returnUrl=...
but it should open:
http://localhost:5210/doc-mcp/login?returnUrl=...
## Environment
- Claude Code:
2.1.76 - Platform:
Windows - MCP server URL:
http://localhost:5210/doc-mcp - Client ID:
netmicro.middle.mcp.doc - Callback URL:
http://localhost:17899/callback
## Reproduction
- Add an HTTP MCP server mounted under
/doc-mcp - Trigger OAuth authentication in Claude Code
- Observe the opened login URL
## Actual
Claude Code opens:
```text
http://localhost:5210/login?returnUrl=%2Fdoc-mcp%2Fauthorize%3Fresponse_type%3Dcode%26client_id%3Dnet.mcp.doc%26
redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A17899%252Fcallback%26scope%3Dmcp.read%26state%3D...%26code_challenge%3D...%2
6code_challenge_method%3DS256
Expected
Claude Code should open:
http://localhost:5210/doc-mcp/login?returnUrl=%2Fdoc-mcp%2Fauthorize%3Fresponse_type%3Dcode%26client_id%3Dnet.mc
p.doc%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A17899%252Fcallback%26scope%3Dmcp.read%26state%3D...%26code_challenge
%3D...%26code_challenge_method%3DS256
Why this looks wrong
The embedded returnUrl still correctly contains /doc-mcp/authorize?..., but the outer login URL loses /doc-mcp.
That suggests Claude Code is dropping the configured MCP base path when constructing the OAuth login redirect.
What Should Happen?
The embedded returnUrl still correctly contains /doc-mcp/authorize?..., but the outer login URL loses /doc-mcp.
Error Messages/Logs
Steps to Reproduce
1
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.76
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗