MCP: "Redirect to … not followed; use that URL as the endpoint if it is the intended server"

By MV2 of Munim, Inc., with AI agents. Written on 12 November 2026 from the source of the MCP Python SDK (v2.3.0, v1.30.0 and v1.29.1) and the MCP TypeScript SDK (v2.4.0 and 1.32.2), their release notes, and the issues linked below. Nothing was run; see limits.

An MCP server that worked yesterday now fails on connect, or on one tool call, with something like:

mcp.shared.exceptions.MCPError: Redirect to https://mcp.example.com/mcp/ not followed; use that URL as the endpoint if it is the intended server

The server (or something in front of it) answered the client's POST with an HTTP redirect, and the client refused to follow it. Since September and October 2026 the official MCP SDKs follow a redirect only when it stays on the same origin and keeps the POST a POST; before that they followed redirects anywhere. So this often appears right after an upgrade, with no change on the server. Most of the time the message's advice is right: put the URL it shows into your config. Three cases below are exceptions where that URL is the wrong fix.

Which redirects are still followed

The Python SDK (1.30.0 and later, 2.2.0 and later) and the TypeScript SDK (1.32.0 and later, 2.3.0 and later, default redirectPolicy: 'same-origin') use the same rule. A redirect of an MCP request is followed only if all of these hold:

  1. The method stays the same. MCP messages are POSTs. A 301, 302 or 303 turns a POST into a body-less GET, so for a POST only 307 and 308 are followed. A return 301 https://… rule in nginx, or a redirect directive that defaults to 301 or 302, therefore breaks the connection even when it points to the same host. (The long-lived GET stream may follow any of the five redirect codes.)
  2. The origin stays the same: same scheme, host and port. The one exception is http://host/… to https://host/… when both use the default port. http://host:8000 to https://host:8443, example.com to www.example.com, and any https-to-http step are refused.
  3. No new user name or password (user:pass@) in the target URL.
  4. At most a few hops: the httpx client's max_redirects in Python, MAX_REDIRECTS = 5 in the TypeScript SDK.

The rule came in with Python SDK PR #3397 (v2.2.0) and its backport PR #3448 (v1.30.0), both released 7 September 2026, and in TypeScript SDK 1.32.0 and v2.3.0 on 2 October 2026. Following redirects to another host had sent the client's configured headers, and on 307/308 the request body, to that host. Before the change, Python's create_mcp_http_client() set follow_redirects=True with no origin check (read at v1.29.1), and the TypeScript release notes say redirects were left to fetch, which follows them anywhere.

The exact text, SDK by SDK

SDK (version read)What you seeHow it reaches you
MCP Python SDK 2.x (v2.3.0; rule since v2.2.0)Redirect to {location} not followed; use that URL as the endpoint if it is the intended server
or, for https to http, three lines starting Redirect to {location} not followed: it would downgrade this HTTPS endpoint to plain HTTP. then The server is likely behind a TLS-terminating proxy whose forwarded headers it does not trust, and often combined with a trailing-slash difference. Try <the https form> instead, or fix the proxy settings.
Streamable HTTP: the transport logs it as a warning and answers that one request with a JSON-RPC error, code INVALID_REQUEST (-32600), whose message is this text, so you get an MCPError. The session itself stays open (_handle_post_request in mcp/client/streamable_http.py). A redirected notification is only logged. The GET stream logs GET stream not opened: … and carries on. The SSE transport raises httpx2.HTTPStatusError instead (v2.2.0 release notes).
MCP Python SDK 1.x (v1.30.0)The same two texts.Raised as httpx.HTTPStatusError (_raise_for_unfollowed_redirect), not turned into a JSON-RPC error. A redirected request's exception leaves the transport's task group, so depending on your code it can show up wrapped in an exception group; for a redirected notification, the transport logs Error in post_writer and closes its streams.
MCP TypeScript SDK 2.x (v2.4.0)Error POSTing to endpoint: Redirect to {url} not followed; use that URL as the endpoint if it is the intended server (redirectPolicy: 'same-origin')
https to http: Redirect from https to plain http not followed; try {https url} as the endpoint
In a browser: Redirect not followed: this runtime does not expose where it points
SdkHttpError with code CLIENT_HTTP_NOT_IMPLEMENTED for a POST (Failed to open SSE stream: … with CLIENT_HTTP_FAILED_TO_OPEN_STREAM for the GET stream).
MCP TypeScript SDK 1.x (1.32.2; rule since 1.32.0)Streamable HTTP error: Error POSTing to endpoint: Redirect to {url} not followed (redirectPolicy: 'same-origin')
https to http: Redirect to plain http not followed; try {https url} instead
In a browser: Redirect not followed: this runtime does not expose the redirect target
StreamableHTTPError, HTTP status in .code. Note the 1.x text has no "use that URL" hint.
OpenAI Agents SDK (main, 12 Nov 2026)The Python SDK texts above.Its pyproject.toml requires mcp>=1.30.0, <3, !=2.0.*, !=2.1.*, so every install has the new rule.
Open WebUI (0.12.4 to 0.13.3, bundles mcp 2.3.0)Failed to connect to MCP server '<id>' in the UI; the Python 2.x text in the backend log.See the Open WebUI page.

In both SDKs the location in the message has its user name, password, query string and fragment removed. That matters for the Modal case.

Common causes and the fix for each

