Repository navigation
Description
Problem
mecated mcp login SERVER can fail against a working OAuth-protected MCP server when the authenticated resource handshake takes more than the hardened client's 10-second response-header timeout. The MCP SDK later surfaces only context deadline exceeded, losing the actionable net/http: timeout awaiting response headers cause.
The same 30-second machine deadline currently encloses the interactive browser/callback flow because the SDK invokes OAuth authorization during Client.Connect. A user completing browser consent should not be cancelled by the handshake deadline, while the pre-authorization exchange, authenticated retry, initialize, and initial listing must remain bounded.
Intended behavior
- Keep the initial MCP exchange bounded at 30 seconds.
- Pause that deadline only while an explicit local OAuth browser/callback interaction is pending; after successful authorization, start a fresh 30-second deadline for the SDK retry, initialize, and initial listing.
- Increase only the direct OAuth MCP resource client's response-header timeout from 10 seconds to 30 seconds. Keep its 30-second whole-request timeout and five-second dial/TLS limits; do not change the MCP broker token client.
- Emit one redacted warning for each failed OAuth transport
RoundTrip, before the SDK collapses the error. Include method, duration, safely redacted URL, and safely redacted cause; never log query values, headers, bodies, codes, tokens, or credentials. - Route the existing
mecated mcp loginstderr writer through the injected diagnostics sink without adding a CLI flag or configuration key.
Evidence
A live direct-DCR login to a working OAuth-fronted MCP gateway produced two identical POST attempts that each waited approximately 10.25 seconds for response headers, then ended as a generic context deadline exceeded. The same request later succeeded in approximately 2 seconds. DCR discovery, registration, and token issuance were not implicated.
Acceptance evidence
The implementation should use offline test-owned servers and diagnostic recorders to prove:
- Browser/callback wait is separate from the bounded pre- and post-authorization MCP exchanges.
- A delayed direct resource response succeeds under the revised policy and fails under a scaled equivalent of the old policy.
- Failure diagnostics are emitted per failed HTTP attempt and redact sensitive canaries.
- Reconnects retain their ordinary bounded establishment timeout.
- A timer callback racing with the browser-wait pause cannot cancel the newly armed post-authorization deadline.
No DCR registration lifecycle, broker transport timeout, YAML configuration, CLI grammar, persistence, or MCP wire-contract changes are in scope.
Activity