Architecture - UnitBuilds-CC/V.E.L.O.C.I.T.Y.-MCP GitHub Wiki

Architecture

Overview

V.E.L.O.C.I.T.Y. is a single Rust binary crate with a proc-macro sub-crate. All core operations run natively in Rust β€” no external process delegation required.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Client Layer                          β”‚
β”‚  MCP Clients    Web/SDKs      Host Process    Plugins    β”‚
β”‚  (stdio)        (HTTP/WS)    (shmem)         (dynamic)  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚              β”‚             β”‚             β”‚
β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Protocol Layer                          β”‚
β”‚  JSON-RPC      HTTP/SSE/WS     NMCP Binary    NDA-Native β”‚
β”‚  (stdio)       (Axum)          (shmem)        (shmem)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Core Layer                            β”‚
β”‚  Tool Registry    Sandbox       NDA Ops      Plugins     β”‚
β”‚  (8 built-in)     (+ seccomp)   (compile/    (marketplaceβ”‚
β”‚                                  read/exec)   loading)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 Infrastructure                           β”‚
β”‚  Audit Log    Rate Limiter    Config    Observability     β”‚
β”‚  (10K ring)   (token bucket)  (TOML)   (OpenTelemetry)  β”‚
β”‚                                              β”‚           β”‚
β”‚                              Prometheus Metrics          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Module Overview

Module Purpose
src/main.rs CLI entry point, config loading, mode dispatch
src/lib.rs Library root with module declarations
src/protocol/ Protocol handlers (json_rpc, nmcp_binary, nda_native)
src/transport/http.rs HTTP/SSE/WebSocket via Axum
src/ipc/shmem.rs Memory-mapped shared memory buffer
src/registry.rs Tool registration and dispatch
src/sandbox.rs Capability-based sandbox
src/sandbox/linux_seccomp.rs Linux seccomp-bpf syscall filters
src/nda_converter.rs NDA binary document compiler
src/nda_document.rs NDA parser with Merkle/Ed25519 verification
src/nda_executor.rs NDA payload executor in sandbox
src/plugins/ Plugin system + marketplace
src/observability/ OpenTelemetry integration
src/config.rs TOML configuration management
src/audit.rs Global audit log (10K ring buffer)
src/rate_limit.rs Token bucket rate limiter
src/middleware.rs HTTP middleware (auth, CORS, logging)
src/resources.rs MCP Resources & Prompts
src/sampling.rs MCP Sampling protocol
src/streaming.rs Streaming responses with progress
src/oauth2.rs OAuth2 connector framework
macros/ Proc-macro crate for #[mcp_tool]
client/ Client SDKs (Rust, Python, TypeScript, Go)

Key Design Decisions

  1. Single binary β€” No external runtime dependencies. Self-contained executable.
  2. All native Rust β€” NDA operations, tool execution, protocol handling all in Rust.
  3. Four transport modes β€” Each optimized for different use cases.
  4. Capability sandbox β€” All execution goes through OS-enforced sandbox.
  5. Feature flags β€” Optional functionality (HTTP, OAuth2, database, observability) gated behind Cargo features.

Repository Structure

V.E.L.O.C.I.T.Y.-MCP/
β”œβ”€β”€ src/              # Server source code
β”œβ”€β”€ macros/           # Proc-macro sub-crate
β”œβ”€β”€ client/           # Client SDKs (4 languages)
β”œβ”€β”€ docs/             # Documentation (USER_GUIDE, API, etc.)
β”œβ”€β”€ tests/            # Integration + fuzz test suites
β”œβ”€β”€ benches/          # Criterion benchmarks
β”œβ”€β”€ monitoring/       # Prometheus/Grafana configs
β”œβ”€β”€ deploy/           # Docker + Kubernetes manifests
β”œβ”€β”€ Cargo.toml        # Dependencies and features
└── README.md         # Project overview

See also: Transport-Modes, Built-in-Tools, Security-Model