fix: comment out emitter.complete() to allow keep-alive sessions for standard SSE MCP client
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled

This commit is contained in:
kimhyungsik
2026-07-23 10:15:56 +09:00
parent 2b4adb45d2
commit 2948465b8a

View File

@@ -179,8 +179,8 @@ public class CustomWebMvcSseServerTransportProvider implements McpServerTranspor
log.info("Message sent to session handler"); log.info("Message sent to session handler");
if (emitter != null && !map.containsKey("id")) { if (emitter != null && !map.containsKey("id")) {
emitter.complete(); // emitter.complete();
log.info("Completed emitter for notification"); log.info("Completed emitter for notification (disabled for keep-alive)");
} }
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
@@ -220,7 +220,7 @@ public class CustomWebMvcSseServerTransportProvider implements McpServerTranspor
// Custom 프로토콜: 1회 요청당 1응답 후 종료 (스트림을 닫아버림) // Custom 프로토콜: 1회 요청당 1응답 후 종료 (스트림을 닫아버림)
// 클라이언트가 한 번의 POST 후 응답을 받고 연결을 끊기 때문 // 클라이언트가 한 번의 POST 후 응답을 받고 연결을 끊기 때문
this.emitter.complete(); // this.emitter.complete();
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Error sending message to SSE emitter", e); log.error("Error sending message to SSE emitter", e);