Skip to main content
Glama

Aegis — Agent-Ready Knowledge Compiler

Aegis is a durable, evidence-grounded knowledge compiler that transforms instructional video content (starting with YouTube playlists in v1) into versioned, structured, and validated knowledge packages exposed to AI agents via the Model Context Protocol (MCP 2026-07-28).


Key Capabilities

  • Deterministic 10-Stage Pipeline: Discover $\rightarrow$ Acquire $\rightarrow$ Evidence Extraction $\rightarrow$ Segmentation $\rightarrow$ Structured Extraction $\rightarrow$ Evidence Binding $\rightarrow$ Enhancement $\rightarrow$ Validation $\rightarrow$ Vector Indexing $\rightarrow$ Atomic Publication.

  • PostgreSQL 18 + pgvector Single Source of Truth: All stage executions, worker leases, idempotent operation identities, evidence citations, and knowledge items reside in PostgreSQL.

  • Content-Addressed Immutable Artifacts: All intermediate outputs and raw transcripts are hashed (SHA256) and stored in S3/MinIO.

  • Hybrid Semantic & Lexical Retrieval: Combines dense text-embedding-3-small vector similarity with PostgreSQL full-text search and evidence-support boosting.

  • Read-Only MCP 2026-07-28 Server: 5 read-only tools exposed over stdio and Streamable HTTP for seamless integration with Claude Desktop, Cursor, and custom agent SDKs.

  • Operator Console: Next.js 16 + React 19 web dashboard for ingestion, run tracking, evidence timeline exploration, and human-in-the-loop review queue resolution.


Related MCP server: youtube-ai

Monorepo Layout

aegis/
├── apps/
│   ├── api/          # FastAPI 0.139 Control REST API (:8000)
│   ├── worker/       # Background processing daemon & reconciler
│   ├── mcp/          # Read-only MCP 2026-07-28 Server (:8001)
│   └── web/          # Next.js 16 + React 19 Operator Console (:3000)
├── packages/
│   ├── domain/       # Pure domain models (zero framework dependencies)
│   ├── schemas/      # Pydantic v2 validation models & extraction schemas
│   ├── database/     # SQLAlchemy 2.0 async models (16 tables) & repositories
│   ├── pipeline/     # Idempotency engine, lease manager, 10-stage graph
│   ├── providers/    # External AI (OpenAI GPT-5.6) & YouTube (yt-dlp) adapters
│   ├── retrieval/    # Hybrid vector + lexical search engine
│   └── storage/      # Content-addressed S3/MinIO storage backend
├── migrations/       # Alembic database migrations
├── infra/
│   ├── compose/      # Docker Compose definition & overrides
│   ├── docker/       # Production multi-stage Dockerfiles
│   └── scripts/      # Backup, restore, migration, and healthcheck utilities
├── tests/            # Unit, integration, contract, evaluation, and crash recovery tests
└── docs/             # Architecture, REST API, operations runbook, and MCP guide

Technology Stack

Layer

Technology

Backend Runtime

Python 3.13

Dependency Manager

uv (Python) + pnpm (Node.js)

Control API

FastAPI 0.139, Pydantic v2

Orchestration & State

LangGraph 1.2, SQLAlchemy 2.0 Async, Alembic

Database & Search

PostgreSQL 18 + pgvector 0.8.6

Object Storage

AWS S3 / MinIO (Content-Addressed)

LLM & Embeddings

OpenAI Responses API (GPT-5.6) / text-embedding-3-small

Media Extraction

yt-dlp 2026.7.4

Protocol Integration

Model Context Protocol (MCP 2026-07-28 Python SDK v2)

Operator Console

Next.js 16, React 19, TypeScript, Tailwind CSS

Quality & Linters

pytest, pytest-asyncio, Ruff


Quickstart

Option A: One-Liner Production Installation (curl)

Bootstrap dependencies, virtual environment, and configuration with a single command:

