JAVA SDK connectto streamablehttptransport raise "Client failed to initialize by explicit API call"
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- java
- Domain
- api, networking
Research direction
Start with the provided HttpClientStreamableHttpTransport builder example and reproduce the failure using mcpSyncClient.initialize(). Read LifecycleInitializer.java around line 288 and the initialization path leading to the 20-second timeout, then compare the streamable HTTP behavior with the reported working SSE case. Done means the Java SDK initializes successfully for the supplied streamable HTTP endpoint and has a regression test for the behavior.
Written by the indexing model from the issue text.
Description
JAVA SDK connectto streamablehttptransport raise "Client failed to initialize by explicit API call".
sse is fine.
I searched on issuses, Some similar issues were found, but they were all marked as resolved.
Bug description
JAVA SDK connectto streamablehttptransport raise "Client failed to initialize by explicit API call"
Environment
Please provide as many details as possible: Spring MCP version, Java version, which vector store you use if any, etc
java 17 , main brunch 2026-03-25; v1.1.0
Steps to reproduce
public static void testmcphttp() {
String mcpUrl = "http://192.168.190.51:31603/api/mcp/mcpserver/mcp";
String tk = "gtk849416ca3e3b44a28b9956046895fafe";
mcpUrl = "http://127.0.0.1:8702/api/mcp/mcpserver/mcp";
tk = "gtkba06f61af36f4cf597624c73cc23abbc";
HttpClientStreamableHttpTransport transport = HttpClientStreamableHttpTransport
.builder("http://127.0.0.1:8702")
.endpoint("/api/mcp/mcpserver/mcp?tk=" + tk)
.build();
McpSyncClient mcpSyncClient = McpClient
.sync(transport)
.clientInfo(new McpSchema.Implementation("Sample client", "0.0.0"))
.build();
mcpSyncClient.initialize();
}
Expected behavior
Exception in thread "main" java.lang.RuntimeException: Client failed to initialize by explicit API call
at io.modelcontextprotocol.client.LifecycleInitializer.lambda$withInitialization$2(LifecycleInitializer.java:288)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
at reactor.core.publisher.SerializedSubscriber.onError(SerializedSubscriber.java:124)
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 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:264)
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:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:104)
at reactor.core.publisher.Mono.block(Mono.java:1779)
at io.modelcontextprotocol.client.McpSyncClient.initialize(McpSyncClient.java:189)
at io.modelcontextprotocol.TLCMCP.testmcphttp(TLCMCP.java:33)
at io.modelcontextprotocol.TLCMCP.main(TLCMCP.java:57)
Caused by: java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 20000ms in 'map' (and no fallback has been configured)
... 14 more
Minimal Complete Reproducible example
public static void testmcphttp() {
String mcpUrl = "http://192.168.190.51:31603/api/mcp/mcpserver/mcp";
String tk = "gtk849416ca3e3b44a28b9956046895fafe";
mcpUrl = "http://127.0.0.1:8702/api/mcp/mcpserver/mcp";
tk = "gtkba06f61af36f4cf597624c73cc23abbc";
HttpClientStreamableHttpTransport transport = HttpClientStreamableHttpTransport
.builder("http://127.0.0.1:8702")
.endpoint("/api/mcp/mcpserver/mcp?tk=" + tk)
.build();
McpSyncClient mcpSyncClient = McpClient
.sync(transport)
.clientInfo(new McpSchema.Implementation("Sample client", "0.0.0"))
.build();
mcpSyncClient.initialize();
}
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 1.1k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/java-sdk
-
area/transport bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
modelcontextprotocol/java-sdk#1136 ·
-
area/client bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/java-sdk#1124 · 1 comment ·
-
ServerCapabilities.logging is added unconditionally, overriding the caller's explicit capabilities Openbug P2 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/java-sdk#1086 · 1 comment ·
-
enhancement good first issue P3
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
modelcontextprotocol/java-sdk#1067 ·
-
bug P2 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
modelcontextprotocol/java-sdk#898 · 1 comment ·
All issues in modelcontextprotocol/java-sdk
Similar issues
-
bug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
opensearch-project/ml-commons#5094 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
emitter:client:csharp feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
affects/8.10 affects/8.9 component/clients kind/bug likelihood/mid severity/mid
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Openbug frontend maui-pilot
Difficulty 2/5 1-3 hours Newbie friendliness 72/100