AspNetCoreMcpServer 能加到 dify 中
This commit is contained in:
20
AspNetCoreMcpServer/Program.cs
Normal file
20
AspNetCoreMcpServer/Program.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using AspNetCoreMcpServer.Resources;
|
||||
using AspNetCoreMcpServer.Tools;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// 添加 HttpClientFactory 支持
|
||||
builder.Services.AddHttpClient();
|
||||
|
||||
builder.Services.AddMcpServer()
|
||||
.WithHttpTransport()
|
||||
.WithTools<EchoTool>()
|
||||
.WithTools<SampleLlmTool>()
|
||||
.WithTools<WeatherTools>()
|
||||
.WithTools<IotDeviceTools>()
|
||||
.WithResources<SimpleResourceType>();
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
app.MapMcp();
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user