You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix idle session docs and clean up DI scope language
Any active HTTP request (POST or GET) prevents a session from being
counted as idle, not just GET/SSE. Fix docs and API comment on
MaxIdleSessionCount. Also remove redundant 'async' from 'async scope'
in DI documentation since nearly all ASP.NET Core scopes are async.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/concepts/sessions/sessions.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,7 +159,7 @@ The server tracks the last activity time for each session. Activity is recorded
159
159
160
160
Sessions that have no activity for the duration of <xref:ModelContextProtocol.AspNetCore.HttpServerTransportOptions.IdleTimeout> (default: **2 hours**) are automatically closed. The idle timeout is checked in the background every 5 seconds.
161
161
162
-
A client can keep its session alive by maintaining an open `GET` request (SSE stream). Sessions with an active`GET`request are never considered idle.
162
+
A client can keep its session alive by maintaining any open HTTP request (e.g., a long-running POST with a streamed response or an open`GET`for unsolicited messages). Sessions with active requests are never considered idle.
163
163
164
164
When a session times out:
165
165
@@ -177,7 +177,7 @@ You can disable idle timeout by setting it to `Timeout.InfiniteTimeSpan`, though
177
177
- The oldest idle sessions are terminated (even if they haven't reached their idle timeout)
178
178
- Termination continues until the idle count is back below the limit
179
179
180
-
Sessions with an active `GET` request (open SSE stream) don't count toward this limit.
180
+
Sessions with any active HTTP request don't count toward this limit.
181
181
182
182
#### Termination
183
183
@@ -305,7 +305,7 @@ How the server resolves scoped services depends on the transport and session mod
305
305
306
306
#### Stateful HTTP
307
307
308
-
In stateful mode, the server's <xref:ModelContextProtocol.McpServer.Services> is the application-level `IServiceProvider` — not a per-request scope. Because the server outlives individual HTTP requests, <xref:ModelContextProtocol.Server.McpServerOptions.ScopeRequests> defaults to `true`: each handler invocation (tool call, resource read, etc.) creates a new async scope via `IServiceScopeFactory.CreateAsyncScope()`. The scoped `IServiceProvider` is available on <xref:ModelContextProtocol.Server.RequestContext`1.Services>.
308
+
In stateful mode, the server's <xref:ModelContextProtocol.McpServer.Services> is the application-level `IServiceProvider` — not a per-request scope. Because the server outlives individual HTTP requests, <xref:ModelContextProtocol.Server.McpServerOptions.ScopeRequests> defaults to `true`: each handler invocation (tool call, resource read, etc.) creates a new scope.
0 commit comments