Add stateless doc, prefer stateless mode and disable legacy SSE by default (#1468)
This commit is contained in:
parent
49bf17077d
commit
8eb4023c20
1 changed files with 1440 additions and 73 deletions
|
|
@ -10,12 +10,18 @@ public class MapMcpSseTests(ITestOutputHelper outputHelper) : MapMcpTests(output
|
|||
protected override bool UseStreamableHttp => false;
|
||||
protected override bool Stateless => false;
|
||||
|
||||
protected override void ConfigureStateless(HttpServerTransportOptions options)
|
||||
{
|
||||
base.ConfigureStateless(options);
|
||||
options.EnableLegacySse = true;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("/mcp")]
|
||||
[InlineData("/mcp/secondary")]
|
||||
public async Task Allows_Customizing_Route(string pattern)
|
||||
{
|
||||
Builder.Services.AddMcpServer().WithHttpTransport();
|
||||
Builder.Services.AddMcpServer().WithHttpTransport(options => options.EnableLegacySse = true);
|
||||
await using var app = Builder.Build();
|
||||
|
||||
app.MapMcp(pattern);
|
||||
|
|
@ -47,7 +53,7 @@ public class MapMcpSseTests(ITestOutputHelper outputHelper) : MapMcpTests(output
|
|||
Name = "TestCustomRouteServer",
|
||||
Version = "1.0.0",
|
||||
};
|
||||
}).WithHttpTransport();
|
||||
}).WithHttpTransport(options => options.EnableLegacySse = true);
|
||||
await using var app = Builder.Build();
|
||||
|
||||
app.MapMcp(routePattern);
|
||||
|
|
@ -77,7 +83,7 @@ public class MapMcpSseTests(ITestOutputHelper outputHelper) : MapMcpTests(output
|
|||
return "Complete";
|
||||
}, options: new() { Name = "polling_tool" });
|
||||
|
||||
Builder.Services.AddMcpServer().WithHttpTransport().WithTools([pollingTool]);
|
||||
Builder.Services.AddMcpServer().WithHttpTransport(options => options.EnableLegacySse = true).WithTools([pollingTool]);
|
||||
|
||||
await using var app = Builder.Build();
|
||||
app.MapMcp();
|
||||
|
|
|
|||
Loading…
Reference in a new issue