JAVA SDK connectto streamablehttptransport raise "Client failed to initialize by explicit API call"
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- java
- 領域
- api, networking
調査の方向性
提供されている HttpClientStreamableHttpTransport builder の例から始め、mcpSyncClient.initialize() を使って失敗を再現します。LifecycleInitializer.java の 288 行目付近と、20 秒のタイムアウトに至る初期化パスを読み、その後、streamable HTTP の動作を、動作すると報告されている SSE のケースと比較します。提供された streamable HTTP endpoint に対して Java SDK が正常に初期化され、この動作の回帰テストがあることが完了条件です。
索引モデルが issue の本文から書いたものです。
説明
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();
}
- 主要言語
- Java
- スター
- 3.7k
- フォーク
- 1.1k
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 9
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/java-sdk のほかの issue
-
area/transport bug P2
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
modelcontextprotocol/java-sdk#1136 ·
-
area/client bug P2
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/java-sdk#1124 · コメント 1 件 ·
-
ServerCapabilities.logging is added unconditionally, overriding the caller's explicit capabilities オープンbug P2 ready for work
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/java-sdk#1086 · コメント 1 件 ·
-
enhancement good first issue P3
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
modelcontextprotocol/java-sdk#1067 ·
-
bug P2 ready for work
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
modelcontextprotocol/java-sdk#898 · コメント 1 件 ·