-
-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathProgram.cs
More file actions
42 lines (34 loc) · 1.4 KB
/
Program.cs
File metadata and controls
42 lines (34 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using Azure.Monitor.OpenTelemetry.AspNetCore;
using Havit.Blazor.Documentation.Mcp.Diagnostics;
using Havit.Blazor.Documentation.Mcp.Tools;
using Havit.Blazor.Documentation.Services;
using OpenTelemetry;
var builder = WebApplication.CreateBuilder(args);
OpenTelemetryBuilder openTelemetry = builder.Services
.AddOpenTelemetry()
.WithTracing(tracing => tracing.AddSource(McpToolActivitySource.Name));
if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
{
openTelemetry.UseAzureMonitor();
}
builder.Services.AddSingleton<IDocXmlProvider, DocXmlProvider>();
builder.Services.AddSingleton<IApiDocModelBuilder, ApiDocModelBuilder>();
builder.Services.AddSingleton<IApiDocModelProvider, ApiDocModelProvider>();
builder.Services.AddSingleton<IDocMarkdownRenderer, DocMarkdownRenderer>();
builder.Services.AddSingleton<IComponentDemosProvider, ComponentDemosProvider>();
builder.Services.AddSingleton<IDocumentationCatalogService, DocumentationCatalogService>();
builder.Services
.AddMcpServer()
.WithHttpTransport(options =>
{
options.Stateless = true;
})
.WithTools<GetComponentDocsTool>()
.WithTools<GetComponentCatalogTool>()
.WithTools<GetComponentSamplesTool>()
.WithTools<GetTypeDocTool>();
var app = builder.Build();
app.MapMcp();
// for Azure Load Balancer probes etc. (MCP is POST)
app.MapGet("/", () => Results.Text("HAVIT Blazor Documentation MCP Server"));
app.Run();