Context
- This PR is the inner-loop delivery for epic
school-core-hr6 in branben/school-core.
- The implementation contract was locked in the outer loop before any product code was written.
- PRD
- 2026-11-01-001-mcp-07-28-spec-upgrade-prd
- SPEC
- 2026-11-01-002-mcp-07-28-spec-upgrade-spec · M5
- Ticket
PR #15983 — feat(mcp): add opt-in native sidecar with legacy compatibility
- Decisions
D1–D12 (12 locked implementation decisions)
Phase trace
PRIME
PLAN
BUILD
TEST
REVIEW
PR
- PRIME — outer loop produced the ticket
PR #15983 (MCP v2 sidecar); inner loop begins
- PLAN — authored PRD + SPEC with 12 locked decisions (D1–D12)
- BUILD — implemented v2 sidecar (21 files, +2761/-14); legacy
/api/mcp* now points modern clients to /api/mcp/v2
- TEST — 2026-11-03: pointer suite 7/7, related MCP suites 33/33, MCP v2 vitest 94/94, typecheck:core 0 errors, ESLint and Prettier clean, live HTTP checks passed. Earlier pre-change run: 92/94, 46/46 feature-flags, 138/140.
- REVIEW — independent MCP reviewer agents (
teacher-cto correctness + teacher-coo completeness) CTO PASS COO PASS combined score 98/100
- PR — final inner-loop phase: delivers the ticket as a reviewed, tested pull request with chain-of-custody artifacts
Evidence gathering
codegraph_explore — mapped the 21 changed files into 4 impact clusters: v2 server scaffold, HTTP route, feature flag, and test suite. Found the call path from src/app/api/mcp/v2/route.ts through handleMcpV2Http to open-sse/mcp-server/v2/server.ts.
ripwire — lexical search across OmniRoute and school-core source trees confirmed no v1 files were modified, verified the OMNIROUTE_MCP_V2 flag registration in featureFlagDefinitions.ts, and located the scope-enforcement function withScopeEnforcement used by both v1 and v2.
student-searcher — verified file:line that buildScopeDenialMessage strips caller-influenced fields from denial surfaces, and that server/discover returns only tools (no unregistered resources/prompts).
phymora — challenged each of the 12 SPEC decisions. Three survived challenge unchanged (D3, D5, D12); D7 was strengthened from “persistent server” to “fresh server+transport per request” after a state-leakage objection; D4 was clarified to close the _meta self-granting path.
teacher-cto — correctness verdict: PASS. Found the 2 Node ESM startup probe failures (timing, not masked) as the only open correctness items.
teacher-coo — completeness/acceptance verdict: PASS. Verified source.json chain valid, changelog integrity, test discovery, and that all 12 SPEC decisions have test coverage or an explicit verification note.
cocoindex — semantic retrieval when lexical search missed the MCP spec’s cancellation-gap rationale; surfaced the spec clause that “the spec is silent on client disconnect during an in-flight request,” which became the justification for D11’s stdio cleanup handle.
session_search — recovered prior-session context for PR #15983’s 3-commit structure and the school-core-hr6 epic without re-prompting the user.
Artifacts
- Guided review— file-by-file walkthrough, 21 files in 4 sections
- Outer-loop context— this page
- PRD— product requirements, gap table, scope
- SPEC— 12 decisions (D1–D12), milestone map, implementation contract
- Module inventory— prime-module-map.html (04-code-understanding template)
- Module graph— interactive archify diagram of v2 sidecar
- Decisions-first plan— plan-tweakable.html
- Test results + gates— validate-prototype.html
docs/source.json— chain-of-custody record (untracked; not yet committed)
docs/review-evidence.json— review verdicts + phase context