Repository navigation
Conversation
The Streamable HTTP transport providers can limit the number of sessions and evict idle sessions (spring-projects#6760), but the auto-configuration does not pass these settings to them. Users have to define their own transport provider bean to change them, and with the auto-configured providers idle sessions are never evicted. Add the spring.ai.mcp.server.streamable-http.max-sessions and spring.ai.mcp.server.streamable-http.session-idle-timeout properties and apply them to the WebMvc and WebFlux transport providers. See spring-projects#6760 Signed-off-by: Armen Petrosyan <liotur.mail@gmail.com>
liotur
force-pushed
the
mcp-streamable-session-limits
branch
from
November 27, 2026 15:43
bbf553c to
ef02ab3
Compare
Author
|
Rebased on current
19/19 in both the WebMvc and WebFlux autoconfiguration ITs; reverting the two builder calls fails 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Streamable HTTP transport providers support
maxSessionsandsessionIdleTimeout(#6760), butMcpServerStreamableHttpWebMvcAutoConfigurationandMcpServerStreamableHttpWebFluxAutoConfigurationdon't set them. They can only be changed by defining a custom transport provider bean, and with the auto-configured providers idle sessions are never evicted. #6860 reports sessions that stay open after clients disconnect without sendingDELETE.This adds two properties and applies them to both providers:
spring.ai.mcp.server.streamable-http.max-sessions, default100000(the transport's default)spring.ai.mcp.server.streamable-http.session-idle-timeout, not set by default, so idle sessions are only evicted when it is configuredThe transport's check that the idle timeout must be greater than the keep-alive interval is enforced at startup. The reference docs describe both properties in a new Session Limits section.
See #6760