Sponsored by Deepsite.site

School Database MCP Server

Created By
eoinmooremath8 months ago
MCP server for a school database
Content

School Database MCP Server

A Model Context Protocol (MCP) server for managing a mock school database with automated behavior tracking and alert system.

Overview

This project implements a school management system backend that provides tools for:

  • Managing student and teacher data
  • Recording and classifying student behavior incidents
  • Automated behavior alert system with email notifications
  • Database querying and schema inspection

The server uses SQLite for data storage and integrates with external services (like Gmail) for notifications.

Features

Core Database Management

  • Schema Inspection: Get complete database structure with table relationships
  • Safe Query Execution: Execute SELECT, INSERT, and UPDATE queries with parameter binding
  • Sample Data: View sample records from any table

Behavior Management Workflow

  1. Add Behavior Notes: Record student behavior incidents with pending classification
  2. LLM Classification: Automatically classify behaviors as positive, negative, or neutral
  3. Alert System: Monitor students for concerning behavior patterns
  4. Email Notifications: Automatically send alerts to relevant parties

Available Tools

  • get_database_schema - Inspect database structure and relationships
  • execute_query - Run SQL queries safely
  • add_behavior_note_pending_classification - Record new behavior incidents
  • update_behavior_classification - Classify behavior after LLM analysis
  • get_pending_classifications - List unclassified behavior notes
  • check_student_alerts_enhanced - Check if students need behavior alerts
  • send_behavior_alert_email_immediately - Send automated email alerts

Database Schema

The system includes tables for:

  • Students: Student information and contact details
  • Teachers: Teacher information
  • Behavior Notes: Incident records with classification and alerts
  • Classes: Course and enrollment information
  • Grades: Academic performance tracking

Installation

Prerequisites

  • Python 3.12+
  • SQLite3

Setup

  1. Clone the repository
  2. Install dependencies:
    pip install mcp>=1.9.2
    
  3. Run the server:
    python school_db_mcp.py
    

Usage

Starting the Server

python school_db_mcp.py

The server runs as an MCP server using stdio for communication.

Example Workflow

  1. Inspect the database structure:

    {
      "tool": "get_database_schema",
      "arguments": {"include_sample_data": true}
    }
    
  2. Add a behavior incident:

    {
      "tool": "add_behavior_note_pending_classification",
      "arguments": {
        "student_name": "John Doe",
        "teacher_id": 1,
        "description": "Student was disruptive during class",
        "location": "Classroom 101"
      }
    }
    
  3. Classify the behavior:

    {
      "tool": "update_behavior_classification",
      "arguments": {
        "note_id": 1,
        "behavior_type": "negative",
        "reasoning": "Disruptive behavior affects learning environment"
      }
    }
    
  4. Check for alerts:

    {
      "tool": "check_student_alerts_enhanced",
      "arguments": {
        "student_id": 123,
        "days_back": 7
      }
    }
    

Security Features

  • Query Sanitization: Only SELECT, INSERT, and UPDATE queries allowed
  • Parameter Binding: Prevents SQL injection attacks
  • Input Validation: Validates all tool inputs before processing

Integration

This server is designed to work with:

  • Gmail MCP Server: For sending behavior alert emails
  • LLM Systems: For automated behavior classification
  • School Management Systems: As a backend data service

Development

Project Structure

school-db-server/
├── school_db_mcp.py    # Main server implementation
├── pyproject.toml      # Project configuration
├── README.md          # This file
└── school_data        # SQLite database file (created on first run)

Key Classes

  • SchoolDatabaseMCP: Main server class handling MCP protocol
  • Database operations use SQLite with row factory for dict-like access
  • Async/await pattern for all tool operations

Notes

  • This is a demonstration/toy project showcasing MCP server development
  • Uses mock data for educational purposes
  • Designed to integrate with other MCP servers in a larger system
  • Includes comprehensive error handling and logging

License

This project is for educational and demonstration purposes.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Tavily Mcp
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
WindsurfThe new purpose-built IDE to harness magic
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
ChatWiseThe second fastest AI chatbot™
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Amap Maps高德地图官方 MCP Server
Serper MCP ServerA Serper MCP Server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
CursorThe AI Code Editor
DeepChatYour AI Partner on Desktop
Playwright McpPlaywright MCP server