add all requirement for XAiMcpServer Implementation ...

This commit is contained in:
2026-11-05 10:43:38 +03:30
parent 2b99958f4c
commit e9a5e24943
8 changed files with 645 additions and 18 deletions
+23
View File
@@ -1,3 +1,6 @@
using System;
using System.Linq;
using System.Reflection;
using xAiService.Services;
using xAiService.Interfaces;
using Microsoft.Extensions.DependencyInjection;
@@ -14,6 +17,26 @@ namespace xAiService.Extensions
this IServiceCollection source
)
{
//
// Register MCP Tool Scanner ...
source.AddSingleton(sp =>
{
//
// Scan All Exists Assemblies ...
var asms = AppDomain.CurrentDomain
.GetAssemblies()
.Where(a => !a.IsDynamic &&
a.GetName().Name != null &&
a.GetName().Name!.StartsWith("xAi", StringComparison.OrdinalIgnoreCase))
.Append(Assembly.GetEntryAssembly()!)
.ToArray();
//
return new XAiMcpToolScanner(asms);
});
//
// 2) Register MCP Handler ...
source.AddScoped<IXAiMcpHandler, XAiMcpHandler>();
}
}