Streamable HTTP resumability + redelivery + SSE polling via server-side disconnect#1077
Streamable HTTP resumability + redelivery + SSE polling via server-side disconnect#1077MackinnonBuck merged 38 commits intomainfrom
Conversation
src/ModelContextProtocol.Core/Protocol/JsonRpcMessageContext.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs
Outdated
Show resolved
Hide resolved
tests/ModelContextProtocol.AspNetCore.Tests/Utils/InMemoryEventStore.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.AspNetCore/HttpServerTransportOptions.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Client/StreamableHttpClientSessionTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Client/StreamableHttpClientSessionTransport.cs
Show resolved
Hide resolved
mikekistler
left a comment
There was a problem hiding this comment.
I didn't get through all of this but want to share the comments I've made so far.
348fac0 to
493062a
Compare
src/ModelContextProtocol.AspNetCore/McpEndpointRouteBuilderExtensions.cs
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.AspNetCore/McpEndpointRouteBuilderExtensions.cs
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs
Outdated
Show resolved
Hide resolved
tests/ModelContextProtocol.AspNetCore.Tests/Utils/KestrelInMemoryTest.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Client/HttpClientTransportOptions.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpPostTransport.cs
Outdated
Show resolved
Hide resolved
…s.cs Co-authored-by: Stephen Halter <halter73@gmail.com>
src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpPostTransport.cs
Outdated
Show resolved
Hide resolved
tests/ModelContextProtocol.AspNetCore.Tests/SseEventStreamStoreTests.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Client/StreamableHttpClientSessionTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Client/StreamableHttpClientSessionTransport.cs
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpPostTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpPostTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpServerTransport.cs
Outdated
Show resolved
Hide resolved
tests/ModelContextProtocol.AspNetCore.Tests/ResumabilityIntegrationTests.cs
Show resolved
Hide resolved
…onTransport.cs Co-authored-by: Stephen Halter <halter73@gmail.com>
halter73
left a comment
There was a problem hiding this comment.
This looks really good. Thanks for responding to all the feedback!
src/ModelContextProtocol.Core/Server/StreamableHttpPostTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpPostTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Server/StreamableHttpPostTransport.cs
Outdated
Show resolved
Hide resolved
Breaking Change Audit (v0.7.0-preview.1 release notes)This PR includes two API breaking changes on
Added the |
Overview
This PR implements the following features:
Last-Event-IDheaderISseEventStreamStoreabstraction to allow for storage and replay of SSE eventsLast-Event-IDheaderEach of these features has been split into its own commit for ease of review.
Description
There are two disconnection scenarios covered by this PR:
If a network error occurs, and an
ISseEventStreamStoreis configured, then the client may attempt to reconnect by making a GET request with aLast-Event-IDheader. The server will then replay stored events before continuing to use the new GET response to stream remaining events. If further disconnections happen, the client may continue to make new GET requests to resume the stream. This applies for both client-initiated requests (POST) and the unsolicited message stream (GET).However, the server can also initiate a disconnection and force the client to poll for updates. This is useful for avoiding long-running streams. This can be done via the new
RequestContext<TParams>.EnablePollingAsync(TimeSpan retryInterval, CancellationToken cancellationToken = default)API. When the client reconnects via GET with aLast-Event-ID, the response will only contain events currently available in theISseEventStreamStorebefore completing. The client must continue initiating new GET requests at the specifiedretryIntervaluntil the final response is received.Fixes #510
Fixes #1020