Skip to content

Commit c4d2a99

Browse files
committed
Add AddMcpResourcesAndTools extension method
Extract the duplicated MCP resource and tool registrations (BoardResources, CaptureResources, ProposalResources, ReadTools, WriteTools, ProposalTools) into a shared extension method on IMcpServerBuilder, eliminating triple-duplication across the co-hosted web, standalone HTTP, and stdio hosting modes. Part of #951 (DEBT-05).
1 parent 4df96bb commit c4d2a99

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using ModelContextProtocol.AspNetCore;
2+
using ModelContextProtocol.Server;
3+
using Taskdeck.Api.Mcp;
4+
5+
namespace Taskdeck.Api.Extensions;
6+
7+
/// <summary>
8+
/// Registers the shared set of MCP resources and tools used by all three
9+
/// hosting modes (co-hosted web, standalone HTTP, and stdio).
10+
/// </summary>
11+
public static class McpResourcesAndToolsRegistration
12+
{
13+
/// <summary>
14+
/// Add MCP resources (Board, Capture, Proposal) and tools (Read, Write, Proposal)
15+
/// to the given MCP server builder.
16+
/// </summary>
17+
public static IMcpServerBuilder AddMcpResourcesAndTools(this IMcpServerBuilder builder)
18+
{
19+
return builder
20+
.WithResources<BoardResources>()
21+
.WithResources<CaptureResources>()
22+
.WithResources<ProposalResources>()
23+
.WithTools<ReadTools>()
24+
.WithTools<WriteTools>()
25+
.WithTools<ProposalTools>();
26+
}
27+
}

0 commit comments

Comments
 (0)