Skip to content

Commit 040d26a

Browse files
halter73Copilot
andcommitted
Tone down ScopeRequests=false guidance
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b856d84 commit 040d26a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/concepts/sessions/sessions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ This means:
333333

334334
The stdio transport creates a single server for the lifetime of the process. The server's <xref:ModelContextProtocol.McpServer.Services> is the application-level `IServiceProvider`. By default, <xref:ModelContextProtocol.Server.McpServerOptions.ScopeRequests> is `true`, so each handler invocation gets its own scope — the same behavior as stateful HTTP.
335335

336-
You can set <xref:ModelContextProtocol.Server.McpServerOptions.ScopeRequests> to `false` if you want handlers to resolve services directly from the root container. This can be useful for performance-sensitive scenarios where scope creation overhead matters, but be aware that scoped services will then behave like singletons for the lifetime of the process.
336+
You can set <xref:ModelContextProtocol.Server.McpServerOptions.ScopeRequests> to `false` if you want handlers to resolve services directly from the root container. This is a rare, advanced option — similar to how ASP.NET Core itself supports opting out of per-request scopes — and is generally not recommended because scoped services will then behave like singletons for the lifetime of the process, which most scoped registrations don't expect.
337337

338338
```csharp
339339
builder.Services.AddMcpServer(options =>

0 commit comments

Comments
 (0)