-
Notifications
You must be signed in to change notification settings - Fork 368
Add stateless Streamable HTTP support #392
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
- This allows a single MCP session spanning multiple requests to be handled by different servers without sharing state - This does require the servers share data protection keys, but this is standard for ASP.NET Core cookies and antiforgery as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes are necessary on the client?
src/ModelContextProtocol.AspNetCore/HttpServerTransportOptions.cs
Outdated
Show resolved
Hide resolved
Any ETA on this getting merged and a new package released? Happy to help test, I can replicate the issue this resolves pretty easily. |
We're looking at getting out on NuGet early next week. Hopefully, Monday. I want to resolve some issues like sampling requests currently hanging on the server rather than producing a clear error that sampling is not supported in stateless mode, since there is no guarantee that the sampling response will come back to the same server process like we expect in the default stateful scenario. If you want to test this before then, I welcome you cloning https://github.com/halter73/csharp-sdk/tree/stateless and trying it out yourself. Maybe you can provide feedback to improve it before we ship it on NuGet.
What issue are you referring to specifically? I'm just curious. This resolves a couple issues like running behind a non-sticky load balancer and supporting indefinite sessions that outlive even a server restart. It's a tradeoff since it doesn't support some features like sampling and roots, but that's a tradeoff I think many MCP server developers will be willing to take. |
Sorry, should have specified that in my original response. It's the scenario when running multiple replicas without affinity. Since these MCP servers live a number of layers down in our service stack it's difficult to affinitize requests all the way through. Until I saw your changes, we were looking at hooking in either some sort of intelligent router or a distributed session store (if we could plumb it in somehow). Your changes are a much simpler way to solve it. |
- Don't store client capabilities in stateless session ID since sampling and roots cannot be supported in stateless mode - Immediate throw for unsupported operations in stateless mode - Improve HttpTransportOptions doc comments
I don't think we have an issue tracking this precisely, but this has been previously discussed in #347 and #330 (comment)