add all requirement for XAiMcpServer Implementation ...
This commit is contained in:
@@ -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>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user