anthropics / anthropics/claude-ai-mcp

Custom connector marked "connected" but Claude makes zero HTTP requests after first OAuth attempt fails

Offen
#406 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
auth bug server-developer-report
Vorherrschende Sprache
Keine Sprachdaten
Sterne
471
Forks
76
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### MCP server URL

https://{api-gateway-id}.execute-api.eu-west-2.amazonaws.com/prod/mcp

### Where does the issue occur?

When pressing the Connect button

### Transport used

streamable-http

### Client registration type

Dynamic Client Registration (DCR)

### SSE only: Does your server return the expected status code for POST requests?

Not applicable (my server does not use SSE)

### When did you last reproduce this?

2026-06-05 21:00 BST

### Browser and OS

Chrome 148 on macOS

### Describe the issue

OAuth flow triggers correctly on the very first connector add — Microsoft login popup appears, user authenticates, auth_callback received. After the flow completes (even if token exchange fails), Claude permanently stops making any HTTP requests to the MCP server. Connector shows as "connected" in Settings but zero requests reach the server on all subsequent attempts. No error shown. Deleting and re-adding the connector does not help — zero server traffic on every subsequent add.

### Issue details

```shell
### Phase 1 — OAuth triggered correctly (first add only)

Server-side log sequence when Claude first added the connector with OAuth Client ID set:

15:54:06 GET /.well-known/oauth-authorization-server → 200
15:54:50 POST /mcp (no auth, user-agent: Claude-User) → 401
15:55:24 POST /mcp (no auth) → 401
15:55:50 POST /mcp (no auth, user-agent: python-httpx/0.28.1) → 401
15:55:50 GET /.well-known/oauth-protected-resource/prod/mcp → proxied (400 from upstream)
15:55:50 GET /.well-known/oauth-protected-resource → 200
15:55:51 GET /.well-known/oauth-authorization-server → 200
15:55:51 GET /oauth/authorize (browser, referer: claude.ai) → 302 → Entra login
15:55:55 POST /oauth/token (python-httpx/0.28.1) → 400 (server-side bug, since fixed)

In-chat UI showed "Authentication required to use this tool [Connect]" button. User clicked Connect → Microsoft login popup appeared → user authenticated → auth_callback received → token exchange attempted → failed due to server-side bug (since fixed).

### Phase 2 — OAuth never triggers again (all subsequent attempts)

After fixing all token exchange bugs, every subsequent attempt produced zero server-side log entries. Claude made no HTTP requests whatsoever to the MCP server.

Client-side: connector shows "connected" in Settings. In-chat tool search returns no tools. No "Authentication required" prompt appears. No error shown to the user.

This persisted across multiple delete-and-re-add cycles, fresh browser tabs, incognito windows, multiple connector name variants, and different shim implementations.

Token exchange detail (from the one working attempt)

Claude's token POST body arrived base64-encoded (AWS API Gateway behaviour). After decoding, the params were:

grant_type=authorization_code, code={auth-code}, client_id={entra-client-id}, code_verifier={code-verifier}, redirect_uri=https://claude.ai/api/mcp/auth_callback, resource=https://{api-gateway-id}.execute-api.eu-west-2.amazonaws.com/

Three issues in the token request that were fixed server-side:

1. Body was base64-encoded by AWS API Gateway — needed base64.b64decode(body) before parse_qsl
2. Claude sends a resource parameter — Entra v2 rejects this with AADSTS9010010 — needed to strip it
3. grant_type was being overwritten in an earlier server version — fixed by preserving all original params

After all three fixes the token exchange would have succeeded, but Claude had already stopped making requests before we could verify.

### Domain allowlist finding

The same OAuth shim was deployed to three URLs. Only execute-api.eu-west-2.amazonaws.com received any traffic from Claude. lambda-url.eu-west-2.on.aws and workers.dev (Cloudflare) received zero requests. The no-auth AgentCore Gateway on bedrock-agentcore.eu-west-2.amazonaws.com works correctly and consistently. This suggests Anthropic's cloud has a domain allowlist.

### Related issues

#217 — Three POST /mcp → 401 → silence, discovery never triggered. Our issue is the inverse: discovery triggers once then permanently stops.
#219 — Case-sensitive WWW-Authenticate header lookup broken on HTTP/2. Likely a contributing factor since execute-api uses HTTP/2 and AWS remaps the header entirely to x-amzn-remapped-www-authenticate.
#271 — Token exchange never happens after auth callback.
#335 — OAuth completes, /token=200, then zero authenticated MCP requests.
```

### Expected behavior

After a failed or expired OAuth flow, Claude should re-attempt OAuth discovery on the next connector use and show an in-chat "Authentication required — Connect" prompt. It should not silently mark a connector as connected when no valid token has been obtained, and should not permanently stop making HTTP requests to a server after a single failed auth attempt.

