Commit e82fee0
committed
fix: keep connection open for keep-alive ping in responseStream
After sending a response in responseStream(), if no listening stream
exists yet (i.e., the client hasn't established a GET SSE connection),
promote the current response stream to a listening stream instead of
closing it. This allows KeepAliveScheduler to send periodic ping
messages through the transport.
Clients like Cursor that don't establish a separate GET listening
stream would otherwise have the connection closed immediately after
each response, causing the MCP server to appear as disconnected
after the idle-timeout period.
Fixes #6811 parent 46bacda commit e82fee0
File tree
1 file changed
+26
-2
lines changed- mcp-core/src/main/java/io/modelcontextprotocol/spec
1 file changed
+26
-2
lines changedLines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
192 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
193 | 217 | | |
194 | 218 | | |
195 | 219 | | |
| |||
0 commit comments