# rajuguguloth/agentic-rag-research-assistant-with-mcp-integration- architecture

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

- Interactive diagram: https://gitdiagram.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-
- Repository: https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-

## Overview

This repository is an agentic RAG research assistant: users ingest PDFs or papers, build an index, then ask questions, chat with documents, or generate deep-read reports. The main retrieval path combines dense and BM25 search before answering; separate branches provide verification, MCP tools, feedback, and evaluation/optimization. The map includes documented capabilities whose source was not sampled, but omits uncertain connections. Relationships are based on the README, excerpts, and SOURCE INDEX references; unsampled implementation details are not assumed.

Main entry points: [`research_assistant/app.py`](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/app.py) (Gradio and FastAPI), [`research_assistant/orchestration/deep_read/orchestrator.py`](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/deep_read/orchestrator.py) (Deep-read workflow), [`research_assistant/retrieval/hybrid_retriever.py`](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/retrieval/hybrid_retriever.py) (Hybrid retrieval), [`research_assistant/orchestration/document_chat.py`](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/document_chat.py) (Document chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Application interfaces"]
  node_web_app["Gradio and FastAPI<br/>[app.py]"]
  node_feedback_api["Feedback API<br/>[feedback_router.py]"]
  node_mcp_server["MCP tools<br/>[mcp_server.py]"]
end

subgraph group_ingestion["Document ingestion"]
  node_document_loader["PDF and paper loading"]
  node_pdf_extract["Rich PDF extraction<br/>[pdf_rich_loader.py]"]
  node_chunking["Document chunking<br/>[chunker.py]"]
end

subgraph group_retrieval["Retrieval and answering"]
  node_hybrid["Hybrid retrieval"]
  node_dense["Dense search<br/>[dense_retriever.py]"]
  node_sparse["BM25 search"]
  node_query_utils["Query normalization<br/>[query_utils.py]"]
  node_doc_chat["Document chat<br/>[document_chat.py]"]
  node_research_agent["Research agent<br/>[agent.py]"]
  node_planner["Research planner<br/>[planner.py]"]
end

subgraph group_deepread["Deep research"]
  node_deep_read["Deep-read workflow<br/>[orchestrator.py]"]
  node_section_agents["Section analysis<br/>[section_agents.py]"]
  node_report_merger["Report merger<br/>[merger.py]"]
  node_ppt_builder["Slide generation<br/>[ppt_builder.py]"]
end

subgraph group_quality["Quality and operations"]
  node_verifier["Answer verification<br/>[gemini_verifier.py]"]
  node_user_memory["User memory<br/>[user_memory.py]"]
  node_evaluation["RAG evaluation<br/>[ragas_batch.py]"]
  node_feedback["Feedback and tracing<br/>[feedback.py]"]
  node_optimizer["Prompt optimization"]
  node_llm_gateway["LLM gateway<br/>[gateway.py]"]
end

node_user(("Research user"))
node_mcp_client(("MCP client"))
node_llm_provider{{"LLM provider"}}

node_user -->|"uses"| node_web_app
node_web_app -->|"loads documents"| node_document_loader
node_web_app -->|"chunks documents"| node_chunking
node_web_app -->|"builds index"| node_hybrid
node_document_loader -.->|"extracts PDF"| node_pdf_extract
node_hybrid -->|"searches vectors"| node_dense
node_hybrid -->|"searches terms"| node_sparse
node_user -->|"asks questions"| node_doc_chat
node_web_app -->|"routes chat"| node_doc_chat
node_doc_chat -->|"retrieves context"| node_hybrid
node_doc_chat -->|"checks relevance"| node_verifier
node_doc_chat -->|"uses memory"| node_user_memory
node_user -->|"requests research"| node_research_agent
node_web_app -->|"plans research"| node_planner
node_research_agent -->|"retrieves evidence"| node_hybrid
node_research_agent -->|"verifies answer"| node_verifier
node_user -->|"submits paper"| node_deep_read
node_web_app -->|"starts deep read"| node_deep_read
node_deep_read -->|"resolves source"| node_document_loader
node_deep_read -->|"extracts content"| node_pdf_extract
node_deep_read -->|"analyzes sections"| node_section_agents
node_deep_read -->|"merges report"| node_report_merger
node_deep_read -->|"builds slides"| node_ppt_builder
node_mcp_client -->|"invokes tools"| node_mcp_server
node_web_app -->|"mounts endpoint"| node_feedback_api
node_feedback_api -->|"records feedback"| node_feedback
node_user -.->|"evaluates answers"| node_evaluation
node_evaluation -->|"tests retrieval"| node_hybrid
node_evaluation -->|"judges evidence"| node_verifier
node_optimizer -.->|"generates variants"| node_llm_provider
node_llm_gateway -.->|"generates text"| node_llm_provider
node_deep_read -->|"gets gateway"| node_llm_gateway

click node_web_app "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/app.py"
click node_feedback_api "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/api/feedback_router.py"
click node_mcp_server "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/mcp_server.py"
click node_document_loader "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/etl/universal_loader.py"
click node_pdf_extract "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/etl/pdf_rich_loader.py"
click node_chunking "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/etl/chunker.py"
click node_hybrid "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/retrieval/hybrid_retriever.py"
click node_dense "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/retrieval/dense_retriever.py"
click node_sparse "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/retrieval/sparse_retriever.py"
click node_query_utils "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/retrieval/query_utils.py"
click node_doc_chat "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/document_chat.py"
click node_research_agent "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/agent.py"
click node_planner "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/planner.py"
click node_verifier "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/verification/gemini_verifier.py"
click node_user_memory "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/memory/user_memory.py"
click node_deep_read "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/deep_read/orchestrator.py"
click node_section_agents "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/deep_read/section_agents.py"
click node_report_merger "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/deep_read/merger.py"
click node_ppt_builder "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/deep_read/ppt_builder.py"
click node_evaluation "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/evaluation/ragas_batch.py"
click node_feedback "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/observability/feedback.py"
click node_optimizer "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/optimization/prompt_optimizer.py"
click node_llm_gateway "https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/llm/gateway.py"

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_web_app,node_feedback_api,node_mcp_server,node_user,node_mcp_client toneBlue
class node_document_loader,node_pdf_extract,node_chunking toneAmber
class node_hybrid,node_dense,node_sparse,node_query_utils,node_doc_chat,node_research_agent,node_planner toneMint
class node_deep_read,node_section_agents,node_report_merger,node_ppt_builder toneRose
class node_verifier,node_user_memory,node_evaluation,node_feedback,node_optimizer,node_llm_gateway,node_llm_provider toneIndigo
```

## Components

### Application interfaces

- [Gradio and FastAPI](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/app.py): `research_assistant/app.py`
- [Feedback API](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/api/feedback_router.py): `research_assistant/api/feedback_router.py`
- [MCP tools](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/mcp_server.py): `research_assistant/mcp_server.py`

### Document ingestion

- [PDF and paper loading](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/etl/universal_loader.py): `research_assistant/etl/universal_loader.py`
- [Rich PDF extraction](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/etl/pdf_rich_loader.py): `research_assistant/etl/pdf_rich_loader.py`
- [Document chunking](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/etl/chunker.py): `research_assistant/etl/chunker.py`

### Retrieval and answering

- [Hybrid retrieval](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/retrieval/hybrid_retriever.py): `research_assistant/retrieval/hybrid_retriever.py`
- [Dense search](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/retrieval/dense_retriever.py): `research_assistant/retrieval/dense_retriever.py`
- [BM25 search](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/retrieval/sparse_retriever.py): `research_assistant/retrieval/sparse_retriever.py`
- [Query normalization](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/retrieval/query_utils.py): `research_assistant/retrieval/query_utils.py`
- [Document chat](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/document_chat.py): `research_assistant/orchestration/document_chat.py`
- [Research agent](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/agent.py): `research_assistant/orchestration/agent.py`
- [Research planner](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/planner.py): `research_assistant/orchestration/planner.py`

### Deep research

- [Deep-read workflow](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/deep_read/orchestrator.py): `research_assistant/orchestration/deep_read/orchestrator.py`
- [Section analysis](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/deep_read/section_agents.py): `research_assistant/orchestration/deep_read/section_agents.py`
- [Report merger](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/deep_read/merger.py): `research_assistant/orchestration/deep_read/merger.py`
- [Slide generation](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/orchestration/deep_read/ppt_builder.py): `research_assistant/orchestration/deep_read/ppt_builder.py`

### Quality and operations

- [Answer verification](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/verification/gemini_verifier.py): `research_assistant/verification/gemini_verifier.py`
- [User memory](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/memory/user_memory.py): `research_assistant/memory/user_memory.py`
- [RAG evaluation](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/evaluation/ragas_batch.py): `research_assistant/evaluation/ragas_batch.py`
- [Feedback and tracing](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/observability/feedback.py): `research_assistant/observability/feedback.py`
- [Prompt optimization](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/optimization/prompt_optimizer.py): `research_assistant/optimization/prompt_optimizer.py`
- [LLM gateway](https://github.com/rajuguguloth/agentic-rag-research-assistant-with-mcp-integration-/blob/main/research_assistant/llm/gateway.py): `research_assistant/llm/gateway.py`

### Other components

- **Research user**
- **MCP client**
- **LLM provider**

## Connections

- Research user → Gradio and FastAPI: uses
- Gradio and FastAPI → PDF and paper loading: loads documents (evidence: `research_assistant/app.py`)
- Gradio and FastAPI → Document chunking: chunks documents (evidence: `research_assistant/app.py`)
- Gradio and FastAPI → Hybrid retrieval: builds index (evidence: `research_assistant/app.py`)
- PDF and paper loading → Rich PDF extraction: extracts PDF
- Hybrid retrieval → Dense search: searches vectors (evidence: `research_assistant/retrieval/hybrid_retriever.py`)
- Hybrid retrieval → BM25 search: searches terms (evidence: `research_assistant/retrieval/hybrid_retriever.py`)
- Research user → Document chat: asks questions
- Gradio and FastAPI → Document chat: routes chat (evidence: `research_assistant/app.py`)
- Document chat → Hybrid retrieval: retrieves context (evidence: `research_assistant/orchestration/document_chat.py`)
- Document chat → Answer verification: checks relevance (evidence: `research_assistant/orchestration/document_chat.py`)
- Document chat → User memory: uses memory (evidence: `research_assistant/orchestration/document_chat.py`)
- Research user → Research agent: requests research
- Gradio and FastAPI → Research planner: plans research (evidence: `research_assistant/app.py`)
- Research agent → Hybrid retrieval: retrieves evidence (evidence: `research_assistant/orchestration/agent.py`)
- Research agent → Answer verification: verifies answer (evidence: `research_assistant/orchestration/agent.py`)
- Research user → Deep-read workflow: submits paper
- Gradio and FastAPI → Deep-read workflow: starts deep read (evidence: `research_assistant/app.py`)
- Deep-read workflow → PDF and paper loading: resolves source (evidence: `research_assistant/orchestration/deep_read/orchestrator.py`)
- Deep-read workflow → Rich PDF extraction: extracts content (evidence: `research_assistant/orchestration/deep_read/orchestrator.py`)
- Deep-read workflow → Section analysis: analyzes sections (evidence: `research_assistant/orchestration/deep_read/orchestrator.py`)
- Deep-read workflow → Report merger: merges report (evidence: `research_assistant/orchestration/deep_read/orchestrator.py`)
- Deep-read workflow → Slide generation: builds slides (evidence: `research_assistant/orchestration/deep_read/orchestrator.py`)
- MCP client → MCP tools: invokes tools
- Gradio and FastAPI → Feedback API: mounts endpoint (evidence: `research_assistant/app.py`)
- Feedback API → Feedback and tracing: records feedback (evidence: `research_assistant/api/feedback_router.py`)
- Research user → RAG evaluation: evaluates answers
- RAG evaluation → Hybrid retrieval: tests retrieval (evidence: `research_assistant/evaluation/ragas_batch.py`)
- RAG evaluation → Answer verification: judges evidence (evidence: `research_assistant/evaluation/ragas_batch.py`)
- Prompt optimization → LLM provider: generates variants
- LLM gateway → LLM provider: generates text
- Deep-read workflow → LLM gateway: gets gateway (evidence: `research_assistant/orchestration/deep_read/orchestrator.py`)
