ppe-compliance-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ppe-compliance-mcpGive me a site-wide PPE summary."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PPE Compliance Vision Pipeline
Industrial PPE (Personal Protective Equipment) compliance demo for video:
Fine-tune RF-DETR on the SH17 safety dataset
Run video inference with ByteTrack + temporal compliance logic
Query results through an MCP server (no re-inference in the agent loop)
Video → RF-DETR → ByteTrack (track_id) → PPE association → state machine
↓
annotated MP4 + analytics JSON → MCP tools → Claude/CursorRepo: github.com/Pratham-22/ppe-compliance
Weights: Release v0.1 (checkpoint_epoch44.pth)
Demo results
Annotated factory-floor run: ByteTrack IDs + temporal PPE compliance overlays (missing: helmet, safety-vest).

Frame ~2.7s | Frame ~5.7s |
|
|
Sample clip: outputs/inference/factory_floor_annotated.mp4 · analytics: factory_floor_analytics.json
Low-resolution YouTube warehouse footage often has no real helmets/vests, so this demo mostly shows person tracks flagged as non-compliant (domain shift vs SH17). Prefer clear construction video for positive PPE detections.
Related MCP server: mcp-analytics
Features
Layer | What it does |
Detection | RF-DETR Large fine-tuned for person / helmet / safety-vest (17 SH17 classes) |
Tracking | ByteTrack assigns stable worker |
Compliance | Helmet/vest associated via geometry; 15-frame window, 60% ratio threshold |
MCP | Read-only tools over precomputed JSON (summary, violations, worst offenders, trends, …) |
MCP tools
Tool | Purpose |
| Site-wide compliance rollup |
| Per-track status + narrative |
| Who failed PPE |
| Violations between two timestamps |
| Compliance rate over time buckets |
| Short-lived / noisy track IDs |
| Rank all workers by ratio / duration |
| Frame-level events |
| Re-read JSON after a new inference run |
Repo layout
ppe-compliance/
├── scripts/
│ ├── train_smoke.py / train_full.py # RF-DETR fine-tune
│ ├── video_infer.py # end-to-end video pipeline
│ ├── ppe_compliance.py # association + state machine
│ ├── export_checkpoint.py # Lightning ckpt → RF-DETR .pth
│ ├── sbatch_*.sh # OSC Slurm helpers
│ └── upload_release_weights.sh # optional: upload .pth to GitHub Releases
├── ppe_mcp/
│ ├── store.py # JSON query layer
│ ├── server.py # FastMCP tools
│ └── *_config.example.json # Claude / Cursor wiring
├── outputs/inference/ # sample annotated video + analytics JSON
├── docs/images/ # README stills from the annotated demo
├── setup_env.sh
└── requirements.txtQuick start
1. Environment (GPU recommended)
git clone https://github.com/Pratham-22/ppe-compliance.git
cd ppe-compliance
module load python/3.12 # on OSC Ascend, if available
bash setup_env.sh
source .venv/bin/activate2. Download model weights
Weights are not in git (GitHub file limit is 100 MB). Download the fine-tuned checkpoint from Release v0.1:
mkdir -p outputs/rfdetr_large
curl -L -o outputs/rfdetr_large/checkpoint_epoch44.pth \
"https://github.com/Pratham-22/ppe-compliance/releases/download/v0.1/checkpoint_epoch44.pth"3. Run inference on a video
A sample demo clip and prior analytics are already in the repo under data/videos/ and outputs/inference/.
# GPU job on OSC
sbatch scripts/sbatch_video_infer.sh
# or locally
python scripts/video_infer.py \
--video data/videos/factory_floor_demo.mp4 \
--checkpoint outputs/rfdetr_large/checkpoint_epoch44.pth \
--device cudaProduces:
outputs/inference/*_annotated.mp4outputs/inference/*_analytics.json
4. Query results with MCP
export PPE_ANALYTICS_JSON=outputs/inference/factory_floor_analytics.json
python -m ppe_mcp.serverWire into Cursor / Claude Desktop using the examples in ppe_mcp/.
Example agent prompts
“Give me a site-wide PPE summary.”
“Who are the 3 worst helmet offenders?”
“Explain worker #2.”
“What happened between 5s and 10s?”
Optional: train from scratch
Data
Download SH17 (Kaggle / upstream repo), then convert:
python scripts/convert_sh17_to_rfdetr.pyTrain
# smoke test
python scripts/train_smoke.py
# full fine-tune (Slurm on OSC)
sbatch scripts/sbatch_train_rfdetr.shExport a usable checkpoint:
python scripts/export_checkpoint.pySample outputs
This repo includes a demo run under outputs/inference/ (stills above in docs/images/):
Annotated video with
#track_idlabels and compliance colorsAnalytics JSON consumed by the MCP server
Notes
Worker IDs are ByteTrack track IDs, not employee names.
MCP is intentionally read-only over JSON — inference stays on GPU.
Default compliance settings: detection threshold
0.35, window15frames, min ratio0.6.
License / data
SH17 and third-party video remain under their original licenses. This code is provided for portfolio / interview demonstration.
This server cannot be deployed
Maintenance
Related MCP Connectors
Query Churn Solution cancellation-flow metrics, revenue, and feedback analytics (read-only).
Read-only analytics for Convex apps, queryable via MCP from Claude, Cursor, and other clients.
Query PanDev Metrics analytics and reporting data
A paid remote MCP for AI SDK data query MCP, built to return verdicts, receipts, usage logs, and aud
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceProvides access to PyTorch CI/CD analytics data including workflows, jobs, test runs, and log analysis through an MCP interface.4-
- FlicenseNot gradedqualityCmaintenanceExposes product analytics metrics from an internal data warehouse via MCP, enabling agents to query metrics, product summaries, and event breakdowns.-
- AlicenseAqualityCmaintenanceEnables agents to query warehouse safety review results, including verified alerts, semantic timeline search, and audit logs of rejected detections.7MIT
- AlicenseNot gradedqualityAmaintenanceProvides read-only access to Churn Solution retention analytics, including cancellation-flow metrics, save rates, recovered revenue, offer performance, cancellation reasons, and customer feedback.MIT