### Logs from your server

```shell
2026-06-05T15:54:06 START RequestId: 12e43a38
2026-06-05T15:54:06 PATH: /.well-known/oauth-authorization-server METHOD: GET
2026-06-05T15:54:06 ROUTE_PATH: /.well-known/oauth-authorization-server
2026-06-05T15:54:06 END RequestId: 12e43a382026-06-05T15:54:50 START RequestId: e72fd7e9
2026-06-05T15:54:50 PATH: /mcp METHOD: POST
2026-06-05T15:54:50 Proxying to Gateway
2026-06-05T15:54:50 Gateway error: 401 - {"jsonrpc":"2.0","id":0,"error":{"code":-32001,"message":"Missing Bearer token"}}
2026-06-05T15:54:50 END RequestId: e72fd7e92026-06-05T15:55:24 START RequestId: 088501f7
2026-06-05T15:55:24 PATH: /mcp METHOD: POST
2026-06-05T15:55:24 Proxying to Gateway
2026-06-05T15:55:24 Gateway error: 401 - {"jsonrpc":"2.0","id":0,"error":{"code":-32001,"message":"Missing Bearer token"}}
2026-06-05T15:55:24 END RequestId: 088501f72026-06-05T15:55:50 START RequestId: b38993ec
2026-06-05T15:55:50 PATH: /mcp METHOD: POST (user-agent: python-httpx/0.28.1)
2026-06-05T15:55:50 Proxying to Gateway
2026-06-05T15:55:50 Gateway error: 401 - {"jsonrpc":"2.0","id":0,"error":{"code":-32001,"message":"Missing Bearer token"}}
2026-06-05T15:55:50 END RequestId: b38993ec2026-06-05T15:55:50 START RequestId: 6c6aa98e
2026-06-05T15:55:50 PATH: /.well-known/oauth-protected-resource/prod/mcp METHOD: GET
2026-06-05T15:55:50 ROUTE_PATH: /.well-known/oauth-protected-resource/prod/mcp
2026-06-05T15:55:50 END RequestId: 6c6aa98e2026-06-05T15:55:50 START RequestId: c8395ef4
2026-06-05T15:55:50 PATH: /.well-known/oauth-protected-resource METHOD: GET
2026-06-05T15:55:50 ROUTE_PATH: /.well-known/oauth-protected-resource
2026-06-05T15:55:50 END RequestId: c8395ef42026-06-05T15:55:51 START RequestId: 648f45ef
2026-06-05T15:55:51 PATH: /.well-known/oauth-authorization-server METHOD: GET
2026-06-05T15:55:51 ROUTE_PATH: /.well-known/oauth-authorization-server
2026-06-05T15:55:51 END RequestId: 648f45ef2026-06-05T15:55:51 START RequestId: 804fb686
2026-06-05T15:55:51 PATH: /oauth/authorize METHOD: GET (browser, referer: https://claude.ai/)
2026-06-05T15:55:51 ROUTE_PATH: /oauth/authorize
2026-06-05T15:55:51 Redirecting to Entra: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/authorize?...
2026-06-05T15:55:51 END RequestId: 804fb6862026-06-05T15:55:55 START RequestId: 47240602
2026-06-05T15:55:55 PATH: /oauth/token METHOD: POST (python-httpx/0.28.1, content-length: 1882)
2026-06-05T15:55:55 ROUTE_PATH: /oauth/token
2026-06-05T15:55:55 Token request params: [single base64-encoded string — body not yet decoded]
2026-06-05T15:55:55 Token error: 400 - AADSTS900144: The request body must contain the following parameter: 'grant_type'
2026-06-05T15:55:55 END RequestId: 47240602
```

### Additional context

The same OAuth shim was deployed to three different URLs during debugging to isolate whether the domain was the issue:

https://{api-gateway-id}.execute-api.eu-west-2.amazonaws.com/prod/mcp — received traffic from Claude (first add only)
https://{lambda-url-id}.lambda-url.eu-west-2.on.aws/ — zero requests from Claude ever
https://{worker-name}.workers.dev/mcp (Cloudflare Worker) — zero requests from Claude ever

The no-auth version of the same backend (AgentCore Gateway directly, no OAuth) works correctly and consistently — tools load and queries return results every time. This confirms the backend is reachable and the issue is specific to the OAuth connector path.
This suggests Anthropic's infrastructure has a domain allowlist for custom MCP connectors. execute-api.eu-west-2.amazonaws.com and bedrock-agentcore.eu-west-2.amazonaws.com appear to be permitted. lambda-url.eu-west-2.on.aws and workers.dev appear to be blocked entirely.

Related issues: #217 #219 #271 #335

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.