-
Notifications
You must be signed in to change notification settings - Fork 372
Send DELETE request when closing a Streamable HTTP session on the client #501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/ModelContextProtocol.Core/Client/StreamableHttpClientSessionTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Client/StreamableHttpClientSessionTransport.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Client/StreamableHttpClientSessionTransport.cs
Outdated
Show resolved
Hide resolved
- Catch and log errors - Send _negotiatedProtocolVersion
…sposed multiple times - This is the same approach we use in McpEndpoint and SseWriter - I went for a minimal change, but I can copy this to TransportBase if we like to use it for all derived types - We could also update AutoDetectingClientSessionTransport.InitializeAsync to avoid this, but we shouldn't have to
I updated this PR to now log any exceptions that might be thrown while sending the delete request. I also included a fix for #512 so we don't have to wait on the auth PR. I scoped the ODE fix down to the StreamableHttpClientSessionTransport for now, but I could move this down to TransportBase in a later PR if we like the approach. And finally, I also included a workaround for the race in Kestrel I describe in dotnet/aspnetcore#62385 that was causing some of our tests to hang. Until Kestrel is fixed, Kestrel may still think that it's waiting on the client to close the connection during shutdown causing Kestrel to unnecessarily wait an extra 30 seconds when the race condition occurs, but at least the tests should finish. |
src/ModelContextProtocol.Core/Client/StreamableHttpClientSessionTransport.cs
Outdated
Show resolved
Hide resolved
…onTransport.cs Co-authored-by: Stephen Toub <[email protected]>
This updates StreamableHttpClientSessionTransport.DisposeAsyncto send a delete request.
https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http