mcp-student-assistance
README.md
# ๐ Student Assistant MCP (Model Context Protocol) Server & Groq Client
A complete, production-ready Python MCP project built with **FastMCP** and **Groq LLM Client** that provides intelligent student assistance for academic calculations, attendance tracking, marks analysis, and syllabus reading.
---
## ๐ Project Structure
```
student_assistant_mcp/
โโโ server.py # Main FastMCP server registering all tools
โโโ client_groq.py # Groq LLM client with MCP tool-calling loop
โโโ requirements.txt # Python dependencies (mcp, groq, pandas, pypdf)
โโโ .env.example # Environment template
โโโ tools/
โ โโโ __init__.py
โ โโโ calculator.py # Prompt 2: Math, GPA, and attendance deficit tool
โ โโโ attendance.py # Prompt 3: Attendance CSV reader & defaulter tool
โ โโโ marks.py # Prompt 4: Marks CSV reader & averages calculator
โ โโโ pdf_reader.py # Prompt 5: PyPDF syllabus extractor & keyword search
โโโ data/
โโโ attendance.csv # Student attendance records dataset
โโโ marks.csv # Student marks, totals, grades, and ranks
โโโ sample_syllabus.pdf # Course syllabus document
```
---
## ๐ Quickstart Guide
### 1. Prerequisites
- Python 3.10+ installed
- A free [Groq API Key](https://console.groq.com) (for `client_groq.py`)
### 2. Create Virtual Environment & Install Dependencies
```bash
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
# On Linux/macOS:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
# Install required packages
pip install -r requirements.txt
```
### 3. Configure Environment Variables
```bash
cp .env.example .env
# Edit .env and paste your GROQ_API_KEY
```
### 4. Run the FastMCP Server
```bash
python server.py
```
Or run in development mode with MCP Inspector:
```bash
mcp dev server.py
```
### 5. Run the Groq Student Assistant Client
In a separate terminal:
```bash
python client_groq.py
```
---
## ๐ ๏ธ MCP Tools Overview
| Tool Name | Prompt | Description |
|-----------|--------|-------------|
| `calculate` | Prompt 2 | Safe math evaluation, arithmetic, and GPA formulas |
| `calculate_target_attendance` | Prompt 2 | Calculates consecutive classes needed to reach 75% |
| `get_attendance` | Prompt 3 | Look up student attendance from `attendance.csv` |
| `list_attendance_defaulters` | Prompt 3 | List all students with attendance below 75% |
| `get_marks` | Prompt 4 | Retrieve subject scores, grade, and rank from `marks.csv` |
| `get_marks_averages` | Prompt 4 | Compute class averages and top score per subject |
| `read_pdf` | Prompt 5 | Extract syllabus text using `pypdf.PdfReader` |
| `search_pdf` | Prompt 5 | Search syllabus for grading policy or exam dates |
---
## ๐งช Example Queries for the Student Assistant
- *"What is Alice Johnson's attendance and marks rank?"*
- *"Bob Smith has 68% attendance. How many more classes must he attend to reach 75%?"*
- *"What are the class averages in Computer Science and Math?"*
- *"Search the syllabus PDF for the final exam date and grading breakdown."*
This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessNo issues