Developer & Contributor Guide¶
This document defines setup instructions, architectural conventions, coding guidelines, testing protocols, version management rules, and release verification workflows for the Model Context Gateway (MCG) & Semantic Proxy.
๐ Table of Contents¶
- Prerequisites & Development Environment
- Repository Structure & Architecture Conventions
- Local Development Workflow
- Backend (.NET 10 C#)
- Frontend (React 19 / Vite / TypeScript)
- Automated Testing & Code Coverage
- Backend Test Suite
- Frontend Vitest Suite
- End-to-End Testing (Playwright)
- Formatting, Linting & Static Analysis
- Version Synchronization & Release Verification
- Mandatory Version Synchronization Contract
- Release Verification Script (
verify-release.sh) - CLI Flags & Options Reference
- Automated Version Bumping & Atomic Commits
- Continuous Integration & Quality Gates
๐ ๏ธ Prerequisites & Development Environment¶
Ensure the following toolchains are installed:
| Tool / Runtime | Minimum Version | Purpose |
|---|---|---|
| .NET SDK | 10.0.x |
Compiling C# backend, minimal APIs, Dapper repositories, and xUnit tests |
| Node.js | 22.x LTS |
Vite development server, ESLint v10, Vitest, and React 19 UI build |
| npm | 10.x+ |
Package management for the frontend SPA |
| Python | 3.10+ |
Release verification and automated version bump scripts |
| Docker | 24.x+ |
Multi-stage container builds and integration test environments |
๐๏ธ Repository Structure & Architecture Conventions¶
The repository uses the following domain boundaries:
โโโ Components/ # Decomposed domain modules & Minimal API mappers
โ โโโ AppKeys/ # High-entropy AppKey models, crypto, and endpoints
โ โโโ Authorization/ # RBAC access policies, group mappings, and controllers
โ โโโ Capabilities/ # Proxy endpoints, SSE/HTTP mappers, and custom tools
โ โโโ Clients/ # Registered client profiles and setup guide generators
โ โโโ Providers/ # Identity and secret provider configurations & controllers
โ โโโ Servers/ # Upstream server registry, health checks, and discovery
โโโ Core/ # Core routing engine & MCP protocol handlers
โ โโโ Protocol/ # JSON-RPC 2.0 message contracts and spec models
โ โโโ Routing/ # ClientSession, DynamicEmbeddingService, SemanticSearch
โโโ Infrastructure/ # Persistence, secrets, identity, and logging adapters
โ โโโ Identity/ # Active Directory (LDAP), OIDC, and AppKey providers
โ โโโ Logging/ # PII sanitization, structured audit logging, ring buffers
โ โโโ Persistence/ # DbConnectionFactory & Repositories (see [Database ERD](database-providers.md#unified-database-entity-relationship-diagram-erd))
โ โโโ Secrets/ # Vault KV v2, DPAPI, Environment, and AES-256-GCM crypto
โ โโโ Transports/ # SseTransport, HttpTransport, and StdioTransport
โโโ frontend/ # React 19 + Vite + TypeScript glassmorphic SPA
โ โโโ src/api/ # Typed API client layer
โ โโโ src/components/ # Domain-decomposed UI views, modals, and tabs
โ โโโ src/shared/stores/ # Zustand state management stores
โ โโโ src/test/ # Vitest component, store, and unit test suites
โโโ ModelContextGateway.Tests/ # 600+ xUnit integration, security, and contract tests
โโโ scripts/ # Release verification, version bumping, and DB DDL scripts
โโโ docs/ # Architectural specifications and user guides
๐ป Local Development Workflow¶
Backend (.NET 10 C#)¶
-
Restore dependencies & build:
-
Run the gateway locally:
-
Configure environment overrides:
Frontend (React 19 / Vite / TypeScript)¶
-
Install dependencies:
-
Start Vite development server:
The development proxy routes/api,/sse, and/mcptraffic directly tohttp://localhost:8080. -
Build production bundle:
๐งช Automated Testing & Code Coverage¶
Backend Test Suite¶
The C# suite includes 600+ unit, integration, and security contract tests:
# Run all backend tests
CI=true dotnet test ModelContextGateway.slnx --configuration Release
# Collect code coverage
CI=true dotnet test ModelContextGateway.slnx --configuration Release --collect:"XPlat Code Coverage"
Frontend Vitest Suite¶
The frontend suite covers Zustand stores, typed API handlers, and React components:
End-to-End Testing (Playwright)¶
Execute UI workflows across multi-user security matrices:
Living Software Requirements Specification (SRS) & Test Catalog¶
Requirements and safety guardrails are annotated in C# and TypeScript tests. To regenerate or verify the catalog:
# Generate human-readable Markdown and machine JSON matrix
dotnet run --project scripts/CatalogGenerator
# Verify zero-drift in CI quality gates
dotnet run --project scripts/CatalogGenerator -- --verify-only
- Living SRS Document:
docs/software-requirements-and-test-catalog.md - Test Catalog & Annotation Guide:
docs/test-catalog-guide.md
๐จ Formatting, Linting & Static Analysis¶
-
C# Backend Formatting & Roslyn Analyzers:
Rules are defined in.editorconfigandDirectory.Build.props. -
Frontend ESLint (Zero-Warning Policy):
Uses ESLint v10 flat configuration (frontend/eslint.config.js).
๐ Version Synchronization & Release Verification¶
Mandatory Version Synchronization Contract¶
Every release, pull request, and commit to main must synchronize the version number across four mandatory locations:
ModelContextGateway.csproj:<Version>X.Y.Z</Version><AssemblyVersion>X.Y.Z.0</AssemblyVersion><FileVersion>X.Y.Z.0</FileVersion>frontend/src/shared/stores/useUserStore.ts:version: 'X.Y.Z', // fallback defaultCHANGELOG.md:- Top entry row in Release Changelog table matching
| **vX.Y.Z** | YYYY-MM-DD | ... | README.md:- Shield badge:
 - Top entry row in the top-5 release preview table
Release Verification Script (verify-release.sh)¶
The release verification engine is located at scripts/verify_release.py with a bash wrapper scripts/verify-release.sh.
==================================================================
๐ก๏ธ Model Context Gateway - Release & Quality Verification Engine ๐ก๏ธ
==================================================================
Repository Root: /containers/dev/csharp-mcp-router
๐ท๏ธ 1. Version Synchronization & Consistency
------------------------------------------------------------------
[PASS] Canonical Version in ModelContextGateway.csproj
[PASS] Csproj <AssemblyVersion> Alignment
[PASS] Csproj <FileVersion> Alignment
[PASS] React Store Fallback Version (frontend/src/shared/stores/useUserStore.ts)
[PASS] CHANGELOG.md Top Entry Alignment
[PASS] README.md Version Badge Alignment
[PASS] README.md Release Preview Top Entry
๐ 2. Markdown Link & Anchor Integrity
------------------------------------------------------------------
[PASS] Scanned Markdown Files (45 files discovered)
[PASS] Relative Links & Anchor Validity (151 links verified)
๐งช 3. Backend .NET Build & Test Verification
------------------------------------------------------------------
[PASS] .NET Backend Test Suite (500+ tests)
โ๏ธ 4. Frontend Quality, Lint, Build & Vitest Verification
------------------------------------------------------------------
[PASS] Frontend ESLint Quality Check (0 warnings)
[PASS] Frontend Vite Production Build (SPA)
[PASS] Frontend Vitest Component & Store Suite
==================================================================
๐ Release Verification Summary Report ๐
==================================================================
Total Checks: 13
Passed Checks: 13
Failed Checks: 0
------------------------------------------------------------------
๐ ALL RELEASE & QUALITY GATES PASSED CLEANLY! ๐
==================================================================
CLI Flags & Options Reference¶
Available flags:
| Flag | Purpose | Example |
|---|---|---|
--skip-tests |
Skips slow backend/frontend test execution; executes fast version sync and markdown link verification in <2s. | ./scripts/verify-release.sh --skip-tests |
--skip-links |
Skips markdown link and anchor validation. | ./scripts/verify-release.sh --skip-links |
--skip-versions |
Skips version synchronization checks. | ./scripts/verify-release.sh --skip-versions |
--check-versions-only |
Executes only the version synchronization validation. | python3 scripts/verify_release.py --check-versions-only |
--check-links-only |
Executes only the markdown relative link and anchor validation. | python3 scripts/verify_release.py --check-links-only |
--check-tests-only |
Executes only backend and frontend test/build suites. | python3 scripts/verify_release.py --check-tests-only |
--ci |
Streamlined output mode designed for automated CI environments. | python3 scripts/verify_release.py --ci |
-v, --verbose |
Enables verbose logging with detailed check descriptions. | ./scripts/verify-release.sh -v |
Automated Version Bumping & Atomic Commits¶
Bump the version and commit atomically:
The script executes the following:
1. Validates the .NET project build.
2. Invokes scripts/bump_version.py to increment the version (minor for feat:/breaking changes, patch for fix:/docs:).
3. Synchronizes all version references (.csproj, useUserStore.ts, CHANGELOG.md, README.md).
4. Creates a clean, atomic git commit.
๐ Continuous Integration & Quality Gates¶
Pull requests to main execute the quality gates defined in .github/workflows/ci.yml:
release-verification: Validates version synchronization and ensures 0 broken markdown links/anchors.backend: Runsdotnet build(Release) and the full 500+ xUnit test suite with coverage collection.frontend: Enforces strict zero-warning ESLint, builds the Vite production SPA, and runs Vitest suites.integration-smoke: Boots the compiled Release binary on an ephemeral Kestrel port with an isolated SQLite database, testing health probes, AppKey minting, and live MCP discovery.docker-check: Validates multi-stage Docker build integrity.CodeQL&Dependency Review: Static security analysis and vulnerability scanning.
For further details on CI workflows, branch protection rules, and coverage metrics, see CI Quality Gates & Security Workflows and Code Coverage Report.