Add Kubernetes and Jira MCP tools with auto-registration

This commit is contained in:
2026-04-13 14:15:00 +03:00
parent 87fb9e8df8
commit b5eb33272a
10 changed files with 443 additions and 433 deletions

View File

@@ -1,10 +1,25 @@
using Microsoft.Extensions.Configuration;
using Polly;
using RestSharp;
namespace LazyBear.MCP.Services.Jira;
public static class JiraClientFactory
{
private static readonly TimeSpan[] BackoffDurations = {
TimeSpan.FromMilliseconds(1000),
TimeSpan.FromMilliseconds(2000),
TimeSpan.FromMilliseconds(4000)
};
private static readonly Policy _retryPolicy = Policy
.HandleResult<RestResponse>(response => !response.IsSuccessful && response.StatusCode == System.Net.HttpStatusCode.TooManyRequests)
.Or<RestException>()
.WaitAndRetryAsync(
retryCount: 3,
sleepDurationProvider: attempt => BackoffDurations[attempt],
onRetry: (outcome, timespan, attempt, context) => { });
public static RestClient CreateClient(IConfiguration configuration)
{
var jiraUrl = configuration["Jira:Url"] ?? "";
@@ -20,6 +35,6 @@ public static class JiraClientFactory
Timeout = TimeSpan.FromMilliseconds(30000)
};
return new RestClient(config);
return _retryPolicy.Wrap(new RestClient(config));
}
}