Skip to content

Mcp Web Architecture

Sharp Ninja edited this page Nov 28, 2026 · 2 revisions

mcp-web C4 architecture

The migration ledger retains the historical Phase 0 and Phase 1 review receipts. The migrated v0.8 plan defines authorization for future execution against a pinned revision. D12 excludes Director from this plan.

Purpose

The Structurizr model describes the mcp-web runtime, the shared Requirements foundation, and the proposed product surfaces that depend on it.

The model is at structurizr/workspace.dsl.

Diagrams of new and changed C4 elements

These review diagrams are intentionally scoped to elements or relationships introduced or changed by the Requirements Management plan. Existing elements appear only when they provide required architectural context. The Structurizr DSL remains the authoritative architecture model; the diagrams are reproducible Graphviz projections with tracked .dot sources.

Color and line conventions:

  • blue and dark gray: unchanged current context;
  • orange: an existing element changed or constrained by the plan;
  • yellow with a dashed border: a new or proposed element or relationship;
  • red with a dashed border: a required capability that does not exist yet.

System context changes

New requirements roles, the changed management-client boundary, QuadBrain identifier generation, and the missing authoritative audit-query capability.

Open SVG · Graphviz source

C4 system context changes

Container changes

The shared Web and UI.Core containers and their QBrain and QuadBrain dependencies. The retained design projection shows Director as historical context.

Open SVG · Graphviz source

C4 container changes

Shared Web Runtime component changes

The new Requirements shell, thin pages, host adapters, and QuadBrain identifier adapter, together with the changed shell and composition root.

Open SVG · Graphviz source

C4 Shared Web Runtime component changes

Shared UI.Core component changes

The target domain contracts, CQRS messages and handlers, service ports, reusable ViewModels, operation state, and migration from the current lossy requirements contracts.

Open SVG · Graphviz source

C4 Shared UI.Core component changes

QBrain and QuadBrain dependencies

The broader use of existing QBrain capabilities, the new QuadBrain dependency, and the proposed QBrain audit-query gap.

Open SVG · Graphviz source

C4 QBrain and QuadBrain dependency changes

Director compatibility boundary

This is a retained historical view of the existing legacy boundary. D12 excludes Director from the implementation plan.

Open SVG · Graphviz source

C4 Director compatibility changes

Use-case dynamic summary

The seven planned requirements workflows from actor and view state through UI.Core boundaries to QBrain or QuadBrain.

Open SVG · Graphviz source

C4 Requirements Management dynamic summary

Scope represented

The model includes:

  • the portable mcp-web .NET tool launcher;
  • the Linux x64 ASP.NET Core Web payload;
  • the Windows x64 MAUI Blazor Hybrid payload;
  • the shared Web runtime and Primer-style Razor shell;
  • the shared UI.Core CQRS, service-port, handler, and ViewModel boundaries;
  • Director as an existing UI.Core consumer and compatibility constraint;
  • QBrain requirements, workspace, use-case, diagram, recovery, document, and persistence boundaries;
  • QuadBrain identifier generation through POST /v1/chat/completions;
  • OIDC identity and active-workspace propagation;
  • NuGet distribution and platform-specific deployment;
  • the proposed Requirements Management interfaces, domain records, CQRS messages, handlers, ViewModels, Web adapters, and operational-state definitions;
  • dynamic views for use cases 10230 through 10236;
  • traceability to FR-WEB-004 through FR-WEB-015.

Current-state observations

