Skip to main content
Glama

AI Office Assistant

A beginner-friendly AI project using:

  • MCP (Model Context Protocol)

  • RAG (Retrieval-Augmented Generation)

  • Groq LLM

  • ChromaDB

  • Weather API

  • Excel Automation

  • Word Automation

Features

  • Ask weather questions

  • Query local PDF and DOCX documents

  • Automatically save weather results to Excel

  • Automatically generate Word reports

  • MCP tool calling

mcp-rag-office-assistant/ │ ├── app.py ├── requirements.txt ├── .env ├── .gitignore ├── README.md │ ├── data/ │ ├── pdfs/ │ ├── docs/ │ └── vector_db/ │ ├── outputs/ │ ├── excel/ │ └── word/ │ ├── config/ │ ├── init.py │ ├── settings.py │ └── logger.py │ ├── llm/ │ ├── init.py │ ├── groq_model.py │ └── prompt.py │ ├── rag/ │ ├── init.py │ ├── loader.py │ ├── splitter.py │ ├── embeddings.py │ ├── vector_store.py │ └── retriever.py │ ├── mcp_server/ │ ├── init.py │ ├── server.py │ ├── tools.py │ └── schemas.py │ ├── services/ │ ├── init.py │ ├── weather_service.py │ ├── excel_service.py │ └── word_service.py │

  1. LangChain


Purpose

  • Build LLM applications

  • Prompt Templates

  • Chains

  • Document handling

  • Retrieval

Prompt

↓

Retriever

↓

LLM

↓

Answer

  1. LangChain Community


User │ ▼ Groq LLM │ ├──────────────┐ ▼ ▼ MCP Tools RAG │ │ Weather API ChromaDB │ │ └──────┬───────┘ ▼ Final Answer │ ┌──────┴──────┐ ▼ ▼ Excel Word

Complete Architecture

                USER
                  │
                  ▼
             Groq LLM
                  │
          Tool Calling (MCP)
                  │
 ┌──────────┬─────────────┬─────────────┐
 ▼          ▼             ▼

Weather Excel Tool Word Tool │ │ │ ▼ ▼ ▼ OpenWeather Microsoft Microsoft API Excel Word │ │ ▼ ▼ Write Cells Write Report │ │ └──────┬──────┘ ▼ Save Documents

Then We'll Upgrade Even More

  • After Office automation, we'll add more desktop tools.

Desktop Agent

├── Weather Tool ├── Excel Automation ├── Word Automation ├── Open Chrome ├── Read PDF ├── Search Documents (RAG) ├── Take Screenshot ├── File Explorer ├── Calculator ├── Notepad ├── Send Email ├── Voice Input (Optional) └── OCR (Optional)

🤖 MCP RAG Office Assistant

An AI-powered Office Assistant built using LLM + RAG + Tool Calling + Office Automation.

The assistant can understand user requests, decide the required action, retrieve information from documents, call external tools, and automatically generate Microsoft Excel and Word reports.


🚀 Project Overview

Traditional applications require users to manually search documents, collect information, and create reports.

This project demonstrates an AI Agent workflow:

User Query
    |
    |
    v
LLM (Groq)
    |
    |
    +----------------------+
    |                      |
    v                      v
Weather Tool              RAG Pipeline
    |                      |
    |                      |
Weather API          Document Retrieval
                           |
                           |
                           v
                      ChromaDB
                           |
                           |
                           v
                       Context
                           |
                           |
                           v
                      Groq LLM
                      
                           
             |
             |
             v

       Office Automation

       +-------------+
       |             |
       v             v

    Excel        Microsoft Word

🎯 Project Objective

Build a beginner-level AI Agent system that demonstrates:

  • Large Language Model integration

  • Retrieval Augmented Generation (RAG)

  • Tool execution

  • MCP architecture concepts

  • Document understanding

  • Automated report generation

  • Desktop application automation


🧠 Technologies Used

Artificial Intelligence

Technology

Purpose

Groq LLM

Language model

LangChain

LLM application framework

RAG

Document question answering

ChromaDB

Vector database

HuggingFace Embeddings

Text embeddings

Related MCP server: office-mcp-server

Backend

Technology

Purpose

Python

Programming language

PyWin32

Microsoft Office automation

Requests

API calls

Logging

Application monitoring

Office Automation

Application

Usage

Microsoft Excel

Generate reports

Microsoft Word

Create documents


📂 Project Structure

mcp-rag-office-assistant/

