Skip to content

Add DeleteStreamsForSessionAsync to ISseEventStreamStore #1287

@mikekistler

Description

@mikekistler

Is your feature request related to a problem? Please describe.

When an MCP session ends, the SSE event streams stored by ISseEventStreamStore for that session are not proactively cleaned up. They persist until cache expiration removes them. This wastes storage, especially in high-throughput scenarios with many short-lived sessions.

Describe the solution you'd like

Add a DeleteStreamsForSessionAsync(string sessionId, CancellationToken) method to ISseEventStreamStore that deletes all stored streams and their associated events for a given session.

Describe alternatives you've considered

An alternative is to rely solely on cache expiration to keep resource consumption low. Since it is relatively easy to catch session terminations (with RunSessionHandler), it seems reasonable to provide a means to delete the streams for this session since they are known to be no longer needed.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions