Skip to content

[Bug]:McpClientBuilder.streamableHttpTransport does not expose resumableStreams option — hangs on SSE-disabled MCP servers #2003

Description

@wkflash

When connecting to a Streamable HTTP MCP server that disables SSE (only accepts POST requests), tool calls hang
indefinitely. The MCP server is discovered and tools are registered successfully during initialization, but actual tool
invocations (callTool) never return — PRE_ACTING fires without a corresponding POST_ACTING.

The root cause is that McpClientBuilder.streamableHttpTransport(url) does not expose the underlying MCP SDK's
HttpClientStreamableHttpTransport.Builder options resumableStreams and openConnectionOnStartup. Both default to true,
meaning the transport always attempts to establish an SSE connection even when the server does not support it. Direct curl
POST calls to the same server work correctly, confirming the issue is in the transport layer, not the server.

To Reproduce

  1. Configure a Streamable HTTP MCP server that returns 405 Method Not Allowed for SSE requests (e.g. WeCom Document MCP):

// tools.json
{
"mcpServers": {
"example": {
"transport": "streamableHttp",
"url": "https://qyapi.weixin.qq.com/mcp/robot-doc?apikey=xxx"
}
}
}

  1. Build the agent with HarnessAgent.builder()...build().
  2. Send a message that triggers an MCP tool call.
  3. Observe that PRE_ACTING (tool call started) appears in logs, but POST_ACTING (tool call completed) never fires — the
    call hangs.

Minimal reproduction without HarnessAgent:

McpClientWrapper client = McpClientBuilder.create("test")
.streamableHttpTransport("https://sse-disabled-mcp-server.example.com/mcp")
.buildSync();

Toolkit toolkit = new Toolkit();
toolkit.registerMcpClient(client).block();

ReActAgent agent = ReActAgent.builder()
.name("test").model(model).toolkit(toolkit).build();

// This call will hang when the agent tries to invoke an MCP tool
agent.call(new UserMessage("use a tool")).block();

Expected behavior

Tool calls complete successfully against SSE-disabled Streamable HTTP MCP servers.

McpClientBuilder should expose the transport builder options: resumableStreams(false) and openConnectionOnStartup(false),
either via:

McpClientBuilder.create("test")
.streamableHttpTransport(url)
.resumableStreams(false) // API option
.buildSync();

Or via tools.json:

{
"transport": "streamableHttp",
"url": "https://...",
"resumableStreams": false
}

Error messages

During initialization (recovered, tools registered):
io.modelcontextprotocol.spec.McpTransportException: Invalid SSE response. Status code: 405
{"error":"Method Not Allowed","message":"SSE is disabled. Please use POST for /mcp/robot-doc","allowed_methods":["POST"]}

During tool invocation (no error — just hangs forever):
PRE_ACTING | name=create_doc ← fires
POST_ACTING | ← never fires

Environment

  • AgentScope-Java Version: 2.0.0-RC4
  • MCP Java SDK: 0.17.0 (transitive dependency)
  • Java Version: 17
  • OS: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions