[BUG] HTTP MCP with static header auth hangs for full 30s connect timeout

Open 💬 0 comments Opened Jul 10, 2026 by alimoradian1

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?

An HTTP MCP server that authenticates via a static header (API key) and returns 200 to initialize — never issuing a 401/OAuth challenge — still gets an OAuth auth provider attached. Claude Code finds no token and the connection hangs for the entire 30s timeout, reported as "Failed to connect." The endpoint is healthy and responds in under a second.

What Should Happen?

With no token and a 200 response (no 401/WWW-Authenticate), Claude Code should send the request using the configured static headers (as curl/fetch do) not block on the OAuth path until timeout. At minimum, fail fast instead of hanging 30s.

Error Messages/Logs

MCP debug log (`~/.cache/claude-cli-nodejs/<project>/mcp-logs-<server>/*.jsonl`):

HTTP transport options: {... "hasAuthProvider":true, "timeoutMs":60000}
Starting connection with timeout of 30000ms
Testing basic HTTP connectivity to https://mapstools.googleapis.com/mcp
Parsed URL: host=mapstools.googleapis.com, port=default, protocol=https:
No token data found
Connection timeout triggered after 30006ms (limit: 30000ms)
HTTP Connection failed after 30006ms: ... connection timed out after 30000ms

Steps to Reproduce

  1. Configure an HTTP MCP server using static header auth, e.g.:
{ "type": "http", "url": "https://mapstools.googleapis.com/mcp", "headers": { "X-Goog-Api-Key": "<API_KEY>" } }
  1. claude mcp get <name> reports Status: ✘ Failed to connect.

Workaround:

Bridge over stdio via mcp-remote (carries the header itself, no OAuth provider attached):

npx -y mcp-remote@latest <url> --header "X-Goog-Api-Key: <API_KEY>" --transport http-only

Connects in ~1s and exposes all tools.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.206

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