csharp-sdk/docs/concepts/progress/samples/server/Program.cs
pardhu c6a97d94d6
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>
2026-08-12 23:36:36 -07:00

26 lines
518 B
C#

using ModelContextProtocol.AspNetCore;
using Progress.Tools;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddMcpServer()
.WithHttpTransport(options =>
{
options.SessionMode = HttpServerSessionMode.Stateless;
})
.WithTools<LongRunningTools>();
builder.Logging.AddConsole(options =>
{
options.LogToStandardErrorThreshold = LogLevel.Information;
});
var app = builder.Build();
app.UseHttpsRedirection();
app.MapMcp();
app.Run();