Commit c3a0b18
committed
fix: improve SSE event handling to gracefully ignore unrecognized events (modelcontextprotocol#423)
- Replace McpError exceptions with debug/warning logs for unrecognized SSE event types
- Continue processing instead of failing when encountering unknown SSE events
- Update transport implementations:
- WebClientStreamableHttpTransport: return empty tuple instead of throwing
- WebFluxSseClientTransport: complete stream instead of erroring
- HttpClientSseClientTransport: call sink.success() instead of sink.error()
- HttpClientStreamableHttpTransport: return empty Flux for unknown events
This improves client resilience when servers send non-standard or future SSE event types.
Resolves modelcontextprotocol#272 , modelcontextprotocol#223 , modelcontextprotocol#93, modelcontextprotocol#421
Signed-off-by: Christian Tzolov <[email protected]>1 parent 4937fc1 commit c3a0b18
File tree
5 files changed
+37
-6
lines changed- mcp-spring/mcp-spring-webflux/src
- main/java/io/modelcontextprotocol/client/transport
- test/java/io/modelcontextprotocol/client/transport
- mcp/src/main/java/io/modelcontextprotocol/client/transport
5 files changed
+37
-6
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
| 435 | + | |
| 436 | + | |
436 | 437 | | |
437 | 438 | | |
438 | 439 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
| 220 | + | |
220 | 221 | | |
221 | 222 | | |
222 | 223 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
| |||
158 | 164 | | |
159 | 165 | | |
160 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
161 | 188 | | |
162 | 189 | | |
163 | 190 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
| 369 | + | |
| 370 | + | |
373 | 371 | | |
374 | 372 | | |
375 | 373 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
267 | 271 | | |
268 | 272 | | |
269 | 273 | | |
| |||
0 commit comments