You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To configure headers, authentication or timeouts, create an `httpx.AsyncClient` and pass it as `http_client=`.
134
+
135
+
## HTTP redirects
136
+
137
+
The transport connects to the URL you gave it, and only that origin.
138
+
139
+
* A `307`/`308` redirect that stays on the same scheme, host and port is followed, and so is `http://` → `https://` on the same host. That covers the usual `/mcp` → `/mcp/` trailing-slash redirect.
140
+
* A redirect anywhere else is **not** followed. Connecting fails with:
141
+
142
+
```text
143
+
httpx.HTTPStatusError: Redirect to https://other.example.com/mcp not followed; use that URL as the endpoint if it is the intended server
144
+
```
145
+
146
+
If that URL is the server you meant, put it in your config. If it isn't, the server or a proxy in front of it is misconfigured.
147
+
148
+
This holds for any `httpx.AsyncClient` you pass in: its `follow_redirects` setting is not consulted for MCP requests, in either direction. The SDK's OAuth providers apply the same rule to their own requests, and so does `sse_client()`.
149
+
150
+
!!! tip
151
+
`Redirect to http://… not followed: it would downgrade this HTTPS endpoint to plain HTTP` means the
152
+
server sits behind a TLS-terminating proxy it doesn't know about and is issuing `http://` redirects.
153
+
That is fixed on the server (for uvicorn: `--proxy-headers` and `--forwarded-allow-ips`), or by
154
+
using the exact `https://…/` URL the message suggests.
155
+
133
156
## Client Display Utilities
134
157
135
158
When building MCP clients, the SDK provides utilities to help display human-readable names for tools, resources, and prompts:
0 commit comments