[BUG] Issue with OAuth based connectivity
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [X ] Other: Claude Code
- Claude CLI version: 1.0.95 (Claude Code)
- Operating System: macOS Tahoe v26.0 Beta
- Terminal: iTerm2
Bug Description
Since the last 15 hrs I am not able to get OAuth to function.
claude mcp add --transport http grepos-mcp https://xxx.ngrok.app/mcp/grepos --header ""Authorization:Bearer ..."
Claude Code Issue: Bearer Token Authentication Ignored
Summary
Claude Code ignores the --header "Authorization: Bearer ..." parameter and forces OAuth discovery instead of using the provided Bearer token for MCP server authentication.
Expected Behavior
When a Bearer token is provided via --header "Authorization: Bearer <token>", Claude Code should:
- Use the Bearer token for authentication
- Skip OAuth discovery and flows
- Connect directly to the MCP server with the token
Actual Behavior
Claude Code:
- Ignores the provided Bearer token completely
- Auto-discovers OAuth configuration from
/.well-known/oauth-protected-resource - Forces OAuth flow even when Bearer token is available
- Attempts Dynamic Client Registration (DCR) with its own client credentials
- Fails when DCR is not properly configured on the authorization server
Steps to Reproduce
- Generate a valid Bearer token for an MCP server that supports both OAuth and Bearer token auth
- Add MCP server using:
claude mcp add <server-name> <server-url> --header "Authorization: Bearer <valid-token>" - Attempt to connect to the server
- Observe that Claude Code ignores the Bearer token and attempts OAuth flow
Environment
- Claude Code CLI version: [current version]
- MCP server: Custom implementation with OAuth 2.1 + Bearer token support
- OS: macOS
Impact
This prevents Claude Code from connecting to MCP servers that:
- Provide Bearer tokens as an authentication method
- Have OAuth configured but prefer Bearer token auth for certain clients
- Have DCR not fully configured or available
Workaround
None available - Claude Code cannot connect to such servers currently.
Expected Fix
Claude Code should respect the --header parameter and use Bearer tokens when provided, only falling back to OAuth discovery when no authentication headers are specified.
Has anything changed since yesterday?
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