Configure hosted stdio servers to log to stderr (#173)
* Configure hosted stdio servers to log to stderr * Fix newline * Use CreateApplicationBuilder where possible * Address PR feedback
This commit is contained in:
parent
19eed91c53
commit
8dc1f5d096
1 changed files with 27 additions and 6 deletions
|
|
@ -1,13 +1,19 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
var builder = Host.CreateEmptyApplicationBuilder(settings: null);
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
builder.Services.AddMcpServer()
|
||||
.WithStdioServerTransport()
|
||||
.WithToolsFromAssembly();
|
||||
|
||||
builder.Logging.AddConsole(options =>
|
||||
{
|
||||
options.LogToStandardErrorThreshold = LogLevel.Trace;
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton(_ =>
|
||||
{
|
||||
var client = new HttpClient() { BaseAddress = new Uri("https://api.weather.gov") };
|
||||
|
|
|
|||
Loading…
Reference in a new issue