Add HttpServerSessionMode for hybrid stateful/stateless HTTP serving (#1796)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
This commit is contained in:
parent
bba45c44bf
commit
c6a97d94d6
1 changed files with 764 additions and 150 deletions
|
|
@ -74,7 +74,7 @@ Register resource types when building the server:
|
|||
|
||||
```csharp
|
||||
builder.Services.AddMcpServer()
|
||||
.WithHttpTransport(o => o.Stateless = true)
|
||||
.WithHttpTransport(o => o.SessionMode = HttpServerSessionMode.Stateless)
|
||||
.WithResources<MyResources>()
|
||||
.WithResources<DocumentResources>();
|
||||
```
|
||||
|
|
@ -209,8 +209,8 @@ Register subscription handlers when building the server:
|
|||
```csharp
|
||||
builder.Services.AddMcpServer()
|
||||
// Subscriptions require stateful mode because the server pushes change notifications
|
||||
// to clients. Set Stateless = false explicitly for forward compatibility.
|
||||
.WithHttpTransport(o => o.Stateless = false)
|
||||
// to clients. Set SessionMode = HttpServerSessionMode.Stateful since sessions are required.
|
||||
.WithHttpTransport(o => o.SessionMode = HttpServerSessionMode.Stateful)
|
||||
.WithResources<MyResources>()
|
||||
.WithSubscribeToResourcesHandler(async (ctx, ct) =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue