Fix support for sending server notifications with request-specific McpServer instances used outside their original scope. (#832)

* Fix support for sending server notifications with request-specific McpServer instances used outside their original scope.

* Address feedback.

* Update src/ModelContextProtocol.Core/Server/SseWriter.cs
This commit is contained in:
Eirik Tsarpalis 2025-10-06 18:50:33 +03:00 • committed by GitHub
commit 93834d1aec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -66,6 +66,7 @@ public sealed class SseResponseStreamTransport(Stream sseResponseStream, string?
public async Task SendMessageAsync(JsonRpcMessage message, CancellationToken cancellationToken = default)
{
Throw.IfNull(message);
// If the underlying writer has been disposed, just drop the message.
await _sseWriter.SendMessageAsync(message, cancellationToken).ConfigureAwait(false);
}