# loganathansellappa/-rag-mcp-lab architecture

> Architecture diagram of the GitHub repository loganathansellappa/-rag-mcp-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/loganathansellappa/-rag-mcp-lab
- Repository: https://github.com/loganathansellappa/-rag-mcp-lab

## Overview

This repository is presented as a RAG learning kit: markdown documents are chunked, embedded, searched semantically, and optionally used to synthesize cited answers. The README also describes an MCP service exposing search and generation tools. The supplied tree contains only the three pipeline modules, not the documented service, configuration, or core implementation; those documented capabilities are represented at the existing `src/` directory, with README evidence. The visible searcher is a standalone CLI/library, so its link to the documented service is not asserted.

Main entry points: [`src`](https://github.com/loganathansellappa/-rag-mcp-lab/tree/master/src) (Answer generator), [`examples/embedded_chunks.json`](https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/examples/embedded_chunks.json) (Embedded chunks), [`src/searcher.py`](https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/src/searcher.py) (Semantic search), [`src/chunker.py`](https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/src/chunker.py) (Markdown chunker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_content["Knowledge preparation"]
  node_chunker["Markdown chunker<br/>[chunker.py]"]
  node_chunks["Chunk JSON<br/>[chunks.json]"]
  node_embedder["Chunk embedder<br/>[embedder.py]"]
end

subgraph group_retrieval["Semantic retrieval"]
  node_vectors["Embedded chunks"]
  node_searcher["Semantic search<br/>[searcher.py]"]
end

subgraph group_service["RAG service"]
  node_kb["Knowledge base"]
  node_retriever["RAG retriever"]
  node_generator["Answer generator"]
  node_mcp["MCP tool server"]
end

node_author["Knowledge documents"]
node_query(("Search query"))
node_agent(("MCP client agent"))
node_litellm{{"LiteLLM / Claude"}}

node_author -->|"provides markdown"| node_chunker
node_chunker -->|"writes chunks"| node_chunks
node_chunks -->|"provides chunks"| node_embedder
node_embedder -->|"writes vectors"| node_vectors
node_vectors -->|"loads vectors"| node_searcher
node_query -->|"searches"| node_searcher
node_searcher -->|"returns ranked matches"| node_query
node_vectors -.->|"loads knowledge base"| node_kb
node_query -.->|"invokes tool"| node_mcp
node_agent -->|"calls tools"| node_mcp
node_mcp -.->|"dispatches search"| node_retriever
node_retriever -.->|"retrieves context"| node_kb
node_mcp -.->|"dispatches generation"| node_generator
node_generator -.->|"requests context"| node_retriever
node_generator -.->|"requests synthesis"| node_litellm
node_generator -.->|"returns answer and sources"| node_agent

click node_chunker "https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/src/chunker.py"
click node_chunks "https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/examples/chunks.json"
click node_embedder "https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/src/embedder.py"
click node_vectors "https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/examples/embedded_chunks.json"
click node_searcher "https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/src/searcher.py"
click node_kb "https://github.com/loganathansellappa/-rag-mcp-lab/tree/master/src"
click node_retriever "https://github.com/loganathansellappa/-rag-mcp-lab/tree/master/src"
click node_generator "https://github.com/loganathansellappa/-rag-mcp-lab/tree/master/src"
click node_mcp "https://github.com/loganathansellappa/-rag-mcp-lab/tree/master/src"

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_chunker,node_chunks,node_embedder,node_agent toneBlue
class node_vectors,node_searcher toneAmber
class node_kb,node_retriever,node_generator,node_mcp toneMint
class node_author,node_query,node_litellm toneIndigo
```

## Components

### Knowledge preparation

- [Markdown chunker](https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/src/chunker.py): `src/chunker.py`
- [Chunk JSON](https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/examples/chunks.json): `examples/chunks.json`
- [Chunk embedder](https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/src/embedder.py): `src/embedder.py`

### Semantic retrieval

- [Embedded chunks](https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/examples/embedded_chunks.json): `examples/embedded_chunks.json`
- [Semantic search](https://github.com/loganathansellappa/-rag-mcp-lab/blob/master/src/searcher.py): `src/searcher.py`

### RAG service

- [Knowledge base](https://github.com/loganathansellappa/-rag-mcp-lab/tree/master/src): `src`
- [RAG retriever](https://github.com/loganathansellappa/-rag-mcp-lab/tree/master/src): `src`
- [Answer generator](https://github.com/loganathansellappa/-rag-mcp-lab/tree/master/src): `src`
- [MCP tool server](https://github.com/loganathansellappa/-rag-mcp-lab/tree/master/src): `src`

### Other components

- **Knowledge documents**
- **Search query**
- **MCP client agent**
- **LiteLLM / Claude**

## Connections

- Knowledge documents → Markdown chunker: provides markdown (evidence: `README.md`)
- Markdown chunker → Chunk JSON: writes chunks (evidence: `src/chunker.py`)
- Chunk JSON → Chunk embedder: provides chunks (evidence: `README.md`)
- Chunk embedder → Embedded chunks: writes vectors (evidence: `src/embedder.py`)
- Embedded chunks → Semantic search: loads vectors (evidence: `src/searcher.py`)
- Search query → Semantic search: searches (evidence: `src/searcher.py`)
- Semantic search → Search query: returns ranked matches (evidence: `src/searcher.py`)
- Embedded chunks → Knowledge base: loads knowledge base (evidence: `README.md`)
- Search query → MCP tool server: invokes tool (evidence: `README.md`)
- MCP client agent → MCP tool server: calls tools (evidence: `README.md`)
- MCP tool server → RAG retriever: dispatches search (evidence: `README.md`)
- RAG retriever → Knowledge base: retrieves context (evidence: `README.md`)
- MCP tool server → Answer generator: dispatches generation (evidence: `README.md`)
- Answer generator → RAG retriever: requests context (evidence: `README.md`)
- Answer generator → LiteLLM / Claude: requests synthesis (evidence: `README.md`)
- Answer generator → MCP client agent: returns answer and sources (evidence: `README.md`)
