Skip to content

Commit 7f7e00e

Browse files
Fix: Replace Mono.zip with Mono.when in StdioServerTransportProvider#sendMessage
Mono.zip() on Mono<Void> sources cancels the slower publisher when the faster one completes empty, which can cause the inbound or outbound ready signal to be prematurely cancelled. Mono.when() correctly waits for all sources to complete before proceeding. Fixes #303 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 26304a7 commit 7f7e00e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎mcp-core/src/main/java/io/modelcontextprotocol/server/transport/StdioServerTransportProvider.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public StdioMcpSessionTransport() {
160160
@Override
161161
public Mono<Void> sendMessage(McpSchema.JSONRPCMessage message) {
162162

163-
return Mono.zip(inboundReady.asMono(), outboundReady.asMono()).then(Mono.defer(() -> {
163+
return Mono.when(inboundReady.asMono(), outboundReady.asMono()).then(Mono.defer(() -> {
164164
if (outboundSink.tryEmitNext(message).isSuccess()) {
165165
return Mono.empty();
166166
}

0 commit comments

Comments
 (0)