│
├── app.py
│
├── config/
│   |
│   ├── settings.py
│   └── logger.py
│
│
├── llm/
│   |
│   ├── grok_model.py
│   └── prompt.py
│
│
├── rag/
│   |
│   ├── loader.py
│   ├── splitter.py
│   ├── embeddings.py
│   ├── vector_store.py
│   ├── retriever.py
│   └── rag_pipeline.py
│
│
├── services/
│   |
│   ├── weather_service.py
│   ├── excel_service.py
│   ├── word_service.py
│   └── office_agent.py
│
│
├── agent/
│   |
│   └── office_agent_executor.py
│
│
├── data/
│   |
│   ├── pdf/
│   |
│   └── docs/
│
│
├── vector_db/
│
│
├── outputs/
│   |
│   ├── excel/
│   |
│   └── word/
│
│
└── requirements.txt

⚙️ Installation

1. Clone Project

git clone <repository-url>

cd mcp-rag-office-assistant

2. Create Virtual Environment

python -m venv .venv

Activate:

Windows

.venv\Scripts\activate

3. Install Requirements

pip install -r requirements.txt

4. Environment Variables

Create:

.env

Add:

GROQ_API_KEY=your_api_key

🔑 Groq Configuration

The project uses:

llama-3.3-70b-versatile

Model configuration:

config/settings.py

Example:

LLM_MODEL="llama-3.3-70b-versatile"

📚 RAG Pipeline

The RAG system follows this architecture:

Documents

(PDF/DOCX)

     |
     v

Document Loader

     |
     v

Text Splitter

     |
     v

Embedding Model

     |
     v

Chroma Vector Database

     |
     v

Retriever

     |
     v

Groq LLM

     |
     v

Final Answer

📄 Supported Documents

Currently supported:

  • PDF

  • DOCX

Place files:

data/pdf/

data/docs/

Example:

data/pdf/company_policy.pdf

🔎 RAG Workflow Example

User:

What is the leave policy?

System:

  1. Searches company documents

  2. Retrieves relevant chunks

  3. Creates context

  4. Sends context + question to Groq

  5. Generates answer

  6. Creates Word report

Output:

outputs/word/

Company_Policy_Report.docx

🌦 Weather Tool

Example:

Weather Hyderabad

Workflow:

User

 |

 v

Weather Detection

 |

 v

Weather API

 |

 v

Excel Generator

 |

 v

Word Generator

Output:

outputs/

├── excel

│    └── Weather_Report.xlsx


└── word

     └── Weather_Report.docx

📊 Excel Automation

The project uses:

pywin32

to control Microsoft Excel.

Workflow:

Python

 |

 v

Open Excel Application

 |

 v

Create Workbook

 |

 v

Write Data

 |

 v

Save File

Example:

Generated Excel:

Weather_Report.xlsx

📝 Word Automation

The project automatically opens Microsoft Word.

Workflow:

Python

 |

 v

Open Word

 |

 v

Create Document

 |

 v

Insert Content

 |

 v

Save DOCX

Example:

Weather_Report.docx

🧩 MCP Architecture Concept

This project follows MCP principles.

AI Agent

    |

    |

    +----------------+

    |                |

    v                v

 Resources        Tools

Resources

Information sources:

Examples:

  • PDF files

  • DOCX files

  • Vector database

Tools

Actions:

Examples:

  • Weather API

  • Excel Writer

  • Word Writer


▶️ Running Project

Start:

python app.py

Example:

You : Weather Hyderabad

Output:

Weather report generated successfully

Excel:
outputs/excel/Weather_Report.xlsx

Word:
outputs/word/Weather_Report.docx

Example RAG:

You : Explain company leave policy

Output:

Company_Policy_Report.docx

🧪 Testing

Test RAG:

python test_rag.py

Expected:

RAG Pipeline Ready

Answer Generated

Documents Retrieved: 3

🛠 Future Enhancements

Planned improvements:

1. Streamlit Interface

Web UI:

User
 |
 v
Streamlit
 |
 v
AI Agent

2. Complete MCP Server

Add:

  • MCP Resources

  • MCP Tools

  • MCP Prompts


3. LangGraph Integration

Future workflow:

START

 |

Agent Node

 |

Decision Node

 |

Tool Node

 |

Response Node

 |

END

4. More Office Actions

Future tools:

  • Email generation

  • PowerPoint creation

  • Excel analysis

  • Meeting summary

  • Report generation


🎓 Learning Concepts Covered

This project teaches:

✅ LLM Applications
✅ Prompt Engineering
✅ LangChain
✅ RAG Architecture
✅ Embeddings
✅ Vector Databases
✅ Tool Calling
✅ AI Agents
✅ MCP Concepts
✅ Office Automation
✅ Production Project Structure


👨‍💻 Author

AI Engineering Learning Project

Built for understanding:

LLM + RAG + Agents + MCP + Automation

Related MCP Connectors

Related MCP Servers