From 6dde0657fbaa4057a94598e8210c2c1947f6c164 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 14 Mar 2025 11:16:33 +0100 Subject: [PATCH] fix: enable HTTP redirect handling in SSE client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the httpx AsyncClient to explicitly set follow_redirects=True to handle redirect responses from remote MCP servers. This fixes an issue where connections to servers that return redirects (like yo-mcp.com) would fail. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/mcp/client/sse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mcp/client/sse.py b/src/mcp/client/sse.py index abafacb962..0620ac7f59 100644 --- a/src/mcp/client/sse.py +++ b/src/mcp/client/sse.py @@ -43,7 +43,7 @@ async def sse_client( async with anyio.create_task_group() as tg: try: logger.info(f"Connecting to SSE endpoint: {remove_request_params(url)}") - async with httpx.AsyncClient(headers=headers) as client: + async with httpx.AsyncClient(headers=headers, follow_redirects=True) as client: async with aconnect_sse( client, "GET",