winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

Program.cs (1333B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="Program.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace WinGetMCPServer
      8 {
      9     using Microsoft.Extensions.DependencyInjection;
     10     using Microsoft.Extensions.Hosting;
     11     using Microsoft.Extensions.Logging;
     12     using ModelContextProtocol.Protocol;
     13 
     14     internal class Program
     15     {
     16         private const string ServerName = "winget-mcp";
     17 
     18         static void Main(string[] args)
     19         {
     20             var builder = Host.CreateApplicationBuilder();
     21             builder.Logging.AddConsole(consoleOptions => { consoleOptions.LogToStandardErrorThreshold = LogLevel.Trace; });
     22 
     23             builder.Services
     24                 .AddMcpServer(configureOptions =>
     25                 {
     26                     // TODO: More options setup?
     27                     configureOptions.ServerInfo = new Implementation() { Name = ServerName, Version = ServerConnection.Instance.Version };
     28                 })
     29                 .WithStdioServerTransport()
     30                 .WithTools<WingetPackageTools>();
     31 
     32             builder.Build().Run();
     33         }
     34     }
     35 }