-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathProgram.cs
More file actions
40 lines (33 loc) · 1.56 KB
/
Program.cs
File metadata and controls
40 lines (33 loc) · 1.56 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
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using DecompilerServer.Services;
namespace DecompilerServer;
public partial class Program
{
public static async Task Main(string[] args)
{
var builder = Host.CreateApplicationBuilder(args);
builder.Logging.ClearProviders();
builder.Logging.AddProvider(new StderrLoggerProvider());
builder.Logging.SetMinimumLevel(LogLevel.Information);
// builder.Logging.AddFilter("Microsoft.Hosting.Lifetime", LogLevel.Warning);
// builder.Logging.AddFilter("ModelContextProtocol", LogLevel.Warning);
builder.Services.AddHostedService<StartupLogService>();
// Register DecompilerServer services as singletons for state persistence
builder.Services.AddSingleton<AssemblyContextManager>();
builder.Services.AddSingleton<MemberResolver>();
builder.Services.AddSingleton<DecompilerService>();
builder.Services.AddSingleton<UsageAnalyzer>();
builder.Services.AddSingleton<InheritanceAnalyzer>();
builder.Services.AddSingleton<ResponseFormatter>();
builder.Services
.AddMcpServer() // core MCP server services
.WithStdioServerTransport() // Codex talks to STDIO servers
.WithToolsFromAssembly(); // auto-discover [McpServerTool]s in this assembly
var app = builder.Build();
// Initialize service locator
ServiceLocator.SetServiceProvider(app.Services);
await app.RunAsync();
}
}