- 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>
15 lines
455 B
C#
15 lines
455 B
C#
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.");
|
|
}
|