mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-10-28 03:51:08 -04:00
BE+TESTS: relative MCP SSE endpoint path #1854
The SSE endpoint event advertised the absolute path /mcp/messages, which drops the /server prefix when clients connect through the bundled nginx proxy on port 20211. Clients then POST to /mcp/messages, nginx serves it as a static file and returns 404, so MCP clients can't connect via the proxy. A relative path resolves against whichever SSE URL the client used, so it works both directly and behind the prefix.
This commit is contained in:
2 files changed
+49
-2
No files matched your search
@@ -1057,8 +1057,9 @@ def mcp_sse():
|
||||
|
||||
def stream():
|
||||
"""Generator for SSE stream."""
|
||||
# Send endpoint event with session ID
|
||||
yield f"event: endpoint\ndata: /mcp/messages?session_id={session_id}\n\n"
|
||||
# Send endpoint event with session ID. Relative path, so clients resolve it against
|
||||
# the SSE URL they used (works directly and behind the nginx /server prefix).
|
||||
yield f"event: endpoint\ndata: messages?session_id={session_id}\n\n"
|
||||
|
||||
try:
|
||||
while True:
|
||||
|
||||
Reference in new issue
Block a user