Skip to main content
Glama
Prince-0723

greenfield-school

by Prince-0723

Greenfield Public School — MCP Teaching & AI Chatbox Example

A comprehensive, classroom-ready demonstration of the Model Context Protocol (MCP) using a realistic school database as the domain. Designed for undergraduate students learning how AI systems connect to external tools and data sources via standard input/output (stdio) pipes and JSON-RPC 2.0 messaging.


What Is MCP?

Model Context Protocol (MCP) is an open standard by Anthropic that defines how AI assistants (clients) communicate with external data sources and tools (servers). Think of it like a standardized API specifically designed for AI applications.

┌─────────────────────┐     JSON-RPC 2.0      ┌─────────────────────────┐
│   AI Application    │ ◄──────────────────── ► │     MCP Server          │
│   (MCP Client)      │     over stdio/HTTP     │  • Tools (functions)    │
│                     │                         │  • Resources (data)     │
│  e.g. OpenAI GPT,   │                         │  • Prompts (templates)  │
│  Claude, Cursor     │                         │                         │
└─────────────────────┘                         └─────────────────────────┘

Real-world MCP clients: Claude Desktop, Cursor IDE, Windsurf, custom AI apps (ai_chatbox.py).


Related MCP server: MCP-Server-CollageAI

Project Overview

This project simulates a school MCP server that manages:

  • Student marks (30 students × 5 subjects)

  • Enrollment records (roll numbers, admission dates)

  • School rules (norms and regulations document)

  • Awards policy (rank 1–5 award definitions)

  • Class statistics (class average, pass/fail breakdown, subject toppers)

The MCP server allows AI clients to query this data through a well-defined protocol.


Active Project Structure

c:\Satish_Files\MCP_Server\
├── data/
│   ├── students_marks.json     # Marks for 30 students across 5 subjects
│   ├── enrollment.json         # Roll numbers, admission dates, grade sections
│   ├── awards_policy.json      # Rank-based (1-5) and subject-based awards policy
│   └── school_rules.txt        # 10-section school norms and regulations document
│
├── server/
│   └── school_mcp_server.py    # Core MCP Server (exposes 7 tools, 4 resources, 2 prompts)
│
├── ai_chatbox.py               # AI Chatbox using OpenAI gpt-4o-mini function calling + MCP client
├── mcp_logger.py               # Centralized, instant-flushing protocol logger (writes to logs/)
├── requirements.txt            # Python dependencies (mcp, colorama, openai)
├── README.md                   # Setup guide, capabilities, and instructions (this file)
├── Project_structure.md        # Architecture, component map, and execution flow
└── old_files.zip               # Zip archive of legacy/redundant files

Setup & Installation

Step 1: Install Python 3.10+

Make sure you have Python 3.10 or newer:

python --version
cd c:\Satish_Files\MCP_Server
python -m venv venv
venv\Scripts\activate        # Windows
# source venv/bin/activate   # macOS / Linux

Step 3: Install Dependencies

pip install -r requirements.txt

Installed packages include mcp[cli] (v2.x), openai (v1.x), and colorama.


Running the AI Chatbox

Run the main AI-powered Chatbox (OpenAI GPT-4o-mini + MCP Client):

python -X utf8 ai_chatbox.py

Example Queries to Ask in Plain English:

  • "How many students are in the class?"

  • "What are Meera Iyer's marks?"

  • "Who are the top 3 students in Mathematics?"

  • "Who are the top 3 students in Computer Science?"

  • "Who are the top 3 students overall?"

  • "When did Harshit Yadav enroll?"

  • "What award does rank 1 get?"

  • "What is the attendance policy?"

Inspect Converted OpenAI Tool Schemas:

Inside the interactive prompt of ai_chatbox.py, type:

You: tools

or

You: schemas

It will pretty-print the exact converted OpenAI function schemas (mcp_tools_to_openai) in the terminal.


Testing with MCP Inspector

The MCP SDK includes a built-in web-based inspector for testing server capabilities interactively:

mcp dev server/school_mcp_server.py

This opens a browser UI where you can invoke tools and inspect resource URIs directly.


MCP Server Capabilities

🛠️ Tools (Callable Actions)

Tool Name

Arguments

What It Does

get_student_marks

student_name: str

Returns marks, aggregate (out of 500), percentage, grade

get_top_rankers

count: int = 5

Returns top N students by overall percentage

get_top_students_by_subject

subject_name: str, count: int = 5

Returns top N students in a subject or total

get_class_statistics

(none)

Returns class summary, average (79.99%), pass/fail rates, grade breakdown

get_student_enrollment

student_name: str

Returns enrollment number and date of admission

get_school_awards

(none)

Returns complete rank and subject awards policy

search_school_rules

keyword: str

Searches 10 sections of school norms document

📂 Resources (Readable Data)

URI

Content Type

What It Contains

school://students/all

JSON

All 30 students with full marks data

school://enrollment/all

JSON

All enrollment records

school://rules

Text

Full school norms document

school://awards/policy

JSON

Complete awards policy

💬 Prompts (Reusable Templates)

Prompt Name

Arguments

Purpose

student_report_prompt

student_name: str

Generates a student analysis prompt template

class_summary_prompt

(none)

Generates a class overview prompt template


Real-Time Protocol Logging

Every session generates an instant-flushing log file in logs/mcp_session_<timestamp>.log.

To View the Latest Session Log:

Get-ChildItem logs\ | Sort-Object LastWriteTime -Descending | Select-Object -First 1 | Get-Content

The log records:

  1. User Query

  2. AI Intent Reasoning (Why GPT selected a specific tool and arguments)

  3. JSON-RPC Protocol Request (tools/call)

  4. Server Execution Result from school database

  5. Final AI Answer


Connecting to Claude Desktop

To connect this server to Claude Desktop, add to claude_desktop_config.json:

{
  "mcpServers": {
    "greenfield-school": {
      "command": "python",
      "args": ["c:/Satish_Files/MCP_Server/server/school_mcp_server.py"]
    }
  }
}

Further Reading


Built for teaching MCP to undergraduate students | Greenfield Public School Example

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Prince-0723/MCP_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server