Table of Contents

Interface ISseEventStreamStore

Namespace
ModelContextProtocol.Server
Assembly
ModelContextProtocol.Core.dll

Provides storage and retrieval of SSE event streams, enabling resumability and redelivery of events.

public interface ISseEventStreamStore

Methods

CreateStreamAsync(SseEventStreamOptions, CancellationToken)

Creates a new SSE event stream with the specified options.

ValueTask<ISseEventStreamWriter> CreateStreamAsync(SseEventStreamOptions options, CancellationToken cancellationToken = default)

Parameters

options SseEventStreamOptions

The configuration options for the new stream.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

ValueTask<ISseEventStreamWriter>

A writer for the newly created event stream.

GetStreamReaderAsync(string, CancellationToken)

Gets a reader for an existing event stream based on the last event ID.

ValueTask<ISseEventStreamReader?> GetStreamReaderAsync(string lastEventId, CancellationToken cancellationToken = default)

Parameters

lastEventId string

The ID of the last event received by the client, used to resume from that point.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

ValueTask<ISseEventStreamReader>

A reader for the event stream, or null if no matching stream is found.