Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
24 lines
662 B
C#
24 lines
662 B
C#
using Logging.Tools;
|
|
using ModelContextProtocol.AspNetCore;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddMcpServer()
|
|
.WithHttpTransport(options =>
|
|
{
|
|
// Log streaming requires stateful mode because the server pushes log notifications
|
|
// to clients. Set SessionMode = HttpServerSessionMode.Stateful since it's required.
|
|
options.SessionMode = HttpServerSessionMode.Stateful;
|
|
})
|
|
.WithTools<LoggingTools>();
|
|
// .WithSetLoggingLevelHandler(async (ctx, ct) => new EmptyResult());
|
|
|
|
var app = builder.Build();
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.MapMcp();
|
|
|
|
app.Run();
|