LangChain4j StreamableHttpMcpTransport: protocol detection for Sume
LangChain4j probes the MCP protocol on connect, which costs one round trip. Pin protocolVersion and set timeouts before pointing it at Sume's hosted MCP server.

Java teams reach Sume's hosted MCP server through LangChain4j's Streamable HTTP transport. The LangChain4j MCP tutorial describes a builder with url, logRequests and logResponses, plus a protocol detection step on connect, read 2026-10-03. Sume's server speaks Streamable HTTP at https://mcp.sume.com/mcp, per the Sume MCP overview, so the transport is the right match. What needs care is startup behaviour and what the logs capture.
What the tutorial says about detection
The tutorial states that protocolDetectionTimeout defaults to the initializationTimeout, which is 30 seconds, and that detection costs one extra round trip. Setting protocolVersion explicitly skips it. It also says subsidiaryChannel(true) is off by default. This post does not claim which protocol versions Sume's server accepts, because the Sume docs do not list them; test against the server before pinning a value.
| Setting | Default | Why it matters |
|---|---|---|
protocolDetectionTimeout | Same as initializationTimeout (30 s) | A slow first connect can stall startup for that long |
protocolVersion | Detected | Setting it skips the extra round trip |
subsidiaryChannel | Off | Leave off unless you need server-initiated messages |
logRequests / logResponses | Off | Useful in tests; see the caution below |
Be careful with request and response logging
logRequests and logResponses are useful while you wire things up, but a Sume tool call carries an idempotency_key, prompts and result URLs. Turn them on in a test profile, not in production, and check what your logging backend does with headers before you add a credential. Sume accepts either Authorization: Bearer or x-api-key, but not both on the REST API.
Long jobs from a Java client
Sume's create tools return a job id quickly, and jobs_wait holds for 50 seconds by default with a 55-second cap, according to the tools and gates page. Keep your tool-call timeout above that, loop on wait_slice_expired with the same ids, and never resubmit the create. A transport error such as 524 says nothing about the job.
If the JVM exits mid-wait, the job continues. Persist the job id returned from the create and resume with jobs_result or another jobs_wait later.
- Pin
protocolVersiononce you have tested it. - Keep
initializationTimeoutmodest so a bad URL fails fast. - Log only in tests.
- Persist job ids before the first wait.
Sources
Related posts
More in Developers
- last_frame without first_frame returns 400: kling-3 and Seedance fix
A frame_images list with only a last_frame is rejected with 400 unsupported_capability. Send a first_frame too; Kling 3.0 uses start and end frames only.
- Latin American Spanish text to speech: es or es-MX on Sume?
Sume's TTS language is a free string and its voice library tags voices with plain es. What that means for Mexican, Argentine or Spain Spanish, and how to test.
- FLUX 3 style boxes for Sume: draw a layout reference sheet in Python
Sume has no bounding-box input. Draw numbered boxes on a blank sheet from a 0-1000 grid, pass it as a reference, and name each box in the prompt.
- LiteLLM /mcp-rest/tools/call: test Sume tools without an LLM
LiteLLM exposes REST routes to list and call MCP tools with no model in the loop. Use them to smoke-test Sume's read tools and gates before an agent sees them.
Written by Sume