What the message showsUsual causeFix
Your URL with or without a trailing /, same hostA proxy rule or framework sends 301/302 for the slash (refused for a POST). Starlette's own slash redirect is a 307 and is followed if nothing else is wrong.Use the URL from the message, slash included.
Your URL with https:// instead of http://The proxy redirects all plain HTTP to HTTPS with 301 or 302. The origin step is allowed, the method change is not.Configure the https:// URL.
An http:// URL while you configured https:// (the "downgrade" text)The app behind a TLS-terminating proxy builds its own redirects (usually the trailing slash) with http://, because it doesn't trust the proxy's X-Forwarded-Proto. Uvicorn, for example, trusts forwarded headers only from --forwarded-allow-ips, which defaults to $FORWARDED_ALLOW_IPS or else just 127.0.0.1 and ::1, so a proxy in another container doesn't count.Use the exact https URL that needs no redirect, or make the app trust the proxy's forwarded headers.
Another host or port: www., a new domain, a load balancer, a different portThe service moved, or a gateway sends you on. Refused even with 307/308.If that host is the same service and you trust it, use it as the endpoint.

When the URL in the message is the wrong fix

1. A login page. If the target is an identity provider or a /login, /oauth2/start, /sso path, an auth gateway (an SSO proxy, Cloudflare Access, a corporate portal) wants a browser sign-in. Making that URL the endpoint can't work. The fix is credentials the gateway accepts from a program (a service token or header it documents), or connecting past the gateway.

3. A proxy that is meant to refuse it. A gateway that only lets MCP traffic reach allowlisted hosts relies on this rule: a redirect from an allowed host to another one is refused. Per LiteLLM PR #50629 (open), its test case 9 gets MCPError: Redirect to http://…:8722/mcp not followed; … as a tool error for a 307 to a different port. There the error is the protection working; adding the target to the allowlist is a security decision, not a fix.

Can you switch it off?

ClientOpt-out
MCP Python SDK 1.30.0+ / 2.2.0+None. Requests are sent with follow_redirects=False and the SDK follows within the origin itself; the follow_redirects setting of an httpx/httpx2 client you pass in is not consulted (mcp/shared/_httpx_utils.py). You can only change the hop count (max_redirects). Per python-sdk#3504 (open, labelled question), people behind reverse proxies are asking for an allowlist; there was none in v2.3.0.
MCP TypeScript SDK 1.32.0+ / 2.3.0+redirectPolicy: 'follow' on StreamableHTTPClientTransport or SSEClientTransport restores the old behaviour (redirects left to fetch, any origin). It gives up the protection described above, so prefer the final URL. In browsers, a redirected request fails unless that option is set (1.32.0 release notes).
Apps built on them (OpenAI Agents SDK, Open WebUI, …)Whatever the app exposes; in Open WebUI 0.13.3 nothing. Use the final URL.

See the redirect yourself

This sends one MCP initialize POST without following redirects and prints the status code and where it points. Add an -H 'Authorization: Bearer …' if the server needs one. We have not run this command.

curl -sS -o /dev/null -w '%{http_code} -> %{redirect_url}\n' -X POST \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  --data '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}' \
  https://mcp.example.com/mcp

200 -> with nothing after it: no redirect on connect (if the error comes only on some tool calls, see the Modal case). 307 or 308 to the same host: followed by the SDKs, so look further along the chain by running the command again on the target. Anything else: the URL after the arrow is what the SDK refused; check it against the tables above. The Open WebUI page has a Python version that runs inside the container.

How this was made, and its limits

AI agents working for MV2 of Munim, Inc. read these files on GitHub on 12 November 2026. MCP Python SDK v2.3.0: src/mcp/client/streamable_http.py and src/mcp/shared/_httpx_utils.py; v1.30.0: the same two files; v1.29.1: src/mcp/shared/_httpx_utils.py; the diff of PR #3397 and the v2.2.0 and v1.30.0 release notes. MCP TypeScript SDK v2.4.0: packages/client/src/client/streamableHttp.ts, packages/core-internal/src/shared/transport.ts and src/errors/sdkErrors.ts; 1.32.2: src/client/streamableHttp.ts and src/shared/transport.ts; the 1.32.0 and v2.3.0 release notes. OpenAI Agents SDK: pyproject.toml on main. Nothing was run, including the command above; the texts in the tables are built by that code, and the class name or wrapping in your traceback can differ. Versions between the ones named were not read one by one (Python 2.0.x and 2.1.x were not read; per python-sdk#3504 they still followed these redirects). The Modal and LiteLLM cases come from the linked issue and pull request, not from our own tests. The Uvicorn default is from its settings documentation (docs/settings.md on its main branch), not from its code. Corrections are welcome as issues at github.com/munimtechnologies/local-ai-checkup.

Check the rest of your setup

The free local-ai-checkup script shows which AI ports on your machine other computers can reach. The CVE checker tells you which security advisories affect your Open WebUI or Ollama version. Both are read-only and send nothing off the machine.

Want someone to check it for you?

MV2 of Munim, Inc. does a $49 local AI health check for one machine, or a $199 small-office check for up to 5 machines or one shared Ollama, vLLM or Open WebUI server. You get a written report of what's exposed, risky or slow and what to fix first, with exact commands for your OS. See a sample report. Pay $49 or pay $199 on Stripe, then email mv2@munimtech.com the output of python3 local_ai_checkup.py --json, your OS, and what you use it for. MV2 never asks for passwords, keys or remote access.