using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using OpenNest.Mcp; var builder = Host.CreateApplicationBuilder(args); // stdout carries the JSON-RPC stream; console logs must go to stderr or they corrupt it. builder.Logging.AddConsole(o => o.LogToStandardErrorThreshold = LogLevel.Trace); builder.Services.AddSingleton(); builder .Services.AddMcpServer() .WithStdioServerTransport() .WithToolsFromAssembly(typeof(Program).Assembly); var app = builder.Build(); await app.RunAsync();