add: hci
This commit is contained in:
24
Program.cs
24
Program.cs
@@ -1,29 +1,19 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ModelContextProtocol.Server;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using Alchegos.MCP.Tools;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
const int BIND_PORT = 5050;
|
||||
|
||||
builder.Services
|
||||
.AddMcpServer()
|
||||
.WithHttpTransport()
|
||||
.WithToolsFromAssembly();
|
||||
builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(5050));
|
||||
builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(BIND_PORT));
|
||||
//builder.Services.AddHttpLogging(o => { });
|
||||
var app = builder.Build();
|
||||
|
||||
// var logger = app.Logger;
|
||||
//app.UseHttpLogging();
|
||||
app.UseRequestBodyLogging();
|
||||
|
||||
app.MapMcp();
|
||||
|
||||
app.Run();
|
||||
|
||||
[McpServerToolType]
|
||||
public static class EchoTool
|
||||
{
|
||||
[McpServerTool, Description("Echoes the message back to the client.")]
|
||||
public static string Echo(string message) => $"hello {message}";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user