claude-code - 💡(How to fix) Fix CRITICAL: claude.ai MCP connector OAuth completes but Bearer token never sent to server [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46140Fetched 2026-04-11 06:28:01
View on GitHub
Comments
2
Participants
2
Timeline
8
Reactions
0
Timeline (top)
labeled ×5commented ×2cross-referenced ×1

claude.ai's MCP connector completes the full OAuth 2.1 authorization_code + PKCE flow successfully (Dynamic Client Registration → authorize → token exchange), but never sends the subsequent MCP request with the Bearer token. The server issues a valid access_token, but claude.ai reports "Authorization with the MCP server failed" without ever attempting an authenticated request.

This affects ALL self-hosted remote MCP servers using OAuth. The server-side implementation is correct — verified by simulating the full flow with curl through the same tunnel.

Root Cause

claude.ai's MCP connector completes the full OAuth 2.1 authorization_code + PKCE flow successfully (Dynamic Client Registration → authorize → token exchange), but never sends the subsequent MCP request with the Bearer token. The server issues a valid access_token, but claude.ai reports "Authorization with the MCP server failed" without ever attempting an authenticated request.

This affects ALL self-hosted remote MCP servers using OAuth. The server-side implementation is correct — verified by simulating the full flow with curl through the same tunnel.

Code Example

POST /gws → 200 (initialize succeeds)
GET /.well-known/oauth-protected-resource/gws → 404
GET /.well-known/oauth-protected-resource → 404  
GET /.well-known/oauth-authorization-server → 404
POST /register → 201 (client registered successfully)
GET /authorize → 302 (code issued, redirect to claude.ai callback)
POST /token → 200 (access_token issued, PKCE verified ✓)
... silence. No authenticated MCP request ever arrives.

---

# RegisterAuthorizeToken (all succeed)
# Then:
curl -X POST https://mcp.prtrust.fund/gws \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
# Returns: 6 tools successfully

---

OAuth /token: grant_type=authorization_code code=a9693dc3… verifier=present
OAuth /token: PKCE: challenge=0Qdw7BNb6SUK… computed=0Qdw7BNb6SUK… match=true
OAuth: token issued for 0b5d725f1b047d1757c3b6bb3e299f2f (token=ab956009…)
RAW_BUFFERClick to expand / collapse

Priority: CRITICAL / URGENT

Summary

claude.ai's MCP connector completes the full OAuth 2.1 authorization_code + PKCE flow successfully (Dynamic Client Registration → authorize → token exchange), but never sends the subsequent MCP request with the Bearer token. The server issues a valid access_token, but claude.ai reports "Authorization with the MCP server failed" without ever attempting an authenticated request.

This affects ALL self-hosted remote MCP servers using OAuth. The server-side implementation is correct — verified by simulating the full flow with curl through the same tunnel.

Environment

  • Self-hosted MCP server behind Cloudflare named tunnel
  • Transport: Streamable HTTP (POST for JSON-RPC, GET for SSE)
  • Protocol version: 2025-03-26
  • Server correctly implements: RFC 9728 (Protected Resource Metadata), RFC 8414 (Authorization Server Metadata), RFC 7591 (Dynamic Client Registration), PKCE (S256)

Reproduction

Every attempt follows this exact sequence (from server logs):

POST /gws → 200 (initialize succeeds)
GET /.well-known/oauth-protected-resource/gws → 404
GET /.well-known/oauth-protected-resource → 404  
GET /.well-known/oauth-authorization-server → 404
POST /register → 201 (client registered successfully)
GET /authorize → 302 (code issued, redirect to claude.ai callback)
POST /token → 200 (access_token issued, PKCE verified ✓)
... silence. No authenticated MCP request ever arrives.

Claude.ai then displays: "Authorization with the MCP server failed"

Proof the server works

Full OAuth + authenticated MCP call via curl through the same tunnel:

# Register → Authorize → Token (all succeed)
# Then:
curl -X POST https://mcp.prtrust.fund/gws \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
# Returns: 6 tools successfully

The server is reachable, OAuth is correct, authenticated MCP calls work. claude.ai just never sends step 8.

Variations tested (all fail identically)

VersionWhat we triedResult
v1.5.19well-known 200 + OAuth enabled, resource=/sseToken issued, never used
v1.5.20Added 401 gate on POST /sse for tunnel requestsclaude.ai skipped 401, went straight to /register
v1.5.22Path-aware well-known (resource matches connector URL)Token issued, never used
v1.5.25Accept client_secret as Bearer + client_credentials grantToken issued, never used
v1.5.27404 ALL OAuth endpoints"Couldn't reach server"
v1.5.28404 well-known only, OAuth endpoints liveToken issued, never used
v1.5.29404 /register too"Couldn't reach server"
v1.5.30Fresh domain (mcp.prtrust.fund, no cached state)Token issued, never used

PKCE verification proof (from server logs)

OAuth /token: grant_type=authorization_code code=a9693dc3… verifier=present
OAuth /token: PKCE: challenge=0Qdw7BNb6SUK… computed=0Qdw7BNb6SUK… match=true
OAuth: token issued for 0b5d725f1b047d1757c3b6bb3e299f2f (token=ab956009…)

PKCE passes. Token is valid. claude.ai has the token. It never uses it.

Support references

  • ofid_5b4f176052475e66
  • ofid_24385e3ebac39bf8
  • ofid_00912162dce5872c
  • ofid_3ddc9e36fada07fa
  • ofid_42c4f5ce4ebf5530
  • ofid_0124fba879402e77
  • ofid_f8bab433728a98e9
  • ofid_0c0e836314b4995f
  • ofid_5211d10fd69c4ff0

Related issues

  • modelcontextprotocol/modelcontextprotocol#2157
  • Multiple reports on community forums of the same "Authorization failed" pattern
  • Cloudflare community thread: "Authorization with the MCP server failed" (WAF ruled out)

Impact

Cannot use any self-hosted MCP server with claude.ai web interface. Claude Code CLI works perfectly with the same server (OAuth completes and Bearer token is correctly sent). This blocks all remote MCP integrations for users who need claude.ai web access.

Expected behavior

After receiving a valid access_token from POST /token, claude.ai should retry the original MCP request with Authorization: Bearer <token> header.

Actual behavior

claude.ai receives the access_token, discards it, and reports "Authorization with the MCP server failed" without attempting any authenticated request.

extent analysis

TL;DR

The issue can be resolved by investigating and fixing the claude.ai implementation to properly use the obtained access token for subsequent MCP requests.

Guidance

  • Investigate the claude.ai code to determine why the access token is not being used for the MCP request after a successful OAuth flow.
  • Verify that the access token is correctly stored and retrieved in the claude.ai application.
  • Check for any potential issues with the claude.ai implementation that might prevent it from sending the Authorization: Bearer <token> header with the MCP request.
  • Compare the claude.ai web interface implementation with the working Claude Code CLI implementation to identify any differences in handling the access token.

Example

No code example is provided due to the lack of specific implementation details in the issue.

Notes

The issue seems to be specific to the claude.ai web interface implementation, as the Claude Code CLI works correctly with the same server. The problem might be related to how the access token is handled or stored in the claude.ai web application.

Recommendation

Apply a workaround by modifying the claude.ai implementation to correctly use the obtained access token for subsequent MCP requests. This might involve updating the code to properly store and retrieve the access token, or to include the Authorization: Bearer <token> header in the MCP request.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

After receiving a valid access_token from POST /token, claude.ai should retry the original MCP request with Authorization: Bearer <token> header.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix CRITICAL: claude.ai MCP connector OAuth completes but Bearer token never sent to server [2 comments, 2 participants]