Skip to main content
Glama

πŸŽ“ 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

Related MCP server: who-will-notify-mcp

πŸš€ Quickstart Guide

1. Prerequisites

  • Python 3.10+ installed

  • A free Groq API Key (for client_groq.py)

2. Create Virtual Environment & Install Dependencies

# 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

cp .env.example .env
# Edit .env and paste your GROQ_API_KEY

4. Run the FastMCP Server

python server.py

Or run in development mode with MCP Inspector:

mcp dev server.py

5. Run the Groq Student Assistant Client

In a separate terminal:

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."

Related MCP Connectors

Related MCP Servers