Skip to content

Commit 4df96bb

Browse files
committed
Add AddMcpApplicationServices extension method
Extract the duplicated MCP application service registrations (AuthorizationService, BoardService, ColumnService, CardService, LabelService, AutomationProposalService, CaptureService, NotificationService) into a shared extension method that both MCP stdio and MCP HTTP modes can call. Part of #951 (DEBT-05).
1 parent 0b31695 commit 4df96bb

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using Taskdeck.Application.Interfaces;
2+
using Taskdeck.Application.Services;
3+
4+
namespace Taskdeck.Api.Extensions;
5+
6+
/// <summary>
7+
/// Registers the minimal subset of Application services required by MCP
8+
/// resources and tools. Both MCP stdio and MCP HTTP standalone modes call
9+
/// this instead of the full <see cref="ApplicationServiceRegistration.AddApplicationServices"/>
10+
/// which includes web-only services (SignalR notifiers, workers, LLM providers, etc.).
11+
/// </summary>
12+
public static class McpApplicationServiceRegistration
13+
{
14+
/// <summary>
15+
/// Register the Application services that MCP resources and tools depend on.
16+
/// Deliberately skips web-only services (SignalR notifiers, workers,
17+
/// LLM providers, rate limiting, etc.) to keep the MCP host minimal.
18+
/// </summary>
19+
public static IServiceCollection AddMcpApplicationServices(this IServiceCollection services)
20+
{
21+
services.AddScoped<AuthorizationService>();
22+
services.AddScoped<IAuthorizationService>(
23+
sp => sp.GetRequiredService<AuthorizationService>());
24+
services.AddScoped<BoardService>(sp =>
25+
new BoardService(
26+
sp.GetRequiredService<IUnitOfWork>(),
27+
sp.GetRequiredService<IAuthorizationService>()));
28+
services.AddScoped<ColumnService>();
29+
services.AddScoped<CardService>();
30+
services.AddScoped<LabelService>();
31+
services.AddScoped<AutomationProposalService>();
32+
services.AddScoped<IAutomationProposalService>(
33+
sp => sp.GetRequiredService<AutomationProposalService>());
34+
services.AddScoped<CaptureService>();
35+
services.AddScoped<ICaptureService>(
36+
sp => sp.GetRequiredService<CaptureService>());
37+
services.AddScoped<NotificationService>();
38+
services.AddScoped<INotificationService>(
39+
sp => sp.GetRequiredService<NotificationService>());
40+
41+
return services;
42+
}
43+
}

0 commit comments

Comments
 (0)