The following are observations from the repository and live QBrain contracts:

  • McpServerManager.Web.Tool is the generic launcher. It selects the Windows Hybrid executable or Linux Web executable and forwards arguments without shell parsing.
  • McpServerManager.Web.Hybrid references McpServerManager.Web, calls AddWebServices, and renders the shared routes through a local BlazorWebView.
  • McpServerManager.Web is both the Linux ASP.NET Core host and the assembly containing shared Razor components, Web service registration, adapters, and WebMcpContext.
  • WebMcpContext owns control and active-workspace clients and synchronizes bearer/API-key authentication with the selected workspace.
  • McpServerManager.UI.Core is the host-agnostic shared library for CQRS contracts, handlers, API abstractions, state, and reusable ViewModels.
  • the existing requirements slice in UI.Core and Director is intentionally shown as CurrentLimited. Its DTOs retain only basic FR/TR/TEST/mapping fields and cannot support the approved subsystem without expansion.
  • the Director requirements adapter preserves CRUD, mappings, and document generation. Workspace assignment returns typed unavailability for FR, TR, and TEST.
  • QBrain already exposes the native requirements, acceptance criteria, mappings, layers/effective resolution, recovery, documents, use cases, diagram graph, lifecycle, product, and coverage behavior needed by FR-WEB-004 through FR-WEB-013 and most of FR-WEB-015.
  • the workspace current requirement layer is owned by the QBrain workspace service, while layer catalog/effective resolution is owned by the requirements service.
  • QBrain does not currently expose the durable cross-operation requirements audit query required by FR-WEB-014.
  • QuadBrain identifier creation is an existing chat-completions dependency, not a proposed requirement-ID endpoint.

Target separation rules

The target model applies the repository's cross-platform methodology:

  • UI shells own rendering, input wiring, focus, dialogs, navigation, and other view-only behavior.
  • reusable ViewModels own bindable state, UI validation, filters, drafts, selection, and command/query dispatch. They do not perform network, filesystem, process, parsing, or composition work.
  • CQRS messages carry primitives and transport-neutral DTOs only. They never carry ViewModel, HTTP, Razor, MAUI, or Terminal.Gui objects.
  • handlers own application behavior, authorization, validation sequencing, refresh/invalidation outcomes, and typed failure mapping.
  • interface-segregated UI.Core service ports define host-independent operations.
  • Web adapters implement those ports and own typed-client calls, active-workspace propagation, authentication forwarding, and transport mapping for Web and Hybrid.
  • QBrain remains the source of truth. Browser or ViewModel state is never treated as authoritative requirements or audit data.
  • runtime workspace values are resolved from WorkspaceContextViewModel and readiness gates rather than pushed imperatively into services.
  • the existing IRequirementsApiClient remains as a compatibility boundary until consumers migrate. New behavior must not be implemented twice behind the old and new ports.

Phase 1 contracts and planned host features

The Phase 1 design specifies RequirementDetail, RequirementCriterion, and RequirementScope for the native catalog, together with contracts for layers, recovery, documents, use cases, graphs, and audit. The DSL lists the designed types, Web adapters, and feature-specific ViewModels.

Service ports

  • IRequirementCatalogPort
  • IRequirementTraceabilityPort
  • IRequirementLayerPort
  • IRequirementRecoveryPort
  • IRequirementDocumentPort
  • IRequirementUseCasePort
  • IRequirementAuditPort
  • IRequirementIdentifierPort

Reusable ViewModels

  • RequirementsShellViewModel
  • RequirementsOverviewViewModel
  • RequirementCatalogViewModel
  • RequirementEditorViewModel
  • RequirementTraceabilityViewModel
  • RequirementLayersViewModel
  • RequirementLayerEditorViewModel
  • RequirementRecoveryViewModel
  • RequirementDocumentsViewModel
  • UseCaseCatalogViewModel
  • UseCaseEditorViewModel
  • UseCaseDiagramViewModel
  • RequirementAuditViewModel

Web adapters

  • RequirementCatalogApiClientAdapter
  • RequirementTraceabilityApiClientAdapter
  • RequirementLayerApiClientAdapter
  • RequirementRecoveryApiClientAdapter
  • RequirementDocumentApiClientAdapter
  • UseCaseApiClientAdapter
  • RequirementAuditApiClientAdapter
  • QuadBrainRequirementIdentifierGenerator