# Automated installer (fetches uv, clones/syncs repo, initializes .env with secure keys, checks Docker)
curl -fsSL https://raw.githubusercontent.com/Demi8-patch/aegis/main/install.sh | bash

Or execute locally from the repository root:

./install.sh

Option B: Quickstart with uv

# 1. Clone and Bootstrap Environment
cp .env.example .env
uv sync
pnpm install

# 2. Verify System Health & Diagnostics
uv run aegis doctor

# 3. Start PostgreSQL 18 (with pgvector) and MinIO
docker compose -f infra/compose/docker-compose.yml up -d

# 4. Apply Database Migrations
uv run aegis migrate

Unified Aegis CLI Reference

Aegis provides a comprehensive command-line tool aegis accessible via uv run aegis <command> (or directly as aegis when installed):

Command

Description

Example

aegis doctor

Probes environment, database, pgvector, S3 storage, and OpenAI API keys.

uv run aegis doctor

aegis init

Safely creates .env with a cryptographically secure 256-bit SECRET_KEY.

uv run aegis init

aegis ingest <url>

Compiles a YouTube playlist or video end-to-end through the 10-stage pipeline.

uv run aegis ingest "https://youtube.com/playlist?list=..."

aegis mcp

Starts the read-only Model Context Protocol (MCP 2026-07-28) server.

uv run aegis mcp --port 8001 or uv run aegis mcp --stdio

aegis api

Launches the FastAPI Control REST API server with Swagger docs.

uv run aegis api --port 8000

aegis worker

Runs the durable background worker daemon and periodic lease reconciler.

uv run aegis worker

aegis eval

Runs continuous retrieval evaluation benchmarks or records regression cases.

uv run aegis eval --list-cases

aegis migrate

Applies latest Alembic database migrations.

uv run aegis migrate

aegis backup

Creates a compressed PostgreSQL database dump and syncs S3 artifacts.

uv run aegis backup --backup-dir ./backups

aegis restore

Restores database schema and object storage artifacts from a backup archive.

uv run aegis restore backups/aegis_db_*.sql.gz


Launching Development Services

# Terminal 1: FastAPI Control API (:8000)
uv run aegis api --port 8000 --reload

# Terminal 2: Aegis Background Worker & Reconciler
uv run aegis worker

# Terminal 3: Read-Only MCP Server (:8001 / stdio)
uv run aegis mcp

# Terminal 4: Operator Web Console (:3000)
pnpm --filter aegis-web dev

The Operator Console will be live at http://localhost:3000, the Control API at http://localhost:8000, and the MCP endpoint at http://localhost:8001/mcp.


MCP Tools Reference

The Aegis MCP server exposes 5 read-only tools conforming to the MCP 2026-07-28 specification:

MCP Tool

Description

search_knowledge

Hybrid vector + lexical search across published knowledge items with evidence citations.

get_knowledge

Fetches a structured knowledge item by UUID with bound citations and semantic relationships.

get_evidence

Retrieves the raw transcript segment, start/end video seconds, and confidence score.

search_sources

Searches imported playlists and videos by title, URL, channel, or video ID.

get_source

Fetches source metadata, video durations, and published package versions.

For client integration setup (Claude Desktop, Cursor, Windsurf, custom agents), see the MCP Client Integration Guide.


Testing & Quality Assurance

Aegis includes a comprehensive test suite with 82+ tests covering unit logic, integration flows, crash recovery, prompt injection defense, and retrieval quality.

# Run full pytest suite (82 passed)
uv run pytest tests/

# Run Ruff linter and style checks
uv run ruff check .
uv run ruff format --check .

# Build Wheel & Source Distribution
uv build

# Build Next.js Operator Web Console
pnpm --filter aegis-web build

Production Operations & Disaster Recovery


License

Apache-2.0

Available Tools

5 tools
get_evidenceA

Retrieve raw source evidence snippet, timestamps, video association, and confidence.

Args: evidence_id: UUID string of the evidence record.

