Commit e001542
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 e001542
File tree
1 file changed
+21
-2
lines changed- mcp-core/src/main/java/io/modelcontextprotocol/spec
1 file changed
+21
-2
lines changedLines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
175 | 185 | | |
176 | 186 | | |
177 | 187 | | |
| |||
189 | 199 | | |
190 | 200 | | |
191 | 201 | | |
192 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
193 | 212 | | |
194 | 213 | | |
195 | 214 | | |
| |||
0 commit comments