The complete command and query names are recorded on the Requirements CQRS Messages component in the DSL. The Phase 1 design registers RequirementsWorkspaceViewModel and WebRequirementAuthorization through the shared Web and Hybrid service graph. Each scope owns the workspace selection used by its ViewModel, transport, and authorization. The design calls for each capability port to report typed unavailability until its host transport adapter is wired.

Requirement and use-case trace

The migrated v0.8 plan and the PLAN-WEBREQS-001 TODO govern the implementation handoff. The plan records phase authorization, named tests, green success mocks and negative controls, production binding, coverage, rollback, and independent hostile validation. Targeted and cumulative groups require zero failures and zero skips. The full-unit gate requires the six permanent Copilot skips under D11 and zero other skips or failures. The secondary Requirements NUKE project owns these checks. The repository's existing NUKE project retains packaging and deployment ownership.

The QBrain workspace now maps every functional requirement below to its capability-specific technical requirement, the cross-cutting architecture, operational-state, and Byrd-quality technical requirements, and its capability-specific and cross-cutting test requirements. The canonical mapping is recorded in the implementation plan; Markdown remains a projection rather than the requirements source of truth.

  • FR-WEB-004: Requirements shell, overview, workspace scope, and subsystem navigation.
  • FR-WEB-005: Catalog, native lifecycle fields, CRUD, batch behavior, and deletion.
  • FR-WEB-006: QuadBrain-assisted identifier candidate creation and collision validation.
  • FR-WEB-007: Structured acceptance criteria.
  • FR-WEB-008: Traceability, coverage, and supported gap repair.
  • FR-WEB-009: Layer catalog, current layer, scope, and effective result.
  • FR-WEB-010: Exceptional recovery planning, atomic apply, replay, conflict, and lookup.
  • FR-WEB-011: Confirmed direct ingest plus document generation/download.
  • FR-WEB-012: Use-case aggregate, Realizes, approval, product, and coverage.
  • FR-WEB-013: Persisted graph authoring and generated use-case/sequence diagrams.
  • FR-WEB-014: Authoritative durable audit query dependency and unavailable state.
  • FR-WEB-015: Authorization, accessibility, and recoverable operational states.
  • UC 10230: Author and maintain a requirement.
  • UC 10231: Analyze and repair requirements coverage.
  • UC 10232: Manage requirement layers and inspect the effective set.
  • UC 10233: Recover requirements after an exceptional store failure.
  • UC 10234: Ingest and generate requirements documents.
  • UC 10235: Manage use cases and diagrams.
  • UC 10236: Review requirements audit and operational health.

Architecture decisions already locked by approved requirements and UI

  • blank IDs use QuadBrain chat completions, then Web validates grammar and checks QBrain for collision before normal create;
  • the generated ID remains editable and visible for confirmation;
  • recovery is exceptional repair, never routine editing;
  • recovery dry-run and apply reuse the same idempotency key and payload hash;
  • recovery does not imply support for mappings, deletion, notes, criteria, or scope fields absent from the QBrain recovery contract;
  • document ingest currently applies directly and therefore requires explicit confirmation;
  • current-layer selection uses the QBrain workspace surface, while layer/effective operations use the QBrain requirements surface;
  • the audit page must show authoritative-unavailable until QBrain exposes the required durable query;
  • Web and Hybrid reuse the same pages, adapters, CQRS, and ViewModels;
  • Director remains a compatibility consumer of UI.Core and must not gain a dependency on Web.

Decisions and validation

The implementation plan decision register governs document result shapes, concurrency, batch behavior, diagram freshness, and collision queries. D03 retains the dependency on an authoritative QBrain audit query. Until it exists, the shared port returns an explicit unavailable result.

The Structurizr validation receipt pins the DSL revision and CLI used for the migration. The rendered-view review records the views inspected. The Phase 0 plan specifies the Requirements NUKE architecture check for execution. The Graphviz diagrams above remain the retained design projections.

Clone this wiki locally