AI Office Assistant

AI Office Assistant

An AI-powered office assistant using LLM, RAG, and MCP tools to answer weather queries, retrieve information from documents, and automatically generate Excel and Word reports.

Category
访问服务器

README

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

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选