Add stateless doc, prefer stateless mode and disable legacy SSE by default (#1468)
This commit is contained in:
parent
49bf17077d
commit
8eb4023c20
2 changed files with 1440 additions and 73 deletions
|
|
@ -46,7 +46,7 @@ MCP servers that implement the Logging utility must declare this in the capabili
|
|||
[Initialization]: https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle#initialization
|
||||
|
||||
Servers built with the C# SDK always declare the logging capability. Doing so does not obligate the server
|
||||
to send log messages—only allows it. Note that stateless MCP servers might not be capable of sending log
|
||||
to send log messages—only allows it. Note that [stateless](xref:stateless) MCP servers might not be capable of sending log
|
||||
messages as there might not be an open connection to the client on which the log messages could be sent.
|
||||
|
||||
The C# SDK provides an extension method <xref:Microsoft.Extensions.DependencyInjection.McpServerBuilderExtensions.WithSetLoggingLevelHandler*> on <xref:Microsoft.Extensions.DependencyInjection.IMcpServerBuilder> to allow the
|
||||
|
|
|
|||
|
|
@ -6,8 +6,11 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
|
||||
builder.Services.AddMcpServer()
|
||||
.WithHttpTransport(options =>
|
||||
options.IdleTimeout = Timeout.InfiniteTimeSpan // Never timeout
|
||||
)
|
||||
{
|
||||
// Log streaming requires stateful mode because the server pushes log notifications
|
||||
// to clients. Set Stateless = false explicitly for forward compatibility.
|
||||
options.Stateless = false;
|
||||
})
|
||||
.WithTools<LoggingTools>();
|
||||
// .WithSetLoggingLevelHandler(async (ctx, ct) => new EmptyResult());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue