Skip to main content
Glama
Aegis-Sovereign MCP Server

Aegis-Sovereign MCP Server

by TravT

🛡️ Aegis-Sovereign (AS) — Air-Gapped Knowledge & Document Intelligence Appliance

Version Architecture Token Savings MCP v2

Aegis-Sovereign (AS) is a 100% air-gapped, single-vault enterprise document intelligence, GraphRAG, and Model Context Protocol (MCP v2) appliance. It unifies deterministic sub-millisecond identifier lookups (Prong 1) with multi-tier hybrid semantic and relational graph synthesis (Prong 2), cutting frontier LLM cloud token consumption by $\ge 40%$ (empirically $92%+$) with zero external telemetry.


🏗️ Two-Pronged Architecture & Single-Vault Server Topology

flowchart LR
    subgraph Harnesses ["AI Harnesses & NOC UI"]
        AGY["Google Antigravity (agy)"]
        CC["Claude Code / Desktop"]
        CUR["Cursor / Windsurf / Cline"]
        PORTAL["Executive Web Portal\n(http://127.0.0.1:8765)"]
    end

    subgraph Router ["Aegis-Sovereign Core (ADR-40)"]
        IR["Resilient Intent Router\n(Entropy + Grammar Classifier)"]
        P1["Prong 1: Deterministic Fast-Path\n(<0.5ms B-Tree + MAC FTS5)"]
        P2["Prong 2: Cognitive Cascade\n(RRF + GraphRAG + RAPTOR)"]
        STREAM["Zero-Disk Archive Streamer\n(.hdx / .zip / .docx / .xlsx)"]
        IR --> P1
        IR --> P2
        IR --> STREAM
    end

    subgraph Vault ["Unified Server Vault (docs/.aegis_vault/)"]
        RDB[("sovereign_router.db\n49,000+ Records + FTS5")]
        GDB[("sovereign_graph.db\n9,100+ Entities / 20,250+ Edges")]
        DIAG["extracted_diagrams/\nHardware Topology PNGs"]
        SRC["monitored_sources.json\n5 Server Domains"]
    end

    Harnesses <-->|"MCP v2 (stdio) / REST"| Router
    P1 <--> RDB
    P2 <--> RDB
    P2 <--> GDB
    STREAM <--> DIAG

Related MCP server: ContextFlow MCP Server

📂 Clean Repository Directory Structure (Aegis-Sovereign)

aegis-sovereign-appliance/
├── core/                        # Core Appliance Engine (ADR-40)
│   ├── classifier/              # Deterministic metadata & clearance rules
│   ├── containers/              # Zero-disk .hdx, .zip, .docx, .xlsx in-memory streamers
│   ├── graph/                   # SQLite WAL Knowledge Graph (GraphStore + purge engine)
│   ├── licensing/               # Ed25519 offline cryptographic license verifier
│   ├── mcp/                     # 7-Tool Model Context Protocol (MCP v2) stdio server & schemas
│   ├── onboarding/              # Autonomous OnboardingRadar corpus scanner
│   ├── proxy/                   # Token-budget ContextCondenser (>=40% savings guarantee)
│   ├── router/                  # Two-Pronged SovereignQueryRouter (Prong 1 B-Tree/FTS5 + Prong 2)
│   ├── search/                  # Hybrid Dense ONNX + Sparse BM25 RRF searcher
│   └── server.py                # Unified HTTP REST API & Web Portal backend (port 8765)
├── web/portal/                  # Executive & NOC Web Management Console (index.html)
├── tools/                       # Administrative, Lifecycle, Purge & Packaging CLIs
│   ├── vault_lifecycle.py       # Unified DB consolidation, directory ingestion & prefix purge CLI
│   ├── build_release_bundle.py  # Turnkey redistributable bundle & SHA-256 MANIFEST builder
│   ├── capsule.py               # Encrypted .sovereign-capsule snapshot manager
│   └── package_update.py        # Air-gapped cryptographic update verifier
├── docs/manuals/                # Complete 15-Manual Operator & Engineering Suite (01–15)
├── benchmarks/                  # Reproducible benchmark runners & empirical reports/
│   └── reports/                 # Markdown & JSON benchmark reports (Huawei 5G, 7-Tool MCP, Scale)
├── tests/                       # Comprehensive Pytest verification suite
├── data/                        # Unified symlinks -> /home/tlima/Enterprise_Hub/docs/.aegis_vault/
└── install.sh                   # 6-stage turnkey installer & preflight health verifier

⚡ Quickstart: Deploy, Ingest, Search & Purge

1. Run the Turn-Key Installer & Smoke Verification

./install.sh

2. Launch the Executive Web Portal & REST API

python3 -m core.server --host 0.0.0.0 --port 8765
# Open http://127.0.0.1:8765/ in your browser

3. Inspect Unified Vault Status, Ingest New Folders, or Purge Data

# Inspect unified database breakdown across all monitored server domains:
python3 -m tools.vault_lifecycle --status

# Ingest a new server directory into sovereign_router.db & sovereign_graph.db:
python3 -m tools.vault_lifecycle --ingest /path/to/directory --domain custom_docs

# Remove / purge a directory or corpus prefix from Router DB, FTS5, and GraphStore:
python3 -m tools.vault_lifecycle --purge "/path/to/directory_or_prefix"

4. Tests and batch jobs on the reference host (Dell 7390)

The serving task can take ~1.5 GB at any moment (the Gemma query encoder loads on the first plain-language query) and the host has about 2 GB free. On that host (homelab), pytest and the vault-writing tools (vault_lifecycle, every action including --status, which rewrites the sources manifest; adr_identity --apply; the indexers) refuse to run unless capped, and never 03:30-05:30 (nightly backup). tools/bounded_run.py; AEGIS_UNBOUNDED_OK=1 overrides.

systemd-run --user --scope -p MemoryMax=2.5G -p CPUQuota=150% ../../.venv/bin/pytest tests -q
# keep the production vault read-only while the suite runs (step 13.3 makes this the default):
systemd-run --user --scope -p MemoryMax=2.5G -p CPUQuota=150% ../../.venv/bin/pytest -p tests.vault_guard tests -q

🧰 The 7-Tool Model Context Protocol (MCP v2) Matrix

#

MCP Tool Name

Primary Role

Typical Latency

1

sovereign_route_and_analyze

Classifies query intent (deterministic_direct, compound_fused, hybrid_needle, relational_graph), Shannon entropy, and domain grammar (ALM-*, MML, ADR-*, manage-*).

0.15 ms

2

sovereign_search_vault

Executes Prong 1 B-Tree/FTS5 exact lookup or Prong 2 hybrid retrieval across all 49,000+ unified server records.

0.28 ms

3

sovereign_optimize_context

Condenses multi-document evidence into a token-budgeted context window with provable $\ge 40%$ ($92%+$ empirical) token compression.

0.95 ms

4

sovereign_get_entity_dossier

Traverses sovereign_graph.db (1–3 hops) to return connected alarms, MML commands, KPI counters, ADRs, skills, and hardware diagrams.

0.42 ms

5

sovereign_inspect_archive

Streams nested .zip/.hdx archives in-memory (virtual_uri), relocates corpus prefixes (relocate_prefix), or purges prefixes (purge_prefix).

1.20 ms

6

sovereign_scan_onboarding_radar

Scans filesystem dropzones to classify file formats, detect encrypted archives, and estimate indexing footprint.

3.10 ms

7

sovereign_node_status

Returns real-time health, SIMD profile, database counts, monitored sources, and active Ed25519 license tier.

0.20 ms


📚 Master Operator Manuals (01 – 15)

All 15 operator manuals are available in docs/manuals/:

  1. 01. Deployment Guide

  2. 02. Database Initialization & Vector Store

  3. 03. Connector Matrix & External Integrations

  4. 04. MCP Harness & Agent Configuration

  5. 05. Ingestion & Tagging Runbook

  6. 06. Executive Tuning & Client Knobs

  7. 07. Scaling Topologies & Commercial Playbook

  8. 08. Desktop Workstation & Corporate DLP

  9. 09. Datacenter Supercomputing & Distributed Fabric

  10. 10. Hierarchical Library Retrieval & RAPTOR

  11. 11. Hardware Sizing & Capacity Planning

  12. 12. Sovereign Workstation Tier 1 — Architecture Compendium

  13. 13. Deep .HDX Telecom Vendor Package Ingestion

  14. 14. Real-World Corpus Acquisition & Testing Guide

  15. 15. Unified Server Vault, Purge Lifecycle & Multi-Harness Guide

Available Tools

7 tools
sovereign_get_entity_dossierA

Compiles a complete relational knowledge graph dossier for an entity: linked documents, timeline of dates, monetary transactions, and multi-hop cross-references (1 to 5 hops).

Inputs: hops, entity, entity_name.

sovereign_inspect_archiveB

Streams and inspects .hdx, .hwics, .zip, .xlsx, .docx, .tar.zst, or .epub containers purely in-memory (O_RDONLY, zero disk extraction) per ADR-07. Also supports section/offset slicing (section_filter, char_offset) and zero-reindex corpus path relocation / stale relationship cleanup (action='relocate_prefix' | 'purge_prefix' | 'corpus_stats').

Inputs: query, action, ingest, max_chars, +10 more.

sovereign_node_statusA

Inspects health, indexing stats, and operational metrics of the Sovereign Appliance node.

Inputs: no named parameters.

sovereign_optimize_contextA

Pre-filters large archives down to verified evidence chunks with citations. Cuts prompt tokens by 90%+ (guaranteed >= 40%) in a single call, eliminating cloud token waste.

Inputs: query (required), max_chunks, retrieval_mode, user_clearance, +6 more.

sovereign_route_and_analyzeC

Executes the Two-Pronged Hybrid Retrieval & Resilient Intent Router (ADR-40). Routes deterministic identifiers (<2ms SQLite B-Tree/FTS5 with MAC pushdown) vs multi-tier cognitive queries (hybrid_needle, relational_graph, macro_synthesis, compound_fused) with local NanoRunner synthesis and explicit execution_mode telemetry.

Inputs: query (required), limit, synthesize, user_clearance.

sovereign_scan_onboarding_radarA

Runs the ADR-08 60-Second Auto-Discovery Onboarding Radar (os.scandir, strictly read-only) to discover, classify, and rank domain knowledge directories (fiscal_nfe, medical_clinical, legal_contracts, engineering_manuals, general_knowledge).

Inputs: root_paths (required), max_scan_seconds.

sovereign_search_vaultB

Direct hybrid dense + sparse vector search across the sovereign vault.

Inputs: query (required), limit, retrieval_mode.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 7 tools

    Disambiguation3/5

    Most tools target distinct operations (scan, status, optimize, search, dossier, route, inspect), but sovereign_optimize_context, sovereign_search_vault, and sovereign_route_and_analyze all involve retrieval/analysis and could be confused for similar high-level queries. The descriptions help, but the boundaries between 'optimize context', 'search vault', and 'route and analyze' are not immediately crisp.

    Naming Consistency4/5

    All tools share the 'sovereign_' prefix and use verb_noun or verb_phrase patterns (scan_onboarding_radar, node_status, optimize_context, search_vault, get_entity_dossier, route_and_analyze, inspect_archive). Minor inconsistency: 'sovereign_node_status' lacks a verb, while others have explicit verbs, but overall the pattern is predictable.

    Tool Count4/5

    Seven tools is a reasonable count for a specialized knowledge-management/retrieval server. The scope is broad (onboarding, search, routing, archive inspection, entity dossiers), but each tool covers a distinct capability without feeling bloated.

    Completeness3/5

    The server covers discovery, search, retrieval, routing, archive inspection, and node health, but lacks obvious lifecycle operations like adding/updating/deleting documents or managing the vault corpus. The inspect_archive tool has some maintenance actions (relocate_prefix, purge_prefix), but there is no clear ingest/write tool, leaving a notable gap for a knowledge vault server.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP-compatible agents such as Claude and Cursor to retrieve permission-aware, structured context from local or hosted data stores. Exposes tools for semantic search, entity and relationship lookup, memory access, context pack compilation, source attribution, and retrieval explanation.
      1
      Apache 2.0
    • F
      license
      A
      quality
      C
      maintenance
      Enables AI agents to discover and query enterprise knowledge documents and business metrics through standardized MCP tools, supporting retrieval, structured sales/order analysis, anomaly scanning, and data lineage lookups.
      12
      -
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to access a local-first personal context and memory layer through MCP tools for bootstrapping user context, semantically searching Markdown vault knowledge, reading files, listing topics, and adding controlled memories. It provides deterministic context retrieval, provenance-cited vector search, and secure vault operations while keeping data local and model-independent.
      6
      MIT