We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7e1b9d3 + 9a58b30 commit ac3acbbCopy full SHA for ac3acbb
src/mcp/client/sse.py
@@ -62,20 +62,22 @@ async def sse_reader(
62
logger.debug(f"Received SSE event: {sse.event}")
63
match sse.event:
64
case "endpoint":
65
+ url_parsed = urlparse(url)
66
+
67
base_path = re.search(
- r"https?://[^/]+/(.+)/sse$", url
68
+ r"https?://[^/]+/(.+?)(?:/mcp)?/sse$", url
69
)
70
base_path = (
71
base_path.group(1) if base_path else ""
72
73
endpoint_url = urljoin(
- url, base_path + sse.data
74
+ url_parsed.scheme + "://" + url_parsed.netloc,
75
+ base_path + sse.data
76
77
logger.info(
78
f"Received endpoint URL: {endpoint_url}"
79
80
- url_parsed = urlparse(url)
81
endpoint_parsed = urlparse(endpoint_url)
82
if (
83
url_parsed.netloc != endpoint_parsed.netloc
0 commit comments