Update last Feature Completion, MCP Server ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+73
-31
@@ -1,14 +1,9 @@
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\xAiMcpServer\Program.cs
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Program.cs
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace xAiMcpServer
|
||||
{
|
||||
@@ -16,19 +11,29 @@ namespace xAiMcpServer
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
//
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
|
||||
//
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||
{
|
||||
//
|
||||
var result = Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\xAiMcpServer\Startup.cs
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Startup.cs
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -38,6 +43,7 @@ using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
using xIdentityService.DI;
|
||||
using xCommons.Extensions;
|
||||
using xAiService.Extensions;
|
||||
using xCommons.Configurations;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@@ -60,6 +66,10 @@ namespace xAiMcpServer
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
//
|
||||
// Register MCP Handler ...
|
||||
services.AddXAiMcpHandler();
|
||||
|
||||
//
|
||||
// Register Validation Provider and all XCommons Module Services ...
|
||||
services.AddXCommons(Configuration);
|
||||
@@ -118,7 +128,10 @@ namespace xAiMcpServer
|
||||
);
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
public void Configure(
|
||||
IApplicationBuilder app,
|
||||
IWebHostEnvironment env
|
||||
)
|
||||
{
|
||||
//
|
||||
// Configure the HTTP request pipeline ...
|
||||
@@ -168,15 +181,36 @@ namespace xAiMcpServer
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\xAiMcpServer\Controllers\StartupController.cs
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Controllers\McpController.cs
|
||||
|
||||
using xCommons.Providers;
|
||||
using xAiService.Interfaces;
|
||||
using xAiService.Controllers;
|
||||
using xCommons.Configurations;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace xAiMcpServer.Controllers
|
||||
{
|
||||
public class McpController : XAiMcpControllerBase
|
||||
{
|
||||
public McpController(
|
||||
IXAiMcpHandler mcpHandler,
|
||||
ILogger<McpController> logger,
|
||||
XAppConfiguration appConfiguration,
|
||||
IXIdentityProvider identityProvider,
|
||||
XValidationProvider validationProvider
|
||||
) : base(mcpHandler, appConfiguration, identityProvider, logger, validationProvider)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Controllers\StartupController.cs
|
||||
|
||||
using xCommons.Providers;
|
||||
using xCommons.Extensions;
|
||||
using xCommons.Controllers;
|
||||
using xExceptions.Constants;
|
||||
using xCommons.Configurations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
@@ -216,25 +250,10 @@ namespace xAiApi.Controllers
|
||||
//
|
||||
return Ok(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Global Exception Handler Endpoint (Production) ...
|
||||
/// Returns a Generic Error without Leaking Exception Details ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[Route("error")]
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public virtual ActionResult Error()
|
||||
{
|
||||
//
|
||||
var error = XException.ActionFailed.ToXError();
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\xAiMcpServer\DI\DiExtensions.cs
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\DI\DiExtensions.cs
|
||||
|
||||
using xIdentityHelper;
|
||||
using xCommons.Extensions;
|
||||
@@ -322,3 +341,26 @@ namespace xAiMcpServer.DI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Tools\XEchoTools.cs
|
||||
|
||||
|
||||
using xAiModels.Attributes;
|
||||
|
||||
namespace xAiMcpServer.Tools
|
||||
{
|
||||
[XAiMcpToolType]
|
||||
public static class XEchoTools
|
||||
{
|
||||
[XAiMcpTool(Description = "Echoes the string back to the client give message in string")]
|
||||
public static string Echo(
|
||||
[XAiMcpToolParam(Description = "string value which specified message")]
|
||||
string message
|
||||
)
|
||||
{
|
||||
//
|
||||
var result = $"hello {message}";
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
+285
-222
File diff suppressed because it is too large
Load Diff
@@ -1,84 +0,0 @@
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiService\Constants\ConfigurationNodeNames.cs
|
||||
|
||||
namespace xAiService.Constants
|
||||
{
|
||||
public partial struct ConfigurationNodeNames
|
||||
{
|
||||
public const string AI_SERVICE_NODE = "AIServiceConfiguration";
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiService\Constants\XAiServiceConstants.cs
|
||||
|
||||
namespace xAiService.Constants
|
||||
{
|
||||
public struct XAiServiceConstants
|
||||
{
|
||||
//
|
||||
// Service Extensions Log Tag ...
|
||||
public const string XAiServiceDILogTag = "XAiService";
|
||||
|
||||
//
|
||||
// File Provider Identifiers ...
|
||||
public const string XAiProjectFilesIdentifier = "AiPrjF";
|
||||
public const string XAiMessageFilesIdentifier = "AiMsgF";
|
||||
public const string XMetaDataFileIdsIdentifier = "FileIds";
|
||||
public const string XAiConversationFilesIdentifier = "AiCnvrF";
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiService\DI\XDIHelperExtension.cs
|
||||
|
||||
namespace xAiService.DI
|
||||
{
|
||||
public static partial class XDIHelperExtension
|
||||
{ }
|
||||
}
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiService\Extensions\XAiServiceExtensions.cs
|
||||
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using xIdentityModels.Models;
|
||||
|
||||
namespace xAiService.Extensions
|
||||
{
|
||||
public static class XAiServiceExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Validate User Info ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsValid(this XUserClaimsInfoDto source)
|
||||
{
|
||||
//
|
||||
var result =
|
||||
!source.IsNullOrDefault() &&
|
||||
!source.UserId.IsNullOrEmpty() &&
|
||||
!source.AccessToken.IsNullOrEmpty();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate User Info ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="invalidException"></param>
|
||||
public static void Validate(
|
||||
this XUserClaimsInfoDto source,
|
||||
XException invalidException = XException.InvalidArgs
|
||||
)
|
||||
{
|
||||
//
|
||||
var isValid = source.IsValid();
|
||||
if (!isValid)
|
||||
{
|
||||
invalidException.Throw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user