Compare commits
9
Commits
9b82acaf55
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1cc28edc6 | ||
|
|
be08a4d287 | ||
|
|
98f6af7ce5 | ||
|
|
0bc45bd8b9 | ||
|
|
63b922f09b | ||
|
|
1b09b4f6a0 | ||
|
|
6e4ce28832 | ||
|
|
b26da81560 | ||
|
|
2c9b10f643 |
@@ -1,6 +1,7 @@
|
||||
#
|
||||
bin/*
|
||||
obj/*
|
||||
Logs
|
||||
|
||||
#
|
||||
Db/*
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace xAiMcpServer.Configurations
|
||||
{
|
||||
public class XAiMcpLinkExtractionToolConfiguration
|
||||
{
|
||||
public int MaxLinks { get; set; }
|
||||
public int MaxChars { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
namespace xAiMcpServer.Configurations
|
||||
{
|
||||
/// <summary>
|
||||
/// Web Search Tool Configuration ...
|
||||
/// </summary>
|
||||
public class XAiMcpWebSearchToolConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// Region for Search ...
|
||||
/// </summary>
|
||||
public string Region {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Timeout ...
|
||||
/// </summary>
|
||||
public int TimeoutSeconds {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Cache TTL ...
|
||||
/// </summary>
|
||||
public int CacheTtlSeconds {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Main Endpoint Url for Search ...
|
||||
/// </summary>
|
||||
public string HtmlEndpoint {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Fallback Endpoint Url ...
|
||||
/// </summary>
|
||||
public string LiteEndpoint {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Selected Result items ...
|
||||
/// </summary>
|
||||
public int DefaultMaxResults {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Enable Falling Back ...
|
||||
/// </summary>
|
||||
public bool EnableLiteFallback {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Min Delay betwen two Requests ...
|
||||
/// </summary>
|
||||
public int MinDelayMilliseconds {get; set;}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace xAiMcpServer.Constants
|
||||
{
|
||||
public partial struct ConfigurationNodeNames
|
||||
{
|
||||
public const string WEB_SEARCH_TOOL_NODE = "WebSearchToolConfiguration";
|
||||
public const string LINK_EXTRACTION_TOOL_NODE = "LinkExtractionToolConfiguration";
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
using xIdentityHelper;
|
||||
using System.Threading;
|
||||
using xCommons.Providers;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using xAiService.Interfaces;
|
||||
using System.Threading.Tasks;
|
||||
using xAiService.Controllers;
|
||||
using xCommons.Configurations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xIdentityHelper;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace xAiMcpServer.Controllers
|
||||
{
|
||||
@@ -40,6 +40,10 @@ namespace xAiMcpServer.Controllers
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var result = await base
|
||||
.HandleMcp(
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using xCommons.Providers;
|
||||
using xCommons.Configurations;
|
||||
using xIdentityHelper.Controllers;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace xAiMcpServer.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Test all Authentication Policies ...
|
||||
/// </summary>
|
||||
public class TestIdentity : XTestIdentityControllerBase {
|
||||
public TestIdentity (
|
||||
ILogger<TestIdentity> logger,
|
||||
XAppConfiguration appConfiguration,
|
||||
IXIdentityProvider identityProvider,
|
||||
XValidationProvider validationProvider
|
||||
) : base (
|
||||
logger,
|
||||
appConfiguration,
|
||||
identityProvider,
|
||||
validationProvider
|
||||
) { }
|
||||
}
|
||||
}
|
||||
+213
-7
@@ -1,28 +1,32 @@
|
||||
using System.Linq;
|
||||
using xIdentityHelper;
|
||||
using xAiMcpServer.Tools;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using xCommons.Authorization;
|
||||
using xAiMcpServer.Constants;
|
||||
using xAiMcpServer.Providers;
|
||||
using xAiMcpServer.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xIdentityService.Interfaces;
|
||||
using xAiMcpServer.Configurations;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using xAiMcpServer.Tools;
|
||||
|
||||
namespace xAiMcpServer.DI
|
||||
{
|
||||
public static class DiExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Register Authorization Policies
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="policies"></param>
|
||||
public static void AddXAuthorization(
|
||||
this IServiceCollection services,
|
||||
IDictionary<string, AuthorizationPolicy> policies = null
|
||||
)
|
||||
{
|
||||
//
|
||||
var policyHandler = services.GetRegisteredService<IXPolicyHandler>();
|
||||
services.AddAuthorization(options =>
|
||||
{
|
||||
//
|
||||
@@ -36,6 +40,26 @@ namespace xAiMcpServer.DI
|
||||
{
|
||||
var policyDescriptor = policiesEnumerator.Current;
|
||||
options.AddPolicy(policyDescriptor.Key, policyDescriptor.Value);
|
||||
|
||||
//
|
||||
// Add Policy to Policy Handler ...
|
||||
if (!policyHandler.IsNull())
|
||||
{
|
||||
//
|
||||
// Check Policy is RequiredRole Policy ...
|
||||
var roleRequirements = policyDescriptor.Value.Requirements
|
||||
.OfType<RequiredRolesRequirement>()
|
||||
.FirstOrDefault();
|
||||
if (!roleRequirements.IsNull() &&
|
||||
roleRequirements.Roles.HasChild())
|
||||
{
|
||||
//
|
||||
policyHandler.AddPolicy(
|
||||
policy: policyDescriptor.Key.ToNormalString(),
|
||||
requiredRoles: roleRequirements.Roles.Select(r => r.ToNormalString())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,8 +74,32 @@ namespace xAiMcpServer.DI
|
||||
{
|
||||
while (policiesEnumerator.MoveNext())
|
||||
{
|
||||
//
|
||||
var policyDescriptor = policiesEnumerator.Current;
|
||||
|
||||
//
|
||||
// Add Policy to Authorization ...
|
||||
options.AddPolicy(policyDescriptor.Key, policyDescriptor.Value);
|
||||
|
||||
//
|
||||
// Add Policy to Policy Handler ...
|
||||
if (!policyHandler.IsNull())
|
||||
{
|
||||
//
|
||||
// Check Policy is RequiredRole Policy ...
|
||||
var roleRequirements = policyDescriptor.Value.Requirements
|
||||
.OfType<RequiredRolesRequirement>()
|
||||
.FirstOrDefault();
|
||||
if (!roleRequirements.IsNull() &&
|
||||
roleRequirements.Roles.HasChild())
|
||||
{
|
||||
//
|
||||
policyHandler.AddPolicy(
|
||||
policy: policyDescriptor.Key.ToNormalString(),
|
||||
requiredRoles: roleRequirements.Roles.Select(r => r.ToNormalString())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,14 +132,172 @@ namespace xAiMcpServer.DI
|
||||
source.UseForwardedHeaders(forwardOptions);
|
||||
}
|
||||
|
||||
//
|
||||
#region WebSearchTool ...
|
||||
/// <summary>
|
||||
/// Extract Web Search Tool Configuration ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static XAiMcpWebSearchToolConfiguration GetXAiMcpWebSearchToolConfiguration(
|
||||
this IConfiguration source
|
||||
)
|
||||
{
|
||||
//
|
||||
XAiMcpWebSearchToolConfiguration result = null;
|
||||
|
||||
//
|
||||
var section = source.GetSection(ConfigurationNodeNames.WEB_SEARCH_TOOL_NODE);
|
||||
if (!section.IsNull())
|
||||
{
|
||||
result = section.Get<XAiMcpWebSearchToolConfiguration>();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inject Web Search MCP Tool Configuration and Register it ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="configuration"></param>
|
||||
public static void AddXAiMcpWebSearchToolConfiguration(
|
||||
this IServiceCollection source,
|
||||
IConfiguration configuration
|
||||
)
|
||||
{
|
||||
//
|
||||
var config = configuration.GetXAiMcpWebSearchToolConfiguration();
|
||||
source.AddXAiMcpWebSearchToolConfiguration(config);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register Web Search MCP Tool Configuration ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="configuration"></param>
|
||||
public static void AddXAiMcpWebSearchToolConfiguration(
|
||||
this IServiceCollection source,
|
||||
XAiMcpWebSearchToolConfiguration configuration
|
||||
)
|
||||
{
|
||||
//
|
||||
if (configuration.IsNull())
|
||||
{
|
||||
XException.InvalidConfiguration.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
source.AddSingleton(configuration);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region LinkExtractionTool ...
|
||||
/// <summary>
|
||||
/// Extract Link Extraction Tool Configuration ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static XAiMcpLinkExtractionToolConfiguration GetXAiMcpLinkExtractionToolConfiguration(
|
||||
this IConfiguration source
|
||||
)
|
||||
{
|
||||
//
|
||||
XAiMcpLinkExtractionToolConfiguration result = null;
|
||||
|
||||
//
|
||||
var section = source.GetSection(ConfigurationNodeNames.LINK_EXTRACTION_TOOL_NODE);
|
||||
if (!section.IsNull())
|
||||
{
|
||||
result = section.Get<XAiMcpLinkExtractionToolConfiguration>();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inject Link Extraction MCP Tool Configuration and Register it ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="configuration"></param>
|
||||
public static void AddXAiMcpLinkExtractionToolConfiguration(
|
||||
this IServiceCollection source,
|
||||
IConfiguration configuration
|
||||
)
|
||||
{
|
||||
//
|
||||
var config = configuration.GetXAiMcpLinkExtractionToolConfiguration();
|
||||
source.AddXAiMcpLinkExtractionToolConfiguration(config);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register Link Extraction MCP Tool Configuration ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="configuration"></param>
|
||||
public static void AddXAiMcpLinkExtractionToolConfiguration(
|
||||
this IServiceCollection source,
|
||||
XAiMcpLinkExtractionToolConfiguration configuration
|
||||
)
|
||||
{
|
||||
//
|
||||
if (configuration.IsNull())
|
||||
{
|
||||
XException.InvalidConfiguration.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
source.AddSingleton(configuration);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Register Tools which required Dependency Injection Services ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
public static void AddXAiMcpTools(this IServiceCollection source)
|
||||
public static void AddXAiMcpTools(
|
||||
this IServiceCollection source,
|
||||
IConfiguration configuration
|
||||
)
|
||||
{
|
||||
//
|
||||
// Register Memory Cache Service ...
|
||||
source.AddMemoryCache();
|
||||
|
||||
//
|
||||
// User Tools ...
|
||||
source.AddScoped<XUserTools>();
|
||||
|
||||
//
|
||||
#region Web Search Tool ...
|
||||
//
|
||||
// Register Search Tool Configuration ...
|
||||
source.AddXAiMcpWebSearchToolConfiguration(configuration);
|
||||
|
||||
//
|
||||
// Register HttpClient ...
|
||||
// Since we Have Falling Back Endpoint, (more than one Endpoint),
|
||||
// we Doesn't pass Base Url ...
|
||||
source.AddHttpClient<IXAiMcpWebSearchService, XAiMcpWebSearchService>();
|
||||
|
||||
//
|
||||
// Register Web Search Tool ...
|
||||
source.AddScoped<XWebSearchTool>();
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Link Extraction Tool ...
|
||||
//
|
||||
// Register Link Extraction Tool Configuration ...
|
||||
source.AddXAiMcpLinkExtractionToolConfiguration(configuration);
|
||||
|
||||
//
|
||||
// Register Tool ...
|
||||
source.AddScoped<XLinkExtractionTool>();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Threading;
|
||||
using xAiMcpServer.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xAiMcpServer.Interfaces
|
||||
{
|
||||
public interface IXAiMcpWebSearchService
|
||||
{
|
||||
/// <summary>
|
||||
/// Search Web and Retrieve Response ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="maxResults"></param>
|
||||
/// <param name="region"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IReadOnlyList<XWebSearchToolResult>> SearchAsync(
|
||||
string query,
|
||||
int maxResults,
|
||||
string region = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace xAiMcpServer.Models
|
||||
{
|
||||
public class XExtractedLink
|
||||
{
|
||||
public string Url { get; set; }
|
||||
public string Text { get; set; }
|
||||
public bool IsRelative { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xAiMcpServer.Models
|
||||
{
|
||||
public class XLinkBundle
|
||||
{
|
||||
public IReadOnlyList<XExtractedLink> Linkes { get; set; } = [];
|
||||
public IReadOnlyList<XLinkContentResult> Contents { get; set; } = [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace xAiMcpServer.Models
|
||||
{
|
||||
public class XLinkContentResult
|
||||
{
|
||||
public int Length { get; set; } = 0;
|
||||
public bool Truncated { get; set; } = false;
|
||||
public string Url { get; set; } = string.Empty;
|
||||
public string Text { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Error { get; set; } = string.Empty;
|
||||
public string ContentType { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace xAiMcpServer.Models
|
||||
{
|
||||
public class XWebSearchToolResult
|
||||
{
|
||||
public int Rank { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Snippet { get; set; }
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
using xLoggingService.DI;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
@@ -19,10 +20,13 @@ namespace xAiMcpServer
|
||||
{
|
||||
//
|
||||
var result = Host.CreateDefaultBuilder(args)
|
||||
.ConfigureLogging(logging =>
|
||||
logging.AddXTelemetryLogger())
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
})
|
||||
.AddXTelemetry();
|
||||
|
||||
//
|
||||
return result;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "weatherforecast",
|
||||
"applicationUrl": "https://localhost:7001;http://localhost:7000",
|
||||
"applicationUrl": "https://localhost:7001;http://localhost:7000;https://0.0.0.0:7001;",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using HtmlAgilityPack;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using xCommons.Extensions;
|
||||
using xAiMcpServer.Models;
|
||||
using xExceptions.Constants;
|
||||
using System.Threading.Tasks;
|
||||
using xAiMcpServer.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using xIdentityService.Interfaces;
|
||||
using xAiMcpServer.Configurations;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace xAiMcpServer.Providers
|
||||
{
|
||||
public class XAiMcpWebSearchService : IXAiMcpWebSearchService
|
||||
{
|
||||
//
|
||||
private readonly HttpClient http;
|
||||
private readonly IMemoryCache cache;
|
||||
private readonly ILogger<XAiMcpWebSearchService> logger;
|
||||
private readonly XAiMcpWebSearchToolConfiguration configuration;
|
||||
|
||||
//
|
||||
private static readonly SemaphoreSlim gate = new(1, 1);
|
||||
|
||||
public XAiMcpWebSearchService(
|
||||
HttpClient http,
|
||||
IMemoryCache cache,
|
||||
IXIdentityProvider identityProvider,
|
||||
ILogger<XAiMcpWebSearchService> logger,
|
||||
XAiMcpWebSearchToolConfiguration configuration
|
||||
)
|
||||
{
|
||||
//
|
||||
if (configuration.IsNull())
|
||||
{
|
||||
XException.InvalidConfiguration.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
this.http = http;
|
||||
this.cache = cache;
|
||||
this.logger = logger;
|
||||
this.configuration = configuration;
|
||||
|
||||
//
|
||||
// Preparing Http Client ...
|
||||
http.Timeout = TimeSpan.FromSeconds(configuration.TimeoutSeconds);
|
||||
http.DefaultRequestHeaders.UserAgent.ParseAdd(identityProvider.GetDevice().ToJSON());
|
||||
http.DefaultRequestHeaders.Accept
|
||||
.ParseAdd("text/html,application/xhtml+xml");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search Web and Retrieve Response ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="maxResults"></param>
|
||||
/// <param name="region"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IReadOnlyList<XWebSearchToolResult>> SearchAsync(
|
||||
string query,
|
||||
int maxResults,
|
||||
string region = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
maxResults = Math.Clamp(maxResults, 1, 10);
|
||||
var key = $"ddg:{region}:{maxResults}:{query.Trim().ToLowerInvariant()}";
|
||||
if (cache.TryGetValue(key, out IReadOnlyList<XWebSearchToolResult> cached))
|
||||
{
|
||||
return cached;
|
||||
}
|
||||
|
||||
//
|
||||
await gate.WaitAsync(cancellationToken);
|
||||
try
|
||||
{
|
||||
//
|
||||
// Retrieve Result ...
|
||||
var results = await InternalSearchAsync(
|
||||
configuration.HtmlEndpoint,
|
||||
query,
|
||||
maxResults,
|
||||
region,
|
||||
cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
// Handle Falling Back ...
|
||||
if (results.Count == 0 && configuration.EnableLiteFallback)
|
||||
{
|
||||
//
|
||||
logger.LogWarning(
|
||||
"DDG HTML returned no results for '{Q}', trying Lite...", query);
|
||||
|
||||
//
|
||||
// Retrieve Fallbacked Result ...
|
||||
results = await InternalSearchAsync(
|
||||
configuration.LiteEndpoint,
|
||||
query,
|
||||
maxResults,
|
||||
region,
|
||||
cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Setting Cahce ...
|
||||
cache.Set(
|
||||
key,
|
||||
results,
|
||||
TimeSpan.FromSeconds(configuration.CacheTtlSeconds)
|
||||
);
|
||||
|
||||
//
|
||||
return results;
|
||||
}
|
||||
finally
|
||||
{
|
||||
//
|
||||
// Handle Delay Betwen Requests ...
|
||||
await Task.Delay(configuration.MinDelayMilliseconds, CancellationToken.None);
|
||||
gate.Release();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
#region Private ...
|
||||
private async Task<List<XWebSearchToolResult>> InternalSearchAsync(
|
||||
string baseUrl,
|
||||
string query,
|
||||
int max,
|
||||
string region,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
// Preparing Search Url ...
|
||||
var url = $"{baseUrl}?q={Uri.EscapeDataString(query)}";
|
||||
if (!region.IsNullOrEmpty())
|
||||
{
|
||||
url += $"&kl={Uri.EscapeDataString(region)}";
|
||||
}
|
||||
|
||||
//
|
||||
// Send Request and Get Response ...
|
||||
using var resp = await http.GetAsync(url, cancellationToken);
|
||||
|
||||
//
|
||||
// HTTP 202 = Anomaly Page ...
|
||||
if ((int)resp.StatusCode == 202)
|
||||
{
|
||||
//
|
||||
logger.LogWarning("DDG anomaly page (202) for '{Q}'", query);
|
||||
return [];
|
||||
}
|
||||
|
||||
//
|
||||
resp.EnsureSuccessStatusCode();
|
||||
|
||||
//
|
||||
// Reading Response Content ...
|
||||
var html = await resp.Content.ReadAsStringAsync();
|
||||
|
||||
//
|
||||
// Parse Content as List of Items ...
|
||||
var result = Parse(html, baseUrl, max);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<XWebSearchToolResult> Parse(
|
||||
string html,
|
||||
string baseUrl,
|
||||
int max
|
||||
)
|
||||
{
|
||||
//
|
||||
var doc = new HtmlDocument();
|
||||
doc.LoadHtml(html);
|
||||
|
||||
//
|
||||
// Handling Anomaly in HTML ...
|
||||
if (html.Contains("anomaly-modal") || html.Contains("unusual traffic"))
|
||||
{
|
||||
//
|
||||
logger.LogWarning("DDG anomaly detected in HTML body");
|
||||
return [];
|
||||
}
|
||||
|
||||
//
|
||||
var results = new List<XWebSearchToolResult>();
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
//
|
||||
// HTML endpoint: div.result ; Lite endpoint: جدولهای لینک
|
||||
var nodes = doc.DocumentNode
|
||||
.SelectNodes("//div[contains(@class,'result')]");
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
//
|
||||
if (results.Count >= max)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Ads ...
|
||||
if (node.GetAttributeValue("class", "").Contains("result--ad"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Select Search Results ...
|
||||
var a = node.SelectSingleNode(".//a[contains(@class,'result__a')]")
|
||||
?? node.SelectSingleNode(".//a[contains(@class,'result-link')]");
|
||||
if (a.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
var title = WebUtility.HtmlDecode(a.InnerText?.Trim() ?? "");
|
||||
var rawUrl = a.GetAttributeValue("href", "");
|
||||
var realUrl = UnwrapRedirect(rawUrl, baseUrl);
|
||||
if (realUrl.IsNullOrEmpty() || !seen.Add(realUrl))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
var snippetNode = node.SelectSingleNode(
|
||||
".//*[contains(@class,'result__snippet')]");
|
||||
var snippet = WebUtility.HtmlDecode(
|
||||
snippetNode?.InnerText?.Trim() ?? "");
|
||||
|
||||
//
|
||||
results.Add(new XWebSearchToolResult
|
||||
{
|
||||
Title = title,
|
||||
Url = realUrl,
|
||||
Snippet = snippet,
|
||||
Rank = results.Count + 1,
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
return results;
|
||||
}
|
||||
|
||||
private static string UnwrapRedirect(
|
||||
string href,
|
||||
string baseUrl
|
||||
)
|
||||
{
|
||||
//
|
||||
if (href.IsNullOrEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
// Extract Real Url ...
|
||||
var m = Regex.Match(href, @"[?&]uddg=([^&]+)");
|
||||
if (m.Success)
|
||||
{
|
||||
return Uri.UnescapeDataString(m.Groups[1].Value);
|
||||
}
|
||||
|
||||
//
|
||||
// Relative Links ...
|
||||
|
||||
//
|
||||
if (href.StartsWith("//"))
|
||||
{
|
||||
return "https:" + href;
|
||||
}
|
||||
|
||||
//
|
||||
if (href.StartsWith("/"))
|
||||
{
|
||||
return new Uri(new Uri(baseUrl), href).ToString();
|
||||
}
|
||||
|
||||
//
|
||||
return href.StartsWith("http") ? href : null;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+21
-5
@@ -4,6 +4,7 @@ using System.Net.Http;
|
||||
using xAiMcpServer.DI;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
using xLoggingService.DI;
|
||||
using xIdentityService.DI;
|
||||
using xCommons.Extensions;
|
||||
using xAiService.Extensions;
|
||||
@@ -42,6 +43,10 @@ namespace xAiMcpServer
|
||||
services.AddXAppConfiguration(Configuration);
|
||||
var appConfiguration = services.GetRegisteredService<XAppConfiguration>();
|
||||
|
||||
//
|
||||
// Register Logging Service ...
|
||||
services.AddXLoggingService(Configuration);
|
||||
|
||||
//
|
||||
// Register Allowed Origins ...
|
||||
services.AddXCors(appConfiguration.AllowedOrigins);
|
||||
@@ -68,10 +73,6 @@ namespace xAiMcpServer
|
||||
};
|
||||
});
|
||||
|
||||
//
|
||||
// Register Authorizations ...
|
||||
services.AddXAuthorization();
|
||||
|
||||
//
|
||||
services.AddControllers()
|
||||
.AddNewtonsoftJson(x =>
|
||||
@@ -90,9 +91,13 @@ namespace xAiMcpServer
|
||||
configuration: Configuration
|
||||
);
|
||||
|
||||
//
|
||||
// Register Authorizations ...
|
||||
services.AddXAuthorization();
|
||||
|
||||
//
|
||||
// Register MCP Tools in DI ...
|
||||
services.AddXAiMcpTools();
|
||||
services.AddXAiMcpTools(Configuration);
|
||||
}
|
||||
|
||||
public void Configure(
|
||||
@@ -112,6 +117,10 @@ namespace xAiMcpServer
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
//
|
||||
// Setting Environment in App Confiuration ...
|
||||
app.AddEnvironmentToXAppConfiguration(env.EnvironmentName);
|
||||
|
||||
//
|
||||
// Force Https Redirection ...
|
||||
app.UseHttpsRedirection();
|
||||
@@ -131,6 +140,13 @@ namespace xAiMcpServer
|
||||
// Using Routing ...
|
||||
app.UseRouting();
|
||||
|
||||
//
|
||||
// Using Request Logging ...
|
||||
if (!isDevelopmentEnvironment)
|
||||
{
|
||||
app.UseXRequestLogger();
|
||||
}
|
||||
|
||||
//
|
||||
// Use xIdentityService (Authentication) ...
|
||||
app.UseXIdentityService();
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using xIdentityHelper;
|
||||
using HtmlAgilityPack;
|
||||
using System.Threading;
|
||||
using xCommons.Extensions;
|
||||
using xAiMcpServer.Models;
|
||||
using xAiModels.Attributes;
|
||||
using xExceptions.Constants;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using xAiMcpServer.Configurations;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace xAiMcpServer.Tools
|
||||
{
|
||||
[XAiMcpToolType]
|
||||
public class XLinkExtractionTool
|
||||
{
|
||||
//
|
||||
private static readonly Regex UrlRegex = new(
|
||||
@"\b(?:https?://|www\.)[^\s<>""'{}|\\^`\[\]]+",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
//
|
||||
private readonly ILogger<XLinkExtractionTool> logger;
|
||||
private readonly IHttpClientFactory httpClientFactory;
|
||||
private readonly XAiMcpLinkExtractionToolConfiguration configuration;
|
||||
|
||||
public XLinkExtractionTool(
|
||||
ILogger<XLinkExtractionTool> logger,
|
||||
IHttpClientFactory httpClientFactory,
|
||||
XAiMcpLinkExtractionToolConfiguration configuration
|
||||
)
|
||||
{
|
||||
//
|
||||
if (configuration.IsNull())
|
||||
{
|
||||
XException.InvalidConfiguration.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
this.logger = logger;
|
||||
this.configuration = configuration;
|
||||
this.httpClientFactory = httpClientFactory;
|
||||
}
|
||||
|
||||
[XAiMcpTool(
|
||||
RequiresAuthentication = true,
|
||||
RequiredPolicy = XPolicies.EnabledUser,
|
||||
Description = "Extracts all valid HTTP/HTTPS links from the given content.")]
|
||||
public IReadOnlyList<XExtractedLink> ExtractLinks(
|
||||
[XAiMcpToolParam(
|
||||
Required = true,
|
||||
Description = "Raw text or HTML to scan for links.")]
|
||||
string content
|
||||
)
|
||||
{
|
||||
//
|
||||
var result = new List<XExtractedLink>();
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
if (content.IsNullOrEmpty())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = [.. UrlRegex
|
||||
.Matches(content)
|
||||
.Select(m => m.Value.TrimEnd('.', ',', ')', ']', ';'))
|
||||
.Where(IsValidUrl)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.Select(u => new XExtractedLink
|
||||
{
|
||||
Url = u,
|
||||
Text = u,
|
||||
IsRelative = u.StartsWith("www."),
|
||||
})];
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
[XAiMcpTool(
|
||||
RequiresAuthentication = true,
|
||||
RequiredPolicy = XPolicies.EnabledUser,
|
||||
Description = "Downloads a web page and extracts its readable plain text (noise removed).")]
|
||||
public async Task<XLinkContentResult> ReadLinkContent(
|
||||
[XAiMcpToolParam(
|
||||
Required = true,
|
||||
Description = "Absolute http/https URL.")]
|
||||
string url,
|
||||
[XAiMcpToolParam(
|
||||
Required = false,
|
||||
Description = "Optional. Max chars to return.")]
|
||||
int? maxChars = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
// Normalize ...
|
||||
if (!maxChars.HasValue)
|
||||
{
|
||||
maxChars = configuration.MaxChars;
|
||||
}
|
||||
|
||||
//
|
||||
var result = new XLinkContentResult();
|
||||
|
||||
//
|
||||
// Validate url ...
|
||||
if (url.IsNullOrEmpty() || !IsValidUrl(url))
|
||||
{
|
||||
//
|
||||
result = new XLinkContentResult
|
||||
{
|
||||
Url = url,
|
||||
Error = "Invalid URL"
|
||||
};
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
var client = httpClientFactory
|
||||
.CreateClient(nameof(XLinkExtractionTool));
|
||||
|
||||
//
|
||||
using var response = await client
|
||||
.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
//
|
||||
var contentType = response.Content.Headers.ContentType?.MediaType ?? "text/html";
|
||||
if (!contentType.Contains("html", StringComparison.OrdinalIgnoreCase) &&
|
||||
!contentType.Contains("text", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
//
|
||||
result = new XLinkContentResult
|
||||
{
|
||||
Url = url,
|
||||
ContentType = contentType,
|
||||
Error = $"Unsupported content type: {contentType}"
|
||||
};
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
var html = await response.Content.ReadAsStringAsync();
|
||||
var doc = new HtmlDocument();
|
||||
doc.LoadHtml(html);
|
||||
|
||||
//
|
||||
// Remove noise ...
|
||||
foreach (var n in doc.DocumentNode
|
||||
.SelectNodes("//script|//style|//noscript|//iframe|//svg") ?? Enumerable.Empty<HtmlNode>())
|
||||
{
|
||||
n.Remove();
|
||||
}
|
||||
|
||||
//
|
||||
var title = doc.DocumentNode.SelectSingleNode("//title")?.InnerText?.Trim() ?? "";
|
||||
var body = doc.DocumentNode.SelectSingleNode("//body")?.InnerText ?? "";
|
||||
var clean = Regex.Replace(WebUtility.HtmlDecode(body), @"\s{2,}", " ").Trim();
|
||||
|
||||
//
|
||||
var truncated = clean.Length > maxChars.Value;
|
||||
if (truncated)
|
||||
{
|
||||
clean = clean[..maxChars.Value];
|
||||
}
|
||||
|
||||
//
|
||||
result = new XLinkContentResult
|
||||
{
|
||||
Url = url,
|
||||
Text = clean,
|
||||
Error = null,
|
||||
Title = title,
|
||||
Length = clean.Length,
|
||||
Truncated = truncated,
|
||||
ContentType = contentType
|
||||
};
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
logger.LogWarning(ex, "Failed to read link {Url}", url);
|
||||
var resut = new XLinkContentResult
|
||||
{
|
||||
Url = url,
|
||||
Error = ex.Message
|
||||
};
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
[XAiMcpTool(
|
||||
RequiresAuthentication = true,
|
||||
RequiredPolicy = XPolicies.EnabledUser,
|
||||
Description = "Extracts links from content AND reads the readable text of each one (max N).")]
|
||||
public async Task<XLinkBundle> ExtractAndRead(
|
||||
[XAiMcpToolParam(
|
||||
Required = true,
|
||||
Description = "Raw text or HTML to scan for links.")]
|
||||
string content,
|
||||
[XAiMcpToolParam(
|
||||
Required = false,
|
||||
Description = "Optional. Max link to extract content.")]
|
||||
int? maxLinks = null,
|
||||
[XAiMcpToolParam(
|
||||
Required = false,
|
||||
Description = "Optional. Max chars to extract from each detected link's content.")]
|
||||
int? maxCharsPerLink = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
// Mormalize ...
|
||||
if (!maxLinks.HasValue)
|
||||
{
|
||||
maxLinks = configuration.MaxLinks;
|
||||
}
|
||||
if (!maxCharsPerLink.HasValue)
|
||||
{
|
||||
maxCharsPerLink = configuration.MaxChars;
|
||||
}
|
||||
|
||||
//
|
||||
var links = ExtractLinks(content).Take(maxLinks.Value).ToList();
|
||||
var contents = new List<XLinkContentResult>(links.Count);
|
||||
foreach (var link in links)
|
||||
{
|
||||
//
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
var linkContent = await ReadLinkContent(
|
||||
link.Url,
|
||||
maxCharsPerLink,
|
||||
cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
contents.Add(linkContent);
|
||||
}
|
||||
|
||||
//
|
||||
var result = new XLinkBundle
|
||||
{
|
||||
Linkes = links,
|
||||
Contents = contents
|
||||
};
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
#region Private ...
|
||||
private static bool IsValidUrl(string? raw)
|
||||
=> Uri.TryCreate(raw, UriKind.Absolute, out var u)
|
||||
&& (u.Scheme == Uri.UriSchemeHttp || u.Scheme == Uri.UriSchemeHttps);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -28,7 +28,7 @@ namespace xAiMcpServer.Tools
|
||||
[XAiMcpTool(
|
||||
RequiresAuthentication = true,
|
||||
RequiredPolicy = XPolicies.EnabledUser,
|
||||
Description = "Get information about the currently logged-in user.")]
|
||||
Description = "when user asks anything about itself, use this to retrieve user information.")]
|
||||
public async Task<string> WhoAmI()
|
||||
{
|
||||
//
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using xIdentityHelper;
|
||||
using System.Threading;
|
||||
using xCommons.Extensions;
|
||||
using xAiModels.Attributes;
|
||||
using System.Threading.Tasks;
|
||||
using xAiMcpServer.Interfaces;
|
||||
|
||||
namespace xAiMcpServer.Tools
|
||||
{
|
||||
[XAiMcpToolType]
|
||||
public class XWebSearchTool
|
||||
{
|
||||
private readonly IXAiMcpWebSearchService webSearchService;
|
||||
|
||||
public XWebSearchTool(
|
||||
IXAiMcpWebSearchService webSearchService
|
||||
)
|
||||
{
|
||||
this.webSearchService = webSearchService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search the web via Search Engine for the LATEST info on any topic.
|
||||
/// No API key required. Use this whenever the user asks about
|
||||
/// current events, recent releases, or time-sensitive facts.
|
||||
/// </summary>
|
||||
[XAiMcpTool("web_search",
|
||||
Description = "Search the web via Search Engine and return the most recent results (title, URL, snippet). ALWAYS use this tool when the user asks about current events, latest releases, new concepts, or anything that may have changed recently. Returns up to 10 results.",
|
||||
RequiresAuthentication = true,
|
||||
RequiredPolicy = XPolicies.EnabledUser)]
|
||||
public async Task<string> SearchWeb(
|
||||
[XAiMcpToolParam(
|
||||
Description = "Search query. Be specific; include year or keywords (e.g. 'latest ASP.NET Core 9 features 2025').")]
|
||||
string query,
|
||||
[XAiMcpToolParam(
|
||||
Description = "Max results to return (1-10). Default: 5.",
|
||||
Required = false)]
|
||||
int? maxResults = null,
|
||||
[XAiMcpToolParam(
|
||||
Description = "Region code for localized results (e.g. 'us-en', 'ir-fa', 'wt-wt' for worldwide). Default: wt-wt.",
|
||||
Required = false)]
|
||||
string region = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
if (query.IsNullOrEmpty())
|
||||
{
|
||||
return "Error: query is empty.";
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
var results = await webSearchService
|
||||
.SearchAsync(
|
||||
query.Trim(),
|
||||
maxResults.HasValue ? maxResults.Value : 5,
|
||||
region,
|
||||
cancellationToken
|
||||
);
|
||||
if (results.Count == 0)
|
||||
{
|
||||
return $"No results found for: {query}. " + "Search may be rate-limiting; try again in a few seconds.";
|
||||
}
|
||||
|
||||
//
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine($"## Web Search Results for: {query}");
|
||||
sb.AppendLine();
|
||||
|
||||
//
|
||||
foreach (var r in results)
|
||||
{
|
||||
//
|
||||
sb.AppendLine($"### [{r.Rank}] {r.Title}");
|
||||
sb.AppendLine($"- URL: {r.Url}");
|
||||
if (!r.Snippet.IsNullOrEmpty())
|
||||
{
|
||||
sb.AppendLine($"- Snippet: {r.Snippet}");
|
||||
}
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
//
|
||||
var result = sb.ToString();
|
||||
return result;
|
||||
}
|
||||
catch (OperationCanceledException) { throw; }
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"Web search failed: {ex.Message}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+48
-1
@@ -4,6 +4,7 @@
|
||||
"DefaultLanguage": "fa-IR",
|
||||
"XPoweredValue": "SaherElmITCenter",
|
||||
"WelcomeMessage": "Welcome to xSaherElm Project's AI Mcp Server",
|
||||
"DefaultCacheTtlMinutes": 10,
|
||||
"SwaggerConfiguration": {
|
||||
"Version": "v1.0",
|
||||
"Title": "xSaherElm AI Mcp Server",
|
||||
@@ -31,7 +32,53 @@
|
||||
"XPoweredValue": "SaherElmITCenter",
|
||||
"XRevisionSecretKey": "SaherElmITCenter@1694056",
|
||||
"DefaultClientTimeout": -1
|
||||
},
|
||||
},
|
||||
"LinkExtractionToolConfiguration": {
|
||||
"MaxLinks": 5,
|
||||
"MaxChars": 8000
|
||||
},
|
||||
"WebSearchToolConfiguration": {
|
||||
"Region": "wt-wt",
|
||||
"TimeoutSeconds": 20,
|
||||
"DefaultMaxResults": 5,
|
||||
"CacheTtlSeconds": 600,
|
||||
"EnableLiteFallback": true,
|
||||
"MinDelayMilliseconds": 1000,
|
||||
"HtmlEndpoint": "https://html.duckduckgo.com/html/",
|
||||
"LiteEndpoint": "https://lite.duckduckgo.com/lite/"
|
||||
},
|
||||
"LoggingServiceConfiguration": {
|
||||
"Enabled": true,
|
||||
"MinimumLevel": "Information",
|
||||
"Queue": {
|
||||
"Enabled": true,
|
||||
"Capacity": 10000,
|
||||
"ShutdownTimeoutSeconds": 10
|
||||
},
|
||||
"File": {
|
||||
"Enabled": true,
|
||||
"Format": "Json",
|
||||
"Directory": "./Logs",
|
||||
"RetainedFileCountLimit": 30,
|
||||
"MinimumLevel": "Information",
|
||||
"FileName": "xAiMcpServer-.log"
|
||||
},
|
||||
"Database": {
|
||||
"Enabled": false,
|
||||
"TableName": "XLogs",
|
||||
"AutoCreateTable": true,
|
||||
"MinimumLevel": "Warning",
|
||||
"Provider": "Microsoft.Data.Sqlite",
|
||||
"ConnectionString": "Filename=./Db/XLogs.db"
|
||||
},
|
||||
"Event": {
|
||||
"Enabled": false,
|
||||
"MinimumLevel": "Error",
|
||||
"Sender": "xAiMcpServer",
|
||||
"Topic": "application-logs",
|
||||
"Action": "ApplicationLogCreated"
|
||||
}
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Microsoft": "Warning",
|
||||
|
||||
+5
-2
@@ -23,7 +23,8 @@
|
||||
|
||||
<!-- Icon Handling -->
|
||||
<ItemGroup>
|
||||
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true" PackagePath="\icon.png" />
|
||||
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true"
|
||||
PackagePath="\icon.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Local Modules -->
|
||||
@@ -34,11 +35,13 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Modules/xCommons/xCommons.csproj" />
|
||||
<ProjectReference Include="../Modules/xAiService/xAiService.csproj" />
|
||||
<ProjectReference Include="../Modules/xLoggingService/xLoggingService.csproj" />
|
||||
<ProjectReference Include="../Modules/xIdentityHelper/xIdentityHelper.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Dependencies -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.13.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.11" />
|
||||
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
@@ -50,4 +53,4 @@
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user