feat(worker): map MCP HTTP endpoint and broadcast TaskUpdated
- Add PlanningMcpContextAccessor (Option A) to read PlanningMcpContext
from HttpContext.Items set by PlanningTokenAuthMiddleware
- Annotate PlanningMcpService with [McpServerToolType]/[McpServerTool]
and remove PlanningMcpContext ctx parameter from all tool methods
- Broadcast TaskUpdated(parentTaskId) via HubBroadcaster after every
mutation in PlanningMcpService
- Refactor PlanningSessionManager to accept IDbContextFactory for
singleton-safe use in DI; keep direct-repo ctor for tests
- Register PlanningSessionManager (singleton), IPlanningTerminalLauncher,
PlanningMcpContextAccessor, PlanningMcpService, and MCP server in
Program.cs; wire PlanningTokenAuthMiddleware and MapMcp("/mcp")
- Update PlanningMcpServiceTests with fake HttpContext accessor and
no-op HubBroadcaster (avoids Moq dependency)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
14
src/ClaudeDo.Worker/Planning/PlanningMcpContextAccessor.cs
Normal file
14
src/ClaudeDo.Worker/Planning/PlanningMcpContextAccessor.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace ClaudeDo.Worker.Planning;
|
||||
|
||||
public sealed class PlanningMcpContextAccessor
|
||||
{
|
||||
private readonly IHttpContextAccessor _http;
|
||||
|
||||
public PlanningMcpContextAccessor(IHttpContextAccessor http) => _http = http;
|
||||
|
||||
public PlanningMcpContext Current =>
|
||||
(_http.HttpContext?.Items["PlanningContext"] as PlanningMcpContext)
|
||||
?? throw new InvalidOperationException("No planning context on request.");
|
||||
}
|
||||
Reference in New Issue
Block a user