AegisRAG
Provides tools for listing and fetching files from a scoped Google Drive folder, with MIME-type-aware extraction for Docs, Sheets, PDFs, and other formats.
Provides tools for listing and fetching Notion pages, recursively converting block content into normalized text for ingestion.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AegisRAGlist the Notion pages and Drive files in the Royal Industries corpus"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AegisRAG
An MCP-based RAG ingestion pipeline with a rigorous chunking-strategy evaluation harness — built for Royal Industries' internal knowledgebase, demonstrating real-world AI engineering over a live multi-source corpus.
What This Is
AegisRAG is a portfolio-grade AI engineering project that goes well beyond "upload PDFs to a vector DB." It is structured in four phases:
Phase | What | Status |
0 — Corpus | 11 synthetic Royal Industries documents across Notion + Drive | ✅ Complete |
1 — MCP Server | Live Notion + Google Drive connectors behind a unified MCP tool interface | ✅ Complete |
2 — Chunking | Four distinct chunking strategies implemented and compared | 🔄 In progress |
3 — Eval Harness | RAGAS-scored comparison across 50 curated queries with ground truth | 🔜 Planned |
4 — RAG Pipeline | Citation-backed generation with output guardrails | 🔜 Planned |
The project's defining feature is comparative rigor — rather than assuming one chunking strategy works best, it builds a harness that surfaces real metric differences (Context Precision, Context Recall, Answer Faithfulness) across strategies on a carefully designed corpus.
Related MCP server: LangChain MCP Demo
Architecture
┌─────────────────────────────────────────────────────────────┐
│ MCP Clients │
│ (Claude Desktop · LangGraph agent · test script) │
└───────────────────────┬─────────────────────────────────────┘
│ stdio transport
▼
┌─────────────────────────────────────────────────────────────┐
│ mcp_server/server.py │
│ │
│ @tool notion_list_pages @tool notion_fetch_page │
│ @tool drive_list_files @tool drive_fetch_file │
└──────────────┬────────────────────────┬────────────────────┘
│ │
▼ ▼
┌──────────────────────┐ ┌───────────────────────┐
│ notion_connector.py │ │ drive_connector.py │
│ │ │ │
│ · PAT auth │ │ · OAuth 2.0 + cache │
│ · Paginated search │ │ · MIME-type routing │
│ · Block → text │ │ · Sheets dual-export │
│ (recursive) │ │ · PDF text extract │
└──────────┬───────────┘ └──────────┬────────────┘
│ │
└────────────┬─────────────┘
▼
┌─────────────────────┐
│ normalize.py │
│ NormalizedDocument │
│ {doc_id, source, │
│ title, content, │
│ metadata} │
└─────────────────────┘
│
▼ (Phase 2 →)
┌─────────────────────┐
│ chunking/ │
│ · fixed_size.py │
│ · semantic.py │
│ · structural.py │
│ · agentic.py │
└─────────────────────┘Why MCP?
The Model Context Protocol (MCP) defines a standard tool interface that any compatible client can call without custom per-source integration. By building Notion and Drive connectors behind MCP tools rather than hardcoding them into the RAG pipeline, this project demonstrates:
Source agnosticism: the chunking and eval pipeline never knows or cares whether a document came from Notion or Drive
Reusability: any MCP-compatible agent (Claude Desktop, LangGraph, custom) can call these tools without modification
Clean separation: the ingestion layer and the RAG layer are independently testable and swappable
The Corpus — Royal Industries
All documents are synthetic but written to realistic depth (~1,500–2,500 words each), intentionally cross-referencing each other to enable multi-document synthesis queries in the eval set.
Notion (6 documents — structured policy/handbook content):
hr_handbook.md— 9-section employee handbookleave_policy.md— 6 leave types, accrual rules, edge casesit_security_policy.md— passwords, MFA, data classification tiers, BYOD, AI tool policyonboarding_guide.md— pre-boarding through 90-day milestones, system access routingexpense_policy.md— travel, per diem, approval thresholds, corporate cardsengineering_runbook.md— Aurora platform architecture, 4 incident playbooks, on-call rotation
Google Drive (5 documents — intentionally messier, mixed formats):
meeting_notes_q3_planning— informal, scattered action items (stress-tests chunking)product_spec_aurora— draft spec with open questions, cross-referencesonboarding_checklist— checklist format, technical onboarding supplementvendor_contract_summary— SMS provider (TextRelay) contract summaryq3_budget_summary— Google Sheet with structured table + prose narrative
Why the deliberate format variety? Fixed-size chunking handles clean policy docs well but struggles with meeting notes and tables. Semantic/structure-aware chunking has the opposite profile. The corpus is designed so all four chunking strategies have different performance profiles — which is what makes the evaluation harness's output meaningful.
Phase 1 — MCP Server (Complete)
What the server exposes
# List all accessible Notion pages (metadata only)
notion_list_pages() -> list[{page_id, title, last_edited_time, url}]
# Fetch full text content of a Notion page
notion_fetch_page(page_id: str) -> NormalizedDocument
# List all files in the scoped Drive folder
drive_list_files() -> list[{file_id, name, mime_type, modified_time, ...}]
# Fetch full text content of a Drive file (auto-routes by MIME type)
drive_fetch_file(file_id: str) -> NormalizedDocumentNormalized document schema
Every tool returns data in this shape — source-agnostic, JSON-serializable:
{
"doc_id": "3c83fc80-9e11-8046-8f51-c6c255ed4d66",
"source": "notion",
"title": "Engineering Runbook",
"content": "# Royal Industries — Engineering Runbook: Aurora Sensor Platform...",
"metadata": {
"author": null,
"modified_date": "2026-08-26T12:48:00.000Z",
"doc_type": "runbook",
"path_or_url": "https://app.notion.com/p/Engineering-Runbook-..."
}
}Technical implementation notes
Notion connector:
Uses the official
notion-clientSDK with a Personal Access Token (PAT)PAT inherits creator's workspace access — no per-page sharing required
client.search(filter={"type": "page"})with cursor-based pagination to enumerate all pagesRecursive block fetching (
_fetch_all_blocks) handles Notion's nested block modelBlock-to-text renderer covers all common block types (headings, lists, callouts, code, toggles, dividers)
Drive connector:
OAuth 2.0 Desktop flow with
token.jsoncaching — one-time browser auth, silent on subsequent runsScoped to a single Drive folder (
DRIVE_FOLDER_ID) — never touches files outside the corpusMIME-type-aware content extraction:
Google Docs →
text/plainexportGoogle Sheets → dual pass:
text/csv(Sheet1 table) +text/plain(all sheets) — captures both structured table data and prose narrativePDFs → binary download +
pypdftext extractionUnknown types → best-effort text download with fallback
mcp v2 note (for contributors): This project uses mcp==2.1.1 which is the v2 SDK. FastMCP was renamed to MCPServer at mcp.server.mcpserver. Always run the server as a module (python -m mcp_server.server), not as a script — relative imports require module mode.
Setup
Prerequisites
Python 3.10+
A Notion workspace with a Personal Access Token (PAT) — create one here
A Google Cloud project with Drive API enabled and OAuth 2.0 Desktop credentials downloaded as
credentials.json
Installation
# Clone the repo
git clone https://github.com/Yash22o2/AegisRAG.git
cd AegisRAG
# Create and activate virtual environment
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # macOS/Linux
# Install dependencies
pip install -r requirements.txtConfiguration
Create a .env file in the project root (see .env.example):
NOTION_API_KEY=your_notion_pat_here
GOOGLE_CREDENTIALS_PATH=credentials.json
DRIVE_FOLDER_ID=your_drive_folder_id_herePlace your credentials.json in the project root.
First-time Google Drive authorization
python authorize_drive.pyThis opens a browser for Google OAuth consent. After you click Allow, token.json is cached and no browser is needed for subsequent runs.
Run the end-to-end test
python test_mcp_connection.pyExpected output:
>> Starting AegisRAG MCP server as subprocess...
Server initialized [OK]
TEST 1: Tool Discovery (list_tools)
[OK] All 4 tools discovered: [drive_fetch_file, drive_list_files, notion_fetch_page, notion_list_pages]
TEST 2: notion_list_pages
[OK] N pages returned from Notion
[OK] Page schema valid. First page: 'Engineering Runbook'
TEST 3: notion_fetch_page
[OK] Content fetched, length: 7210 chars
[OK] Document schema valid
TEST 4: drive_list_files
[OK] 5 files returned from Drive
[OK] File schema valid. First file: 'Q3 Budget Summary'
TEST 5: drive_fetch_file
[OK] Content fetched, length: 576 chars
[OK] Document schema validProject Structure
AegisRAG/
├── mcp_server/
│ ├── __init__.py
│ ├── server.py # MCPServer entry point, 4 tool definitions
│ ├── notion_connector.py # Notion API wrapper
│ ├── drive_connector.py # Google Drive API wrapper
│ └── normalize.py # NormalizedDocument schema + factory
├── authorize_drive.py # One-time Drive OAuth helper
├── test_mcp_connection.py # End-to-end MCP client test / demo
├── requirements.txt # Python dependencies
├── .env.example # Environment variable template
└── README.mdDependencies
Package | Version | Purpose |
| 2.1.1 | MCP Python SDK (MCPServer, stdio transport, client) |
| 3.1.0 | Official Notion API SDK |
| 2.199.0 | Google Drive API |
| 1.4.1 | OAuth 2.0 Desktop flow |
| 0.4.2 | HTTP transport for Google auth |
| 1.2.3 |
|
| 6.16.2 | PDF text extraction |
Roadmap
Phase 0 — Synthetic corpus (11 docs, ~13,000 words, cross-referenced)
Phase 1 — MCP server with Notion + Drive connectors, normalized schema
Phase 2 — Four chunking strategies: fixed-size · semantic · structure-aware · agentic
Phase 3 — Evaluation harness: 50-query ground-truth set, RAGAS metrics, comparison table
Phase 4 — Full RAG pipeline: retrieval → generation with citation formatting + output guardrails
Why This Project
Most RAG demos:
Use a single PDF or pre-chunked dataset
Apply one chunking strategy without justification
Evaluate qualitatively ("it seemed to work")
AegisRAG is built to answer the question: for a realistic, multi-source enterprise knowledgebase, which chunking strategy actually performs better, and by how much? The answer is in the numbers — Context Recall scores, not vibes.
License
MIT
This server cannot be installed
Maintenance
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
Make your knowledge agent-ready. One MCP endpoint, 5 connectors, 3 search modes.
Ingest, manage, and retrieve documents for RAG-powered AI applications
Team docs served to AI agents over MCP - search, Markdown reads, version pinning, read audit.
Publish and share access-controlled Markdown documents from any MCP-enabled AI tool.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA multi-backend gateway that enables access to various services like Google Drive and Notion through a single MCP connector. It currently provides comprehensive Google Drive integration for reading, writing, and managing files and folders.MIT
- FlicenseNot gradedqualityDmaintenanceEnables grounding AI responses in a local document corpus by exposing MCP tools to list, search, and summarize documents, and generating answers using OpenAI.
- AlicenseNot gradedqualityDmaintenanceEnables Claude to interact with collaborative Docs instances, providing document management, content editing, access control, and AI-powered transformations via MCP.1MIT
- AlicenseNot gradedqualityDmaintenanceProvides RAG (Retrieval Augmented Generation) access to technical documentation through MCP, enabling LLMs to search and retrieve relevant documentation on-demand.4MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Yash22o2/AegisRAG'
If you have feedback or need assistance with the MCP directory API, please join our Discord server