Title: Streamable HTTP client ignores SSE messages when event name is omitted · Issue #885 · modelcontextprotocol/java-sdk · GitHub
Open Graph Title: Streamable HTTP client ignores SSE messages when event name is omitted · Issue #885 · modelcontextprotocol/java-sdk
X Title: Streamable HTTP client ignores SSE messages when event name is omitted · Issue #885 · modelcontextprotocol/java-sdk
Description: Disclaimer: I am not a native English speaker. This issue was drafted with AI translation assistance. I apologize for any awkward phrasing. Bug description When using the Streamable HTTP transport, the Java client receives an SSE frame w...
Open Graph Description: Disclaimer: I am not a native English speaker. This issue was drafted with AI translation assistance. I apologize for any awkward phrasing. Bug description When using the Streamable HTTP transport,...
X Description: Disclaimer: I am not a native English speaker. This issue was drafted with AI translation assistance. I apologize for any awkward phrasing. Bug description When using the Streamable HTTP transport,...
Opengraph URL: https://github.com/modelcontextprotocol/java-sdk/issues/885
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Streamable HTTP client ignores SSE messages when event name is omitted","articleBody":"Disclaimer: I am not a native English speaker. This issue was drafted with AI translation assistance. I apologize for any awkward phrasing.\n\n## Bug description\n\nWhen using the Streamable HTTP transport, the Java client receives an SSE frame whose payload contains a valid JSON-RPC response, but the SSE event name is omitted by the server.\n\nIn standard SSE semantics, if the `event:` field is omitted, the event type defaults to `message`. However, the current Java SDK only parses the frame if `event.event()` is explicitly equal to `\"message\"`. If the event name is missing and Spring/WebFlux exposes it as `null`, the client drops the frame instead of treating it as a default `message` event.\n\nAs a result, the `initialize` response is ignored even though the client has already received the JSON-RPC result, and initialization eventually times out with:\n\n`Client failed to initialize by explicit API call`\n\nIn my case, the server is `rmcp` over Streamable HTTP.\n\n## Environment\n\n- Spring AI: `2.0.0-M3`\n- MCP Java SDK: `1.1.0`\n- Transport: `WebClientStreamableHttpTransport` (via `spring-ai-starter-mcp-client-webflux`)\n- Spring Boot: `4.0.4`\n- Java: `25.0.2`\n- Reactor Netty: `1.3.4`\n- MCP server: `rmcp 1.2.0` (Rust, Streamable HTTP)\n- OS: macOS\n\n## Steps to reproduce\n\n1. Run an MCP server over Streamable HTTP.\n2. Make the server return a valid JSON-RPC `initialize` result as `text/event-stream`.\n3. The SSE frame should contain only `data: ...` and omit the `event:` field. For example:\n\n```text\n data: {\"jsonrpc\":\"2.0\",\"id\":\"1\",\"result\":{\"protocolVersion\":\"2025-06-18\",\"capabilities\":{\"tools\":{}},\"serverInfo\":{\"name\":\"test\",\"version\":\"1.0.0\"}}}\n````\n\n4. Start a Spring AI / MCP Java SDK client using `WebClientStreamableHttpTransport`.\n5. Call `client.initialize()` (or let Spring AI auto-initialize the MCP client during startup).\n\n## Expected behavior\n\nThe client should treat an SSE frame without an explicit `event:` field as a default `message` event and parse the JSON-RPC payload normally.\n\nSo the `initialize` response above should be accepted, and client initialization should complete successfully.\n\n## Actual behavior\n\nThe client receives the SSE payload, but the event type is exposed as `null` and is not parsed as a JSON-RPC message.\n\nAs a result, the initialize response is effectively ignored, and initialization times out.\n\nFrom debug logs:\n\n```text\nReceived SSE event with type: ServerSentEvent [id = 'null', event='null', retry=null, comment='null', data={\"jsonrpc\":\"2.0\",\"id\":\"9642da98-0\",\"result\":{\"protocolVersion\":\"2025-06-18\",\"capabilities\":{\"tools\":{}},\"serverInfo\":{\"name\":\"rmcp\",\"version\":\"1.2.0\"},\"instructions\":\"...\"}}]\n...\nCaused by: java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 20000ms\n...\nClient failed to initialize by explicit API call","author":{"url":"https://github.com/nympheon","@type":"Person","name":"nympheon"},"datePublished":"2026-03-27T06:54:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/885/java-sdk/issues/885"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:63de0d86-d45e-7aab-8704-13190fdc03f4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E838:7C5BB:1DDEAB:2C388F:6A61E0CA |
| html-safe-nonce | 0f02aeeeac55e9f69c66f196941e09aa468e9e2686015fdeaf754ceaee119b2b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODM4OjdDNUJCOjFEREVBQjoyQzM4OEY6NkE2MUUwQ0EiLCJ2aXNpdG9yX2lkIjoiODc5MzE5NzEwNzkzMzczMzA2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f4ba7b07481ae8fb7e3d78fc40b94fb769f6d2f37a08a9373987708836826d73 |
| hovercard-subject-tag | issue:4150008173 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/java-sdk/885/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dc3dc70fe84f31689dfb1a221dc8e743fe60aa9bf6594c5798ebba2429168415/modelcontextprotocol/java-sdk/issues/885 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dc3dc70fe84f31689dfb1a221dc8e743fe60aa9bf6594c5798ebba2429168415/modelcontextprotocol/java-sdk/issues/885 |
| og:image:alt | Disclaimer: I am not a native English speaker. This issue was drafted with AI translation assistance. I apologize for any awkward phrasing. Bug description When using the Streamable HTTP transport,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nympheon |
| hostname | github.com |
| expected-hostname | github.com |
| None | b2de8c74e5e61e893155ba46ee41bc66170c1644cb795adefa8386d490f7781c |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/java-sdk git https://github.com/modelcontextprotocol/java-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 919609219 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/java-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 919609219 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/java-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d1866027ded575df8a15c731dd8b9986c9483ceb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width