-
Notifications
You must be signed in to change notification settings - Fork 664
Description
When HttpClientTransport is created with HttpClientTransportOptions.AdditionalHeaders (e.g. Authorization: Bearer ), the header is applied for the initial handshake but is missing on subsequent MCP requests (tools/list, tools/call). Server receives requests without the Authorization header.
- Create transport with HttpClientTransportOptions.AdditionalHeaders = { ["Authorization"] = "Bearer " }.
- Create MCP client with that transport.
- Call ListToolsAsync() and then CallToolAsync(...).
- Observe server-side middleware: initial request may show token, later MCP calls report missing Authorization.
Headers provided in AdditionalHeaders (especially Authorization) should be present on every HTTP request the transport issues, not only during the initial handshake.
• Client logs: token created and initial request shows header present.
• Server logs: later requests report No Bearer token provided and incomplete session context.
• Pattern: different connection/RequestId used for later requests that lack the header.
• Likely cause: transport creates or uses multiple HttpClient instances and does not apply AdditionalHeaders to every outgoing HttpRequestMessage.