-
Notifications
You must be signed in to change notification settings - Fork 685
Description
Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
Bug description
We have made an mcp client using the HttpClientStreamableHttpTransport. Whenever we send a tools/list request to our mcp server, the response can be received UNTIL there is more than 6 tools/the response length is about 20kb or over. Our client times out when sending tools/list requests and doesn't present any other errors.
We know the mcp server is receiving the request, and responding with no issues and thus believe its an issue with the client.
The response from the mcp server that is failing
response_status":200,"response_length":22694,"duration(ms)":4.063842502
Environment
Please provide as many details as possible: Spring MCP version, Java version, which vector store you use if any, etc
Mcp version: 0.11.0
Java version: 21
Imports we have used
import io.modelcontextprotocol.client.McpAsyncClient
import io.modelcontextprotocol.client.McpClient.*
import io.modelcontextprotocol.client.transport.HttpClientStreamableHttpTransport
import io.modelcontextprotocol.spec.McpError
import io.modelcontextprotocol.spec.McpSchema
import io.modelcontextprotocol.spec.McpTransportSessionNotFoundException
Steps to reproduce
Steps to reproduce the issue.
We firstly intialize the client with the server (which works fine)
The list/tools call that is failing is
val tools = mcpClient.listTools().awaitSingle().tools
But the server has to be sending back more than 6 tools for this timeout to occur. Less tools works fine.
We have tested specifying the TIMEOUT variable as many different options (1000, 3000, 6000, 120000)
In this example the timeout is 120000
Our client is initalised as such:
return HttpClientStreamableHttpTransport .builder(baseUrl) .endpoint(MCP_ENDPOINT) .customizeClient { it.connectTimeout(TIMEOUT) } .customizeRequest { builder -> builder .timeout(TIMEOUT) <Some other headers> }.resumableStreams(false) .build()
val mcpAsyncClient = async(transport) .requestTimeout(TIMEOUT) .capabilities(McpSchema.ClientCapabilities.builder().build()) .build() mcpAsyncClient.initialize().awaitSingle()
We have also tried with resumableStreams(true) instead of false.
Errors
Did not observe any item or terminal signal within 120000ms in 'Mono.deferContextual ⇢ at io.modelcontextprotocol.spec.McpClientSession.sendRequest(McpClientSession.java:252)' (and no fallback has been configured)
java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 120000ms in 'Mono.deferContextual ⇢ at io.modelcontextprotocol.spec.McpClientSession.sendRequest(McpClientSession.java:252)' (and no fallback has been configured)
at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.handleTimeout(FluxTimeout.java:296)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Assembly trace from producer [reactor.core.publisher.MonoTimeout] :
reactor.core.publisher.Mono.timeout(Mono.java:5007)
io.modelcontextprotocol.spec.McpClientSession.sendRequest(McpClientSession.java:262)
Error has been observed at the following site(s):
*_________Mono.timeout ⇢ at io.modelcontextprotocol.spec.McpClientSession.sendRequest(McpClientSession.java:262)
| Mono.handle ⇢ at io.modelcontextprotocol.spec.McpClientSession.sendRequest(McpClientSession.java:262)
*_________Mono.flatMap ⇢ at io.modelcontextprotocol.client.LifecycleInitializer.lambda$withIntitialization$3(LifecycleInitializer.java:291)
*Mono.deferContextual ⇢ at io.modelcontextprotocol.client.LifecycleInitializer.withIntitialization(LifecycleInitializer.java:275)
| Mono.expand ⇢ at io.modelcontextprotocol.client.McpAsyncClient.listTools(McpAsyncClient.java:555)
| Flux.reduce ⇢ at io.modelcontextprotocol.client.McpAsyncClient.listTools(McpAsyncClient.java:556)
| Mono.map ⇢ at io.modelcontextprotocol.client.McpAsyncClient.listTools(McpAsyncClient.java:560)
Original Stack Trace:
at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.handleTimeout(FluxTimeout.java:296)
at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.doTimeout(FluxTimeout.java:281)
at reactor.core.publisher.FluxTimeout$TimeoutTimeoutSubscriber.onNext(FluxTimeout.java:420)
at reactor.core.publisher.FluxOnErrorReturn$ReturnSubscriber.onNext(FluxOnErrorReturn.java:162)
at reactor.core.publisher.MonoDelay$MonoDelayRunnable.propagateDelay(MonoDelay.java:270)
at reactor.core.publisher.MonoDelay$MonoDelayRunnable.run(MonoDelay.java:285)
at io.micrometer.context.ContextSnapshot.lambda$wrap$0(ContextSnapshot.java:91)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Minimal Complete Reproducible example
Please provide a failing test or a minimal complete verifiable example that reproduces the issue.
Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.