claude-code - 💡(How to fix) Fix Persistent 502 Bad Gateway from mcp-proxy.anthropic.com — Gmail connector works in claude.ai chat but fails in Claude Code (VS Code extension) [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#48291Fetched 2026-04-16 07:03:56
View on GitHub
Comments
2
Participants
2
Timeline
9
Reactions
0
Timeline (top)
labeled ×4commented ×2cross-referenced ×1subscribed ×1

Error Message

Streamable HTTP error: Error POSTing to endpoint:

<title>mcp-proxy.anthropic.com | 502: Bad gateway</title> Error code 502 Host: mcp-proxy.anthropic.com — Error Timestamp: 2026-04-15 05:14:03 UTC Cloudflare Ray ID: 9ec876c8ed4bcffa

Additional Ray IDs from repeated failures (all 2026-04-15 UTC):

  • 9ec85754cf80120c — 04:52:34
  • 9ec8578c583e120c — 04:52:43
  • 9ec8632c9cea8ad0 — 05:00:40
  • 9ec87683ffb9cffa — 05:13:52

Earlier variant (auth scope error after fresh reconnect, before further retries reverted to 502): {"jsonrpc":"2.0","result":{"content":[{"text":"Request had insufficient authentication scopes.","type":"text"}],"isError":true}}

Fix Action

Fix / Workaround

Disconnect/reconnect Gmail connector in claude.ai Settings Revoked Anthropic permissions at myaccount.google.com/permissions, re-authed with all scopes granted VS Code restart Status page checked — no active incident Impact Blocks daily email triage tooling built on the Gmail MCP connector in Claude Code. Workaround is to run triage manually in claude.ai chat, which defeats the purpose of the local VS Code-integrated workflow.

Code Example

Streamable HTTP error: Error POSTing to endpoint:
<title>mcp-proxy.anthropic.com | 502: Bad gateway</title>
Error code 502
Host: mcp-proxy.anthropic.comError
Timestamp: 2026-04-15 05:14:03 UTC
Cloudflare Ray ID: 9ec876c8ed4bcffa

Additional Ray IDs from repeated failures (all 2026-04-15 UTC):
- 9ec85754cf80120c — 04:52:34
- 9ec8578c583e120c — 04:52:43
- 9ec8632c9cea8ad0 — 05:00:40
- 9ec87683ffb9cffa — 05:13:52

Earlier variant (auth scope error after fresh reconnect, before further retries reverted to 502):
{"jsonrpc":"2.0","result":{"content":[{"text":"Request had insufficient authentication scopes.","type":"text"}],"isError":true}}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Environment

Claude Code: VS Code extension (native) OS: Windows 11 Home 10.0.26200 Region: Perth, Australia (APAC) Organization ID: 01fbe21b-c66d-49a1-9180-84fe7f3c0dd3 Account: [email protected] Model: claude-opus-4-6 (1M context) Summary Every call to a mcp__claude_ai_Gmail__* tool returns HTTP 502 Bad Gateway from mcp-proxy.anthropic.com. Intermittent but near-constant. Persisted ~2 days so far. The same Gmail connector works correctly when used directly in claude.ai chat — the failure is isolated to the Claude Code → MCP proxy route.

Steps to reproduce

Gmail connected via claude.ai → Settings → Connectors In Claude Code, invoke any Gmail MCP tool (e.g. search_threads with query="newer_than:7d in:inbox") Observe 502 Bad Gateway from mcp-proxy.anthropic.com Expected Tool returns thread list (as it does in claude.ai chat against the same account).

Actual

Streamable HTTP error: Error POSTing to endpoint Title: mcp-proxy.anthropic.com | 502: Bad gateway Error code 502 Evidence — Cloudflare Ray IDs / timestamps (all 2026-04-15 UTC)

9ec85754cf80120c — 04:52:34 9ec8578c583e120c — 04:52:43 9ec8632c9cea8ad0 — 05:00:40 9ec87683ffb9cffa — 05:13:52 9ec876c8ed4bcffa — 05:14:03 Diagnostic notes

Intermittent, appears payload-sensitive: one newer_than:1d call with pageSize:5 succeeded; all newer_than:3d/newer_than:7d calls (with pageSize 20 and 50) failed with 502. The connector itself is healthy — works in claude.ai chat against the same Google account/scopes. Started ~13 April 2026. EmailTriage project scaffolding that used the same Gmail MCP on that date worked successfully; failures began shortly after. Already tried

Disconnect/reconnect Gmail connector in claude.ai Settings Revoked Anthropic permissions at myaccount.google.com/permissions, re-authed with all scopes granted VS Code restart Status page checked — no active incident Impact Blocks daily email triage tooling built on the Gmail MCP connector in Claude Code. Workaround is to run triage manually in claude.ai chat, which defeats the purpose of the local VS Code-integrated workflow.

What Should Happen?

Gmail MCP tools in Claude Code (VS Code extension) should return results successfully — matching the behaviour of the same claude.ai Gmail connector when used directly in a claude.ai chat. Specifically, calls to mcp__claude_ai_Gmail__search_threads, get_thread, etc. should proxy through mcp-proxy.anthropic.com and return the Gmail API response, not a 502 Bad Gateway.

Error Messages/Logs

Streamable HTTP error: Error POSTing to endpoint:
<title>mcp-proxy.anthropic.com | 502: Bad gateway</title>
Error code 502
Host: mcp-proxy.anthropic.com — Error
Timestamp: 2026-04-15 05:14:03 UTC
Cloudflare Ray ID: 9ec876c8ed4bcffa

Additional Ray IDs from repeated failures (all 2026-04-15 UTC):
- 9ec85754cf80120c — 04:52:34
- 9ec8578c583e120c — 04:52:43
- 9ec8632c9cea8ad0 — 05:00:40
- 9ec87683ffb9cffa — 05:13:52

Earlier variant (auth scope error after fresh reconnect, before further retries reverted to 502):
{"jsonrpc":"2.0","result":{"content":[{"text":"Request had insufficient authentication scopes.","type":"text"}],"isError":true}}

Steps to Reproduce

  1. Connect Gmail via claude.ai → Settings → Connectors (OAuth completes successfully, all scopes granted).
  2. Open a Claude Code session in the VS Code extension, signed into the same account ([email protected], Organization ID 01fbe21b-c66d-49a1-9180-84fe7f3c0dd3).
  3. Invoke any Gmail MCP tool, e.g. mcp__claude_ai_Gmail__search_threads with: { "query": "newer_than:7d in:inbox", "pageSize": 50 }
  4. Observe HTTP 502 Bad Gateway response from mcp-proxy.anthropic.com.
  5. For comparison, issue the equivalent request in a claude.ai web chat against the same account — it succeeds and returns threads normally.

Additional observation: the failure is intermittent and appears payload-sensitive. A single small request (newer_than:1d, pageSize:5) returned data once; every retry at larger pageSize or wider date window (3d / 7d) returned 502.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Unknown same extension/version worked on 13 April 2026 (Gmail MCP calls completed successfully that day when building an email-triage project). Failures began shortly after. Extension has not been manually downgraded or reinstalled since.

Claude Code Version

v2.1.109

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Terminal.app (macOS)

Additional Information

Key diagnostic: the same Gmail connector works correctly in claude.ai web chat with the same account and scopes. The failure is isolated to the Claude Code → mcp-proxy.anthropic.com route. This points to an issue in the proxy layer rather than the connector, OAuth grant, or Gmail API itself.

Already tried:

  • Full disconnect/reconnect of Gmail in claude.ai Settings → Connectors
  • Revoke at myaccount.google.com/permissions, fresh OAuth with all scopes ticked
  • VS Code restart
  • Anthropic status page: no active incident at time of failure

Account / region:

  • Organization ID: 01fbe21b-c66d-49a1-9180-84fe7f3c0dd3
  • Account email: [email protected]
  • Region: Perth, Australia (APAC)

extent analysis

TL;DR

The issue can be mitigated by adjusting the payload size or query parameters in the Gmail MCP tool requests to reduce the load on the mcp-proxy.anthropic.com proxy layer.

Guidance

  1. Verify payload sensitivity: Test the Gmail MCP tools with smaller payload sizes (e.g., pageSize: 5) and narrower date windows (e.g., newer_than:1d) to confirm the intermittent nature of the issue.
  2. Adjust query parameters: Experiment with modifying the query parameters, such as query and pageSize, to reduce the amount of data being requested and proxied through mcp-proxy.anthropic.com.
  3. Monitor Cloudflare Ray IDs: Continue to collect Cloudflare Ray IDs for failed requests to identify any patterns or correlations with specific proxy behaviors.
  4. Check for proxy layer updates: Investigate if there have been any recent updates or changes to the mcp-proxy.anthropic.com proxy layer that may be contributing to the issue.

Example

No code snippet is provided as the issue is related to the interaction between the Claude Code extension and the mcp-proxy.anthropic.com proxy layer, and not a specific code implementation.

Notes

The root cause of the issue is unclear, but it appears to be related to the proxy layer rather than the Gmail connector or OAuth grant. The fact that the same connector works correctly in the claude.ai web chat suggests that the issue is isolated to the Claude Code → mcp-proxy.anthropic.com route.

Recommendation

Apply a workaround by adjusting the payload size or query parameters in the Gmail MCP tool requests to reduce the load on the mcp-proxy.anthropic.com proxy layer, as this has shown to mitigate the issue in some cases.

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…

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 Persistent 502 Bad Gateway from mcp-proxy.anthropic.com — Gmail connector works in claude.ai chat but fails in Claude Code (VS Code extension) [2 comments, 2 participants]