Skip to content

HTTP + SSe connection no longer reliable works with 0.11.0 and newer SDK #474

@raducoravu

Description

@raducoravu

Bug description

With the 0.11.0 and 0.11.1 SDKs I can no longer reliable work with HTTP + SSE servers like for example the sample "https://mcp.deepwiki.com/sse" server.

Environment
Java 17, MCP 0.11.1 SDK.

Steps to reproduce

Run this code with the 0.10.0 SDK, the consecutive tool calls will all work.
With the 0.11.0 and 0.11.1 SDK's only the first tool call works, the subsequent ones do not.

  public static void main(String[] args) throws InterruptedException {
    HttpClientSseClientTransport transport = HttpClientSseClientTransport.builder(
        "https://mcp.deepwiki.com/sse").customizeClient(
        new Consumer<HttpClient.Builder>() {
          @Override
          public void accept(Builder t) {
           t.connectTimeout(Duration.ofMinutes(2));
          }
        }).build();
    McpSyncClient client = McpClient.sync(transport).build();
    client.initialize();
    
    ListToolsResult tools = client.listTools();
    List<Tool> tulz = tools.tools();
    for (Tool tool : tulz) {
      System.err.println("Tool " + tool.name());
    }
    
    for (int i = 0; i < 5; i++) {
      System.err.println("Iteration ----- " + i);
      Thread.sleep(5000);
      Map<String, Object> params = new HashMap<>();
      params.put("repoName", "dita-ot/dita-ot");
      CallToolResult result = client.callTool(new CallToolRequest("read_wiki_structure", params));
      System.err.println("Result " + i + " -> " + result.toString());
    }
  }

Expected behavior

All the 5 tool calls should successfully finish.

Minimal Complete Reproducible example

See steps to reproduce.

Metadata

Metadata

Assignees

Labels

waiting for userWaiting for user feedback or more details

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions