# martin-papy/qdrant-loader architecture

> Architecture diagram of the GitHub repository martin-papy/qdrant-loader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/martin-papy/qdrant-loader
- Repository: https://github.com/martin-papy/qdrant-loader

## Overview

1. **Repository shape**
   This is a monorepo with three runtime packages and one documentation site:
   - `qdrant-loader`: ingestion and indexing engine
   - `qdrant-loader-core`: shared LLM/logging abstractions
   - `qdrant-loader-mcp-server`: retrieval/search server exposed through MCP
   - `website`: static docs/marketing site built from Markdown

2. **End-to-end system flow**
   The main data path is: external content sources → connectors → file conversion/chunking → embeddings/metadata → Qdrant vector store → MCP search server → AI tools/clients.  
   The ingestion package writes data into Qdrant; the MCP server reads from Qdrant and returns formatted search/intelligence results to IDEs and other MCP-compatible clients.

3. **Ingestion engine boundary**
   `packages/qdrant-loader` owns all write-side behavior. It is responsible for:
   - workspace/project configuration
   - source discovery and syncing
   - document conversion and chunking
   - embedding generation
   - collection initialization and upserts into Qdrant
   - incremental state tracking and monitoring

4. **Source connector layer**
   The ingestion package has a connector abstraction with concrete integrations for:
   - Git repositories
   - Confluence Cloud/Data Center
   - Jira Cloud/Data Center
   - Public web docs
   - Local files  
   Shared HTTP, attachment, and rate-limit utilities sit underneath these connectors. This boundary is where source-specific authentication, pagination, crawling, and file handling are isolated.

5. **Document processing pipeline**
   The core ingestion flow is layered:
   - source-specific connectors fetch raw content
   - file conversion normalizes non-text inputs via MarkItDown-style conversion support
   - chunking strategies split content by type
   - embeddings are generated
   - results are upserted into Qdrant  
   The chunking layer is deliberately modular, with separate strategies for markdown, code, HTML, JSON, and default/text content, plus metadata extraction and semantic analysis.

6. **State, incrementality, and workspace model**
   `qdrant-loader` has explicit state management under `core/state` and project/workspace management under `core/project_manager.py` and `config/*`.  
   This is the mechanism that supports incremental ingestion, change detection, and multi-project organization. Configuration is centrally modeled around a workspace containing global settings and per-project sources.

7. **Qdrant as the persistence backbone**
   Qdrant is the main durable store and the boundary between ingestion and retrieval.  
   Ingestion code initializes collections, manages collection settings, and writes vectors plus metadata.  
   Retrieval code in the MCP server assumes the data model already exists in Qdrant and focuses on search, ranking, and presentation.

8. **LLM/provider abstraction**
   `qdrant-loader-core` contains the provider-agnostic LLM layer. It abstracts OpenAI, Azure OpenAI, Ollama, and custom endpoints behind a shared factory/settings interface.  
   This package also handles rate limiting, tokenization, provider-specific errors, and structured logging. It is a shared dependency for both ingestion-time enrichment and MCP-time intelligence features.

9. **MCP server boundary**
   `packages/qdrant-loader-mcp-server` is the read-only integration layer for AI tools. It exposes MCP protocol support with dual transport:
   - stdio for local IDE integration
   - HTTP/SSE for networked use and streaming  
   The server owns protocol handling, request routing, session/transport concerns, and the user-facing tool schema.

10. **Search architecture inside the MCP server**
   Search is split into multiple layers:
   - query parsing and preprocessing
   - retrieval engines
   - result combination/ranking
   - output formatting  
   There are separate pathways for semantic/vector search, hybrid search, faceted search, and topic/intelligence-oriented workflows. This separation lets the server combine lexical, vector, metadata, and reranking signals before returning results.

11. **Cross-document intelligence features**
   The MCP server includes a larger “intelligence” subsystem beyond plain search:
   - document similarity and clustering
   - relationship analysis
   - knowledge graph construction/traversal
   - conflict detection and complementary content discovery  
   These features are organized under `search/enhanced` and `search/hybrid`, and they consume the same indexed corpus in Qdrant while adding analytical pipelines and optional LLM-assisted validation.

12. **Formatting and protocol adaptation**
   The MCP layer includes dedicated formatters and handlers that translate search/intelligence results into protocol-friendly outputs.  
   This is an important boundary: internal search models are not returned directly. Instead, results are normalized into MCP schemas and formatted for different tool modes and response shapes.

13. **Docs site and build automation**
   The `website` directory is a separate static-site build system that turns Markdown documentation into the published site.  
   GitHub Actions workflows cover documentation publishing, tests, quality gates, and release automation. These are supporting systems rather than runtime services, but they matter for how the repo is maintained and delivered.

