Skip to content

Architecture

MidOS is a knowledge-as-a-service platform for AI agents, built on the Model Context Protocol (MCP). It provides curated, validated knowledge through semantic search and structured tools.

┌─────────────────────────────────────────────┐
│ MCP Clients │
│ Claude Desktop │ Cursor │ VS Code │ Cline │
└────────┬────────────────────────────────────┘
│ stdio / HTTP (JSON-RPC 2.0)
┌─────────────────────────────────────────────┐
│ MidOS MCP Server │
│ ┌──────────┐ ┌──────────┐ ┌─────────────┐ │
│ │ Auth & │ │ Tool │ │ Metrics & │ │
│ │ Tiers │ │ Router │ │ Sessions │ │
│ └──────────┘ └──────────┘ └─────────────┘ │
└────────┬────────────────────────────────────┘
┌─────────────────────────────────────────────┐
│ Knowledge Layer │
│ ┌──────────┐ ┌──────────┐ ┌─────────────┐ │
│ │ Chunks │ │ Skills │ │ EUREKA/SOTA │ │
│ │ (21346) │ │ (118) │ │ (200) │ │
│ └──────────┘ └──────────┘ └─────────────┘ │
│ ┌──────────┐ ┌──────────┐ │
│ │ Truth │ │ Vector │ │
│ │ Patches │ │ Store │ │
│ │ (29) │ │ (290K) │ │
│ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────┘

Content flows through 5 layers of validation before reaching agents:

Raw content (books, docs, research, Discord harvests) enters the staging area. It gets distilled into focused chunks — each chunk covers one concept, one pattern, or one technique.

  • Input: Books, documentation, research papers, community discussions
  • Output: 21,000+ focused knowledge chunks
  • Quality: Frontmatter with metadata, tags, source attribution

Chunks that describe actionable patterns are promoted to skills. Each skill is a self-contained document covering a specific technology or practice.

  • Coverage: 20+ tech stacks (React, FastAPI, Django, NestJS, Go, Rust, K8s, etc.)
  • Format: Structured markdown with code examples, patterns, and anti-patterns
  • Count: 118 skills

Corrections to common misconceptions or outdated information. When we discover that a widely-held belief is wrong, we create a truth patch.

  • Format: Problem → Evidence → Correction
  • Count: 29 verified documents (21 root + 9 patches)
  • Examples: Cache invalidation patterns, ORM anti-patterns, security misconfigurations

Breakthrough discoveries and improvements validated through testing. Each EUREKA entry includes implementation details and measured ROI.

  • Format: Problem → Solution → Test Results → ROI
  • Count: 168 validated improvements
  • Promotion: High-impact EUREKAs get promoted to SOTA

The top-tier knowledge — the best patterns, the most impactful discoveries. Only content with proven, significant value reaches this level.

  • Count: 32 state-of-the-art entries
  • Access: Dev tier and above

MidOS uses LanceDB with Gemini embeddings (3072-dimensional) for semantic search.

PropertyValue
EngineLanceDB
Embedding Modelgemini-embedding-001
Dimensions3,072
Total Vectors290,000+
Search ModesVector, Keyword, Hybrid
RerankingBuilt-in relevance reranking
  • Keyword: Fast grep-based search. Good for exact matches.
  • Vector (Semantic): Embedding similarity search. Finds conceptually related content even with different wording.
  • Hybrid (default): Keyword first, semantic fallback. Best of both worlds.

Every tool call passes through the auth layer:

  1. Extract Authorization: Bearer <token> header
  2. Localhost requests get admin access (bypass)
  3. Token prefix determines tier: midos_sk_dev_*, midos_sk_ops_*, midos_sk_team_*, midos_sk_ent_*
  4. No token = free tier

See Access Tiers for the full breakdown.

TransportCommandUse Case
stdio (default)midos-mcp serveSingle-client IDE integration
HTTPmidos-mcp serve --httpMulti-client, remote access

Both transports use JSON-RPC 2.0 per the MCP specification.

All tools enforce input bounds to prevent abuse:

  • Query strings truncated to 5,000 characters
  • Name lookups truncated to 200 characters
  • Results capped at 100 items max
  • File content truncated to 10,000 characters
  • Path traversal prevention on all file operations