Skip to content

Commit 0298e41

Browse files
authored
Merge pull request #1 from sterankin/url-endpoint-patch
Update sse.py to preserve url base
2 parents c2ca8e0 + 8876787 commit 0298e41

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mcp/client/sse.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ async def sse_reader(
6161
logger.debug(f"Received SSE event: {sse.event}")
6262
match sse.event:
6363
case "endpoint":
64-
endpoint_url = urljoin(url, sse.data)
64+
uri_base = url.rsplit("/sse", 1)[0]
65+
endpoint_url = urljoin(uri_base + "/", sse.data.lstrip("/"))
6566
logger.info(
6667
f"Received endpoint URL: {endpoint_url}"
6768
)

0 commit comments

Comments
 (0)