14. **Testing strategy**
   The repo is heavily tested with package-level unit tests and integration tests.  
   The ingestion package emphasizes connector, chunking, pipeline, config, and state tests. The MCP server has extensive search/transport/integration coverage, reflecting its split architecture and the number of result-processing paths that must remain stable.

15. **Practical architecture summary**
   If you diagram this repository, draw three main boxes:
   - **Ingestion/write path**: source systems → connectors → conversion/chunking/embedding → Qdrant
   - **Core shared services**: LLM provider abstraction, logging, rate limiting
   - **MCP/read path**: Qdrant → search/hybrid/intelligence engines → MCP transports → IDE/client  
   Everything else is supporting structure around configuration, state, docs, and delivery.

Main entry points: [`packages/qdrant-loader/src/qdrant_loader/core/pipeline`](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/pipeline) (Ingestion pipeline), [`packages/qdrant-loader/src/qdrant_loader/connectors`](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/connectors) (Connectors), [`packages/qdrant-loader/src/qdrant_loader/core/embedding`](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/embedding) (Embeddings), [`packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/mcp`](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/mcp) (Tool handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_loader["qdrant-loader"]
  node_workspace_config["Workspace config<br/>config model<br/>[workspace.py]"]
  node_project_state[("Project state<br/>state management")]
  node_connectors["Connectors<br/>source adapters"]
  node_shared_http["HTTP utilities<br/>shared infra"]
  node_file_conversion["File conversion<br/>normalization"]
  node_chunking["Chunking pipeline<br/>content processing"]
  node_semantic_text["Text analysis<br/>enrichment"]
  node_embeddings["Embeddings<br/>vectorization"]
  node_qdrant_write[("Qdrant write<br/>vector store<br/>[qdrant_manager.py]")]
  node_pipeline["Ingestion pipeline<br/>orchestration"]
end

subgraph group_grp_core["qdrant-loader-core"]
  node_llm_core["LLM factory<br/>shared llm<br/>[factory.py]"]
  node_logging_core["Structured logging<br/>shared logging<br/>[logging.py]"]
  node_rate_limit_core["Rate limiting<br/>shared control<br/>[ratelimit.py]"]
end

subgraph group_grp_mcp["qdrant-loader-mcp-server"]
  node_mcp_transport["MCP transport<br/>protocol layer"]
  node_mcp_handlers["Tool handlers<br/>request handling"]
  node_search_engines["Search engines<br/>retrieval engine"]
  node_intelligence["Intelligence<br/>analysis pipeline"]
  node_formatters["Result formatters<br/>presentation"]
  node_qdrant_read[("Qdrant read<br/>vector store")]
end

subgraph group_grp_website["website"]
  node_website_build["Docs site<br/>static site<br/>[build.py]"]
end

subgraph group_grp_delivery["delivery"]
  node_workflows["GitHub Actions<br/>automation<br/>[workflows]"]
end

node_sources(("Source systems<br/>external inputs"))

node_sources -->|"fetch"| node_connectors
node_connectors -->|"uses"| node_shared_http
node_connectors -->|"normalize"| node_file_conversion
node_file_conversion -->|"feed"| node_chunking
node_chunking -->|"enrich"| node_semantic_text
node_semantic_text -->|"prepare"| node_embeddings
node_embeddings -->|"upsert"| node_qdrant_write
node_workspace_config -->|"configure"| node_pipeline
node_project_state -->|"track"| node_pipeline
node_pipeline -->|"orchestrates"| node_connectors
node_pipeline -->|"routes"| node_file_conversion
node_pipeline -->|"routes"| node_chunking
node_pipeline -->|"routes"| node_embeddings
node_pipeline -->|"writes"| node_qdrant_write
node_llm_core -->|"supports"| node_embeddings
node_llm_core -->|"supports"| node_intelligence
node_logging_core -->|"observes"| node_pipeline
node_rate_limit_core -->|"governs"| node_llm_core
node_qdrant_read -->|"queries"| node_search_engines
node_search_engines -->|"serve"| node_mcp_handlers
node_intelligence -->|"serve"| node_mcp_handlers
node_mcp_transport -->|"routes"| node_mcp_handlers
node_mcp_handlers -->|"formats"| node_formatters
node_search_engines -->|"retrieves"| node_qdrant_read
node_intelligence -->|"analyzes"| node_qdrant_read
node_website_build -->|"published by"| node_workflows

click node_workspace_config "https://github.com/martin-papy/qdrant-loader/blob/main/packages/qdrant-loader/src/qdrant_loader/config/workspace.py"
click node_project_state "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/state"
click node_connectors "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/connectors"
click node_shared_http "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/connectors/shared/http"
click node_file_conversion "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/file_conversion"
click node_chunking "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/chunking/strategy"
click node_semantic_text "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/text_processing"
click node_embeddings "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/embedding"
click node_qdrant_write "https://github.com/martin-papy/qdrant-loader/blob/main/packages/qdrant-loader/src/qdrant_loader/core/qdrant_manager.py"
click node_pipeline "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/pipeline"
click node_llm_core "https://github.com/martin-papy/qdrant-loader/blob/main/packages/qdrant-loader-core/src/qdrant_loader_core/llm/factory.py"
click node_logging_core "https://github.com/martin-papy/qdrant-loader/blob/main/packages/qdrant-loader-core/src/qdrant_loader_core/logging.py"
click node_rate_limit_core "https://github.com/martin-papy/qdrant-loader/blob/main/packages/qdrant-loader-core/src/qdrant_loader_core/llm/ratelimit.py"
click node_mcp_transport "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/transport"
click node_mcp_handlers "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/mcp"
click node_search_engines "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/search/engine"
click node_intelligence "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/search/enhanced"
click node_formatters "https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/mcp/formatters"
click node_website_build "https://github.com/martin-papy/qdrant-loader/blob/main/website/build.py"
click node_workflows "https://github.com/martin-papy/qdrant-loader/blob/main/.github/workflows"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_workspace_config,node_project_state,node_connectors,node_shared_http,node_file_conversion,node_chunking,node_semantic_text,node_embeddings,node_qdrant_write,node_pipeline toneBlue
class node_llm_core,node_logging_core,node_rate_limit_core toneAmber
class node_mcp_transport,node_mcp_handlers,node_search_engines,node_intelligence,node_formatters,node_qdrant_read toneMint
class node_website_build toneRose
class node_workflows toneIndigo
class node_sources toneNeutral
```

## Components

### qdrant-loader

Write-side ingestion and indexing engine

- [Workspace config](https://github.com/martin-papy/qdrant-loader/blob/main/packages/qdrant-loader/src/qdrant_loader/config/workspace.py): config model · Global settings, per-project sources, and validation for multi-project ingestion · `packages/qdrant-loader/src/qdrant_loader/config/workspace.py`
- [Project state](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/state): state management · Incremental change tracking, session state, and document-state queries · `packages/qdrant-loader/src/qdrant_loader/core/state`
- [Connectors](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/connectors): source adapters · Source-specific integrations for Git, Confluence, Jira, public docs, and local files · `packages/qdrant-loader/src/qdrant_loader/connectors`
- [HTTP utilities](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/connectors/shared/http): shared infra · Common HTTP client, attachment, and rate-limit support under connectors · `packages/qdrant-loader/src/qdrant_loader/connectors/shared/http`
- [File conversion](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/file_conversion): normalization · Non-text input detection and MarkItDown-style conversion to text · `packages/qdrant-loader/src/qdrant_loader/core/file_conversion`
- [Chunking pipeline](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/chunking/strategy): content processing · Strategy-based splitting for markdown, code, HTML, JSON, and default text · `packages/qdrant-loader/src/qdrant_loader/core/chunking/strategy`
- [Text analysis](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/text_processing): enrichment · Semantic analysis and topic modeling used during ingestion enrichment · `packages/qdrant-loader/src/qdrant_loader/core/text_processing`
- [Embeddings](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/embedding): vectorization · Embedding generation for indexed content · `packages/qdrant-loader/src/qdrant_loader/core/embedding`
- [Qdrant write](https://github.com/martin-papy/qdrant-loader/blob/main/packages/qdrant-loader/src/qdrant_loader/core/qdrant_manager.py): vector store · Collection initialization, upserts, and metadata persistence into Qdrant · `packages/qdrant-loader/src/qdrant_loader/core/qdrant_manager.py`
- [Ingestion pipeline](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader/src/qdrant_loader/core/pipeline): orchestration · Async source processing, worker orchestration, and end-to-end write flow · `packages/qdrant-loader/src/qdrant_loader/core/pipeline`

### qdrant-loader-core

Shared LLM and logging abstractions

- [LLM factory](https://github.com/martin-papy/qdrant-loader/blob/main/packages/qdrant-loader-core/src/qdrant_loader_core/llm/factory.py): shared llm · Provider-agnostic factory and settings for OpenAI, Azure OpenAI, Ollama, and custom endpoints · `packages/qdrant-loader-core/src/qdrant_loader_core/llm/factory.py`
- [Structured logging](https://github.com/martin-papy/qdrant-loader/blob/main/packages/qdrant-loader-core/src/qdrant_loader_core/logging.py): shared logging · Logging filters, processors, and redaction support shared across packages · `packages/qdrant-loader-core/src/qdrant_loader_core/logging.py`
- [Rate limiting](https://github.com/martin-papy/qdrant-loader/blob/main/packages/qdrant-loader-core/src/qdrant_loader_core/llm/ratelimit.py): shared control · Tokenization, provider throttling, and rate-limit policies for LLM usage · `packages/qdrant-loader-core/src/qdrant_loader_core/llm/ratelimit.py`

### qdrant-loader-mcp-server

Read-side MCP retrieval server

- [MCP transport](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/transport): protocol layer · stdio and HTTP/SSE transports, sessions, and protocol routing · `packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/transport`
- [Tool handlers](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/mcp): request handling · MCP request routing, search handlers, and intelligence handlers · `packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/mcp`
- [Search engines](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/search/engine): retrieval engine · Semantic, hybrid, faceted, and topic-oriented retrieval orchestration · `packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/search/engine`
- [Intelligence](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/search/enhanced): analysis pipeline · Cross-document similarity, clustering, relationship analysis, conflict detection, and knowledge graph workflows · `packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/search/enhanced`
- [Result formatters](https://github.com/martin-papy/qdrant-loader/tree/main/packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/mcp/formatters): presentation · Normalization of internal search results into MCP-friendly response shapes · `packages/qdrant-loader-mcp-server/src/qdrant_loader_mcp_server/mcp/formatters`
- **Qdrant read**: vector store · Persistent corpus read by the MCP server for retrieval and analysis

### website

Static docs and marketing site

- [Docs site](https://github.com/martin-papy/qdrant-loader/blob/main/website/build.py): static site · Markdown-driven docs and marketing site build system · `website/build.py`

### delivery

Automation and release support

- [GitHub Actions](https://github.com/martin-papy/qdrant-loader/blob/main/.github/workflows): automation · Docs publishing, tests, quality gates, and release workflows · `.github/workflows`

### Other components

- **Source systems**: external inputs · Git, Confluence, Jira, web docs, and local files entering the ingestion path

## Connections

- Source systems → Connectors: fetch · Source systems are discovered and synced by connectors
- Connectors → HTTP utilities: uses · Connectors rely on shared HTTP, attachment, and rate-limit utilities
- Connectors → File conversion: normalize · Raw content and attachments are converted into text-friendly form
- File conversion → Chunking pipeline: feed · Converted documents enter type-specific chunking strategies
- Chunking pipeline → Text analysis: enrich · Chunks are analyzed for semantics and topical signals
- Text analysis → Embeddings: prepare · Analyzed text is transformed into vector-ready inputs
- Embeddings → Qdrant write: upsert · Vectors and metadata are written into Qdrant collections
- Workspace config → Ingestion pipeline: configure · Workspace and project settings drive ingestion orchestration
- Project state → Ingestion pipeline: track · State changes and incremental sync decisions guide the pipeline
- Ingestion pipeline → Connectors: orchestrates · The ingestion pipeline coordinates source processing
- Ingestion pipeline → File conversion: routes · Pipeline stages pass documents into conversion when needed
- Ingestion pipeline → Chunking pipeline: routes · Pipeline stages dispatch normalized content to chunking
- Ingestion pipeline → Embeddings: routes · Pipeline stages send chunks to embedding generation
- Ingestion pipeline → Qdrant write: writes · The pipeline culminates in Qdrant initialization and upserts
- LLM factory → Embeddings: supports · Shared LLM abstraction can be used for ingestion-time enrichment
- LLM factory → Intelligence: supports · The same provider layer supports intelligence workflows in the MCP server
- Structured logging → Ingestion pipeline: observes · Ingestion uses shared structured logging and redaction
- Rate limiting → LLM factory: governs · LLM usage is controlled by shared throttling and tokenization support
- Qdrant read → Search engines: queries · Retrieval engines read the indexed corpus from Qdrant
- Search engines → Tool handlers: serve · Search engines are exposed through MCP request handlers
- Intelligence → Tool handlers: serve · Cross-document intelligence workflows are surfaced by MCP handlers
- MCP transport → Tool handlers: routes · Transport layer dispatches protocol requests to handlers
- Tool handlers → Result formatters: formats · Handlers convert internal results into protocol-friendly outputs
- Search engines → Qdrant read: retrieves · Search paths resolve against the existing Qdrant data model
- Intelligence → Qdrant read: analyzes · Intelligence workflows analyze the same indexed corpus
- Docs site → GitHub Actions: published by · The docs site is built and deployed through repository workflows
