|
| 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