main
FastAPI service that syncs content ratings on Plex libraries, with MCP tool server, scheduled sync, and Podman Quadlet deployment.
Plex Age Limit Setter
A FastAPI service that automatically sets content ratings on Plex media library items. Runs on a schedule and exposes an MCP (Model Context Protocol) endpoint for AI-agent-driven library management.
Features
- Scheduled sync — Periodically applies a target content rating to all items in a specified library
- Manual trigger —
POST /triggerto run an immediate sync (rate-limited to 1 req/min) - MCP tool server —
POST /mcpexposes Plex operations as MCP tools for AI agents (list libraries, search movies, set ratings, batch update, manage collections, refresh/analyze libraries) - Health endpoint —
GET /health
Configuration
Config via environment variables (.env file):
| Variable | Default | Description |
|---|---|---|
PLEX_BASEURL |
http://host.containers.internal:32400 |
Plex server URL |
PLEX_TOKEN |
— | Plex auth token |
PLEX_USERNAME |
— | Plex username (fallback auth) |
PLEX_PASSWORD |
— | Plex password (fallback auth) |
TARGET_LIBRARY |
BorneVideo |
Library section to manage |
TARGET_CONTENT_RATING |
2 |
Rating to apply to all items |
SCHEDULE_INTERVAL_MINUTES |
5 |
How often to run sync |
TRIGGER_RATE_LIMIT |
60 |
Max manual triggers per minute |
LOG_LEVEL |
INFO |
Logging level |
Quick start
cp .env.example .env # edit with your Plex details
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8000
Container (Podman Quadlet)
make build # podman build -t localhost/plex-age-setter:latest
make install # cp quadlet file + systemctl daemon-reload
make start # systemctl start plex-age-setter.service
make stop # systemctl stop plex-age-setter.service
make logs # journalctl -u plex-age-setter.service -f
MCP Tools
The service speaks the Model Context Protocol at POST /mcp. Tools include: list_libraries, get_library_stats, list_content_ratings, search_movies, set_content_rating, batch_set_content_rating, update_all_content_ratings, list_collections, refresh_library, analyze_library, and more.
Description
FastAPI service that syncs content ratings on Plex libraries via scheduled tasks and MCP tools
Languages
Python
96.4%
Makefile
2.5%
Dockerfile
1.1%