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
|
|
@ -3,6 +3,7 @@ using EverythingServer.Prompts;
|
|||
using EverythingServer.Resources;
|
||||
using EverythingServer.Tools;
|
||||
using Microsoft.Extensions.AI;
|
||||
using ModelContextProtocol.AspNetCore;
|
||||
using ModelContextProtocol;
|
||||
using ModelContextProtocol.Protocol;
|
||||
using ModelContextProtocol.Server;
|
||||
|
|
@ -58,8 +59,8 @@ builder.Services
|
|||
.WithHttpTransport(options =>
|
||||
{
|
||||
// This sample uses subscriptions, SampleLlmTool (sampling), and RunSessionHandler.
|
||||
// Set Stateless = false explicitly for forward compatibility in case the default changes.
|
||||
options.Stateless = false;
|
||||
// Set SessionMode = HttpServerSessionMode.Stateful since sessions are required for sampling.
|
||||
options.SessionMode = HttpServerSessionMode.Stateful;
|
||||
|
||||
// Add a RunSessionHandler to remove all subscriptions for the session when it ends
|
||||
#pragma warning disable MCPEXP002 // RunSessionHandler is experimental
|
||||
|
|
|
|||
Loading…
Reference in a new issue