GetRetryHistory(
+ CancellationToken cancellationToken = default)
+ {
+ await authorization.RequirePermissionAsync(McpPermissions.GetRetryHistory, cancellationToken);
+
+ var retryHistory = await retryStore.GetRetryHistory(cancellationToken);
+ return retryHistory.Results ?? new RetryHistory();
+ }
+}
\ No newline at end of file
diff --git a/src/ServiceControl/ServiceControl.csproj b/src/ServiceControl/ServiceControl.csproj
index 7afd8f88cf..5c252778c0 100644
--- a/src/ServiceControl/ServiceControl.csproj
+++ b/src/ServiceControl/ServiceControl.csproj
@@ -34,6 +34,7 @@
+
diff --git a/src/ServiceControl/WebApplicationExtensions.cs b/src/ServiceControl/WebApplicationExtensions.cs
index ec2f69f03d..033f8d2e4d 100644
--- a/src/ServiceControl/WebApplicationExtensions.cs
+++ b/src/ServiceControl/WebApplicationExtensions.cs
@@ -2,6 +2,8 @@ namespace ServiceControl;
using Infrastructure.WebApi;
using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using ModelContextProtocol.AspNetCore;
using ServiceControl.Hosting.ForwardedHeaders;
using ServiceControl.Hosting.Https;
using ServiceControl.Hosting.QueryTimeout;
@@ -11,7 +13,7 @@ namespace ServiceControl;
public static class WebApplicationExtensions
{
- public static void UseServiceControl(this WebApplication app, ForwardedHeadersSettings forwardedHeadersSettings, HttpsSettings httpsSettings)
+ public static void UseServiceControl(this WebApplication app, ForwardedHeadersSettings forwardedHeadersSettings, HttpsSettings httpsSettings, bool enableMcpServer = false)
{
app.UseRequestIdHeader();
app.UseQueryTimeoutResponse();
@@ -22,6 +24,27 @@ public static void UseServiceControl(this WebApplication app, ForwardedHeadersSe
app.UseHttpLogging();
app.UseCors();
app.MapControllers();
+
+ if (enableMcpServer)
+ {
+ app.MapGet(global::ServiceControl.Mcp.McpServerConfiguration.Route, () => Results.Content("""
+
+
+ 405: Method Not Allowed
+
+
+ 405: Method Not Allowed
+
+ This is an MCP server endpoint and cannot be accessed directly via a
+ browser or unsupported transports like SSE. Please use a streamable HTTP
+ transport.
+
+
+
+ """, "text/html", System.Text.Encoding.UTF8, StatusCodes.Status405MethodNotAllowed)).RequireCors(global::ServiceControl.Mcp.McpServerConfiguration.CorsPolicyName);
+ app.MapMcp(global::ServiceControl.Mcp.McpServerConfiguration.Route).RequireCors(global::ServiceControl.Mcp.McpServerConfiguration.CorsPolicyName);
+ }
+
app.MapServiceControlHealthChecks();
}
}
\ No newline at end of file