MCP OAuth fails with providers requiring HTTPS redirect URIs
Status Open
Reported on v2.1.63
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 9 comments · opened Mar 1, 2026
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?
When configuring an MCP server that uses OAuth with providers requiring HTTPS redirect URIs (like Slack, Microsoft Azure AD, etc.), Claude Code attempts to use http://localhost:PORT/callback as the redirect URI. This causes OAuth authentication to fail with an error:
redirect_uri did not match any configured URIs. Passed URI: http://localhost:3118/callback
The redirectUri field in the MCP server configuration appears to be ignored, and Claude Code always uses HTTP instead of HTTPS for the localhost callback.
What Should Happen?
Claude Code should either:
- Support HTTPS redirect URIs for localhost callbacks (
https://localhost:PORT/callback) - Honor the
redirectUrifield when explicitly configured in the MCP server settings - Provide a documented method for using OAuth providers that enforce HTTPS-only redirect URIs
This would allow users to connect to MCP servers that use OAuth providers with HTTPS requirements.
Error Messages/Logs
When trying to set up a slack mcp for your custom slack app you get this error in your browser
redirect_uri did not match any configured URIs. Passed URI: http://localhost:3118/callback
example slack app mcp config
{
"type": "http",
"url": "https://mcp.slack.com/mcp",
"oauth": {
"clientId": "your-client-id",
"callbackPort": 3118
}
}
Steps to Reproduce
- Create an OAuth application with a provider that requires HTTPS redirect URIs (e.g., Slack)
- Configure the MCP server in Claude Code with OAuth settings:
{
"type": "http",
"url": "https://mcp.example.com/mcp",
"oauth": {
"clientId": "your-client-id",
"callbackPort": 3118
}
}
- Attempt to connect to the MCP server using
/mcpcommand - Observe the redirect_uri mismatch error
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.63 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
11 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Issue was MCP OAuth always used http://localhost:<port>/callback as redirect uri.
So providers that require HTTPS redirect uri failed with redirect_uri mismatch.
Fix was simple.
I added support for oauth.redirectUri and used it in the OAuth flow.
I also made the callback listener use the same configured uri port.
Patch in my fork
https://github.com/yash27-lab/claude-code/tree/codex/mcp-oauth-redirect-uri-hotfix
Finding: OAuth failure state is cached in macOS Keychain, preventing retries (+ workaround)
If the initial OAuth browser prompt is dismissed or fails, Claude Code caches an empty token in the macOS Keychain under
Claude Code-credentials. On subsequent session starts, it sees this entry and skips the OAuth flow entirely — the browser never opens again, even after uninstalling/reinstalling the plugin or clearing~/.claude/mcp-needs-auth-cache.json.The cached entry looks like:
Workaround that resolved it for me:
```bash
# View current state
security find-generic-password -s "Claude Code-credentials" -w
# Write back without the slack entry (or empty JSON)
security add-generic-password -U -s "Claude Code-credentials" -a "$(whoami)" -w "{}"
```
~/.claude/mcp-needs-auth-cache.json→{}claude plugin uninstall slack && claude plugin install slackSuggestion for the devs: Claude Code should not cache an empty
accessTokenas a successful auth result. If the token is empty, it should retry the OAuth flow on next session start rather than silently skipping it.Environment: Claude Code 2.1.72, macOS Darwin 25.3.0
This issue is actively blocking one of my production engineering workflows.
Environment:
redirect_uri did not match any configured URIs. Passed URI: http://localhost:3118/callbackTimeline:
Additional data point:
A colleague (@derekrcohen) on a separate account is experiencing the identical redirect_uri mismatch error on a different integration — the Claude API console, not Slack. This suggests the issue is not workspace-specific or Slack-specific, but a broader OAuth callback problem in Claude Code.
Impact:
Claude Code's Slack MCP connection is a critical part of our agentic product engineering workflows. This is blocking multiple engineers.
The original issue reporter noted "this never worked," but it was working for us until this weekend, which suggests an OAuth provider (Slack or others) recently began enforcing HTTPS-only redirect URIs, triggering this pre-existing limitation.
Request:
Can the Claude Code team prioritize support for HTTPS localhost redirect URIs or provide a workaround? This is urgent for our team.
I tried a patch for this in my fork.
What I changed
I added support for oauth.redirectUri
I changed the OAuth flow to use that value instead of always forcing http://localhost:<port>/callback
I added a --redirect-uri option to claude mcp add
I also made claude mcp get show the configured redirect uri
What I tested
I built a patched package from the latest published CLI
I installed it locally
I ran claude mcp add with --redirect-uri https://localhost:3118/callback
I confirmed that value is saved in config and shown by claude mcp get
What I have not confirmed yet
I have not completed a full real provider OAuth flow with real credentials yet
So I am not claiming this fully resolves the issue
I am only saying this seems to address the hardcoded redirect uri path
https://github.com/yash27-lab/claude-code/tree/codex/mcp-oauth-redirect-uri-hotfix
If someone from the team can check whether this approach makes sense that would help
I'm experiencing the same issue. Claude Code uses
http://localhost:3118/callbackas the redirect URI, but Slack rejects it with "redirect_uri did not match any configured URIs." Running on Windows 11, Claude Code v2.1.81.Temporary workaround: Using Claude Desktop (Cowork) as a Slack bridge
While waiting for the HTTPS redirect URI fix, I've established a workable interim approach using Claude Desktop's Cowork mode, which still has a functioning Slack MCP connector.
How it works:
Benefits:
Limitations:
This is not a substitute for fixing the underlying OAuth issue, but it's kept our agentic workflows running while we wait. Sharing in case it helps others who are blocked.
Update: Fully working again in both CLI and VS Code (v2.1.81)
As of today (March 23), Slack MCP is working in both the CLI (Terminal) and VS Code. The
redirect_urimismatch error I reported earlier is no longer occurring.One UI quirk: the VS Code MCP servers panel still shows "Incompatible auth server: does not support dynamic client registration" and "Needs Auth" for Slack — but the tools actually work fine. The panel appears to attempt its own direct OAuth check (which fails at DCR), while the actual tool execution goes through Anthropic's MCP proxy and succeeds. Filed this UI issue separately at #3273.
Update: Got Slack MCP working on Windows 11, Claude Code v2.1.81.
The
http://localhost:3118/callbackredirect URI works fine when using the correct setup method. The primary blocker for Slack isn't the HTTPS redirect URI — it's the missingclientIdin the setup command that most people are following.What fails:
claude mcp add --transport http slack https://mcp.slack.com/mcp— this omits theclientId, causing Claude Code to attempt dynamic client registration, which Slack rejects.What works:
claude plugin install slack— bundles the correct OAuth config including the pre-registeredclientIdandcallbackPort.Documented the docs/registry discrepancy in a separate issue: #38229
Related: #38102, #3273
Still reproducible. The
redirectUriconfig field continues to be ignored — the core redirect URI mechanism needs to be fixed at source for providers that genuinely require HTTPS (Linear, GitHub apps, etc.). Theclaude plugin installpath works as a workaround for Slack specifically, but that's not available for custom MCP servers. @yash27-lab's fork addsoauth.redirectUrisupport — would be great to see that merged upstream.Four more MCP providers hitting the same
redirectUriignored bug since last check:The
oauth.redirectUriconfig field being silently ignored continues to affect every non-Slack provider. @yash27-lab's fork addingoauth.redirectUrisupport remains the clearest fix path.