You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB
C#

using System;
using System.ComponentModel;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;
using ModelContextProtocol.Server;
using System.Runtime.CompilerServices;
namespace McpStudy.McpServerStdio
{
internal class Program
{
static async Task Main(string[] args)
{
try
{
var builder = Host.CreateApplicationBuilder(args);
builder.Logging.AddConsole(options =>
{
options.LogToStandardErrorThreshold = LogLevel.Trace;
});
builder.Services
.AddMcpServer()
.WithStdioServerTransport()
.WithToolsFromAssembly(typeof(McpStudy.Core.TimeTools).Assembly)
.WithToolsFromAssembly(typeof(McpStudy.McpServerStdio.Program).Assembly);
await builder.Build().RunAsync();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
}
}
}
}