Fix on streamable‑http auth drop on Azure #1110
Closed
+8
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaced all
Mount(self.settings.streamable_http_path, …)
registrations withRoute(self.settings.streamable_http_path, endpoint=…, methods=["POST","GET","DELETE"])
to eliminate the automatic 307 redirect and ensure the Authorization header is preserved on public deployments.Motivation and Context
During the 307 redirect from
/mcp
to/mcp/
, many HTTP clients drop sensitive headers like Authorization when following external redirects. Locally, Uvicorn + HTTPX transparently reattach headers, so the bug only appeared when I distributed the server on Azure. Switching toRoute
removes the redirect entirely, preserving end‑to‑end authentication and restoring expected behavior of the streamable‑http transport.How Has This Been Tested?
Local: verified with MCP Inspector that /mcp and /mcp/ calls succeed without dropping headers.
Azure: deployed to Azure App Service, exercised full OAuth flow and MCP Inspector connect; confirmed no 307 redirect and successful streamable‑http sessions.
Breaking Changes
None. This is a transparent change to route registration. Existing clients can continue calling /mcp or /mcp/ with no code or configuration updates.
Types of changes
Checklist
Additional context