ParametersJSON Schema
NameRequiredDescriptionDefault
evidence_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. The verb 'Retrieve' implies a safe read operation, and listing the returned components adds context. However, it does not explicitly confirm read-only behavior, error scenarios, or any side effects, leaving some transparency gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: a single clear sentence followed by a brief Args section. Every word earns its place, and there is no redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter get-by-ID tool, the description covers purpose, the parameter, and the nature of the returned data. An output schema exists to fully define return structure. Missing only explicit usage guidance, which prevents a perfect score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema only declares evidence_id as a string with no description. The tool description adds that it is a 'UUID string of the evidence record', giving the parameter real semantic meaning beyond type and name.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'Retrieve' followed by a precise list of returned content (raw source evidence snippet, timestamps, video association, confidence). This clearly distinguishes it from sibling tools like get_source and get_knowledge, which presumably retrieve different resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage: this tool fetches a specific evidence record by its ID. However, it provides no explicit guidance on when to use this tool versus alternatives (e.g., search_sources or get_source), nor any exclusions or prerequisites beyond the required evidence_id.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_knowledgeA

Fetch a specific knowledge item by its UUID, including bound evidence citations and relationships.

Args: knowledge_id: UUID string of the knowledge item.

ParametersJSON Schema
NameRequiredDescriptionDefault
knowledge_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the behavioral disclosure burden. It clearly states that this is a fetch operation and specifies what is included in the result ('bound evidence citations and relationships'). It does not mention error cases or permissions, but for a simple read operation the description provides meaningful behavioral context beyond the tool name.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two lines with a short Args block. It is concise, front-loaded with the primary action, and contains no filler. Every sentence adds useful information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple get-by-UUID tool, the description is complete: it states the resource, the identifier format, and the expected result contents. An output schema exists, so the absence of detailed return formatting is acceptable. The description sufficiently equips an agent to select and invoke the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides only a property name 'knowledge_id' with no description, so the description must compensate. The Args section explicitly explains that knowledge_id is a 'UUID string of the knowledge item', adding precise type and semantic meaning. This fully clarifies the parameter even though the schema coverage is 0%.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with 'Fetch a specific knowledge item by its UUID', using a specific verb and resource. It also identifies the returned content ('bound evidence citations and relationships'), which distinguishes it from sibling tools like get_evidence or search_knowledge.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description makes the usage context clear: use this when you have a specific knowledge item's UUID and need its details, evidence citations, and relationships. It does not explicitly mention alternatives or when not to use it, but the 'by UUID' scope implies a direct lookup rather than a search, which is a clear context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_sourceA

Get source/video/playlist details, ingestion status, and published package versions.

Args: source_id: UUID string of the source, playlist, or video.

ParametersJSON Schema
NameRequiredDescriptionDefault
source_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description carries the transparency burden. It discloses that the tool returns details, ingestion status, and published package versions, but omits error behavior, permissions, or read-only confirmation. Still, it provides substantive information about the returned data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with a clear Arg spec, no fluff, and front-loads the primary action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple (single parameter, no nested objects) and has an output schema, so the description need not detail returns. It covers the entity types and mentions key data facets ('ingestion status', 'published package versions'). It lacks explicit guidance for handling invalid IDs but is otherwise complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema only defines source_id as a string. The description adds that it is a UUID and can represent a source, playlist, or video, substantially enriching the semantic meaning beyond the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'Get' and identifies the resource as source/video/playlist, clearly distinguishing it from sibling tools like search_sources and get_knowledge by type and operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when an ID is available but does not explicitly state when to prefer this over search_sources or mention exclusions. No alternative tools are referenced.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_knowledgeA

Search published knowledge items and packages using hybrid semantic + lexical retrieval.

Args: query: Natural language query to search knowledge items for. item_types: Optional filter for specific item types (e.g. CONCEPT, PROCEDURE, RULE). min_confidence: Minimum confidence score filter (0.0 to 1.0). limit: Maximum number of ranked results to return (default 10).

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes
item_typesNo
min_confidenceNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden of disclosing behavior. It mentions 'published' and 'hybrid semantic + lexical retrieval,' which provides some context, but it does not explicitly state that the operation is read-only or describe potential side effects, pagination, or other operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured, beginning with a clear one-sentence summary followed by concise parameter explanations. It is slightly longer than necessary but each line adds value, making it efficient and readable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the tool's purpose, parameter semantics, and retrieval method, and an output schema exists so return values need not be explained. It lacks explicit alternative usage but is otherwise sufficiently complete for a search tool with a straightforward scope.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema provides only titles and types (e.g., 'Query', 'Limit'), while the description adds substantial meaning by explaining each parameter, such as 'query: Natural language query to search knowledge items for' and 'min_confidence: Minimum confidence score filter (0.0 to 1.0).' This effectively compensates for the 0% schema description coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific verb and resource: 'Search published knowledge items and packages using hybrid semantic + lexical retrieval.' This distinguishes it from sibling tools like search_sources, which focuses on sources rather than knowledge items.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool is for searching knowledge items but does not explicitly state when to use it over alternatives or provide exclusion scenarios. There is no mention of when to prefer search_sources or other siblings, so usage guidance is only implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_sourcesA

Search ingested sources, playlists, and videos by title, URL, or metadata.

Args: query: Search term for source title, channel, or URL. limit: Maximum number of results to return.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It states the search operation and scope but does not mention return format, pagination, side effects (though likely read-only), or any constraints. This lack of detail beyond the basic intent leaves significant ambiguity for an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: one sentence defining the tool's action and scope, followed by a two-argument listing. All information is front-loaded and every word contributes value, with no redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple 2-parameter search tool with an output schema, the description covers the essential scope and parameters. However, it lacks comparison to sibling tools and does not clarify edge cases like empty results or limit behavior. Still, given the low complexity and presence of an output schema, it is reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, but the description compensates by explaining both parameters: query is a search term for title, channel, or URL, and limit is the maximum result count. This adds meaningful semantic context beyond the schema's raw types and defaults, though it could be more detailed (e.g., query matching behavior).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific action ('Search') and a defined resource scope ('ingested sources, playlists, and videos'), distinguishing it from sibling tools like search_knowledge which target knowledge items. It also mentions searchable attributes (title, URL, metadata), making the purpose unmistakable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use the tool (when searching ingested media sources), but it does not explicitly say when to prefer it over alternatives like search_knowledge or get_source. No exclusions or comparative guidance is provided, leaving the usage context somewhat implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv0.1.0
    • First observedget_evidence
    • First observedget_knowledge
    • First observedget_source
    • First observedsearch_knowledge
    • First observedsearch_sources

TDQS

A4.2/5.0
Disambiguation5/5

Each tool targets a distinct resource and action: fetching by ID vs searching by query, and separating knowledge, evidence, and sources. There is no overlap or ambiguity between the five tools.

Naming Consistency5/5

All tool names follow the same verb_noun pattern using either 'get_' or 'search_' prefixes. The naming is perfectly consistent and predictable.

Tool Count5/5

With 5 tools, the server is well-scoped for a knowledge and evidence retrieval system. Each tool contributes a distinct function and none are redundant or excessive.

Completeness4/5

The set covers retrieval and search for knowledge, evidence, and sources comprehensively. However, it lacks any mutation or ingestion operations, which may be a minor gap if the server is intended to manage the full lifecycle.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    B
    maintenance
    Provides a read-only MCP interface to query and retrieve verifiable evidence from a local memory bank, supporting search, dossier, chronology, source, and evidence tools.
    6
    BSD Zero Clause
  • F
    license
    Not graded
    quality
    C
    maintenance
    Provides MCP tools to search engineering runbooks and historical incidents using semantic retrieval, supporting evidence-grounded incident investigation.
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Demi8-patch/aegis'

If you have feedback or need assistance with the MCP directory API, please join our Discord server