Fix: Replace Mono.zip with Mono.when in StdioServerTransportProvider#sendMessage by rameshreddy-adutla · Pull Request #846 · modelcontextprotocol/java-sdk

Summary

Replaces Mono.zip() with Mono.when() in StdioMcpSessionTransport#sendMessage to correctly wait for both inbound and outbound ready signals before sending messages.

Problem

Mono.zip() on Mono<Void> sources cancels the slower publisher when the faster one completes empty. As explained by @chemicL, this means the slower of the two ready signals (inboundReady or outboundReady) gets cancelled instead of being awaited.

Fix

Changed Mono.zip(inboundReady.asMono(), outboundReady.asMono()) to Mono.when(inboundReady.asMono(), outboundReady.asMono()) which properly waits for all sources to complete before proceeding.

Testing

All 9 existing StdioServerTransportProviderTests pass.

Fixes #303