From b5ece766e7166b67de84748eeb1bf612bb0344fc Mon Sep 17 00:00:00 2001 From: Christian Tzolov Date: Tue, 17 Jun 2025 17:21:34 +0200 Subject: [PATCH] fix: resolve type inference issues in StdioClientTransport - Add explicit Void type parameter to Mono.defer() call - Chain .then() to Mono.delay() to ensure consistent Mono return type Signed-off-by: Christian Tzolov --- .../client/transport/StdioClientTransport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mcp/src/main/java/io/modelcontextprotocol/client/transport/StdioClientTransport.java b/mcp/src/main/java/io/modelcontextprotocol/client/transport/StdioClientTransport.java index 246ff11..8545348 100644 --- a/mcp/src/main/java/io/modelcontextprotocol/client/transport/StdioClientTransport.java +++ b/mcp/src/main/java/io/modelcontextprotocol/client/transport/StdioClientTransport.java @@ -346,14 +346,14 @@ public class StdioClientTransport implements McpClientTransport { return Mono.fromRunnable(() -> { isClosing = true; logger.debug("Initiating graceful shutdown"); - }).then(Mono.defer(() -> { + }).then(Mono.defer(() -> { // First complete all sinks to stop accepting new messages inboundSink.tryEmitComplete(); outboundSink.tryEmitComplete(); errorSink.tryEmitComplete(); // Give a short time for any pending messages to be processed - return Mono.delay(Duration.ofMillis(100)); + return Mono.delay(Duration.ofMillis(100)).then(); })).then(Mono.defer(() -> { logger.debug("Sending TERM to process"); if (this.process != null) {