No description
- Python 78.5%
- HTML 14.9%
- CSS 5.1%
- Mako 0.8%
- Dockerfile 0.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| alembic | ||
| blueprints | ||
| static | ||
| templates | ||
| tests | ||
| .dockerignore | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| alembic.ini | ||
| app.py | ||
| auth.py | ||
| db.py | ||
| discord_auth.py | ||
| discord_bot.py | ||
| docker-compose.yml | ||
| Dockerfile | ||
| env_example | ||
| gunicorn.conf.py | ||
| LICENSE | ||
| rcon.py | ||
| README.md | ||
| requirements.txt | ||
| teams_service.py | ||
| wsgi.py | ||
MC Teams Manager
A lightweight Flask web application for managing Minecraft server teams via RCON. Players authenticate using a one-time code delivered in-game, then can create, join, and leave teams—all reflected instantly on the Minecraft server. Includes Discord OAuth2 account linking and bot-driven role management.
Features
- In-game authentication – users enter their Minecraft username and receive a 6-character code whispered to them in-game (valid for 5 minutes).
- Team creation – create teams with a name, 3-letter tag (unique), and Minecraft colour; the creator is automatically added.
- Team management – team creators can view members (with skin avatars), kick players, and invite new members via the management panel.
- Invite system – send invites to other players (they also receive an in-game notification); invited players can accept or decline through the web UI.
- Leave / auto-cleanup – players can leave their team at any time; empty teams are automatically removed from both the game and the database.
- Discord account linking – players link their Discord account via OAuth2; accounts can be unlinked at any time.
- Player skin avatars – member lists display each player's face extracted from their skin (served from the database).
- Real-time sync – every action is executed immediately on the Minecraft server through RCON.
Requirements
- Python 3.11+
- A Minecraft Java Edition server with RCON enabled
- A MySQL / MariaDB database
- (Optional) A Discord application with OAuth2 and a bot for role management
- (Optional) Docker & Docker Compose for containerised deployment
Configuration
Copy the example environment file and fill in your values:
cp env_example .env
Core
| Variable | Description |
|---|---|
RCON_HOST |
Minecraft server IP or hostname |
RCON_PORT |
RCON port (default 25575) |
RCON_PASSWORD |
RCON password configured on the server |
FLASK_SECRET |
A long random string used to sign session cookies |
SESSION_COOKIE_SECURE |
Set to 1 when served over HTTPS |
SESSION_COOKIE_SAMESITE |
Lax (default) or Strict |
LOG_LEVEL |
Logging verbosity: DEBUG, INFO (default), WARNING, ERROR, CRITICAL |
Database
| Variable | Description |
|---|---|
DATABASE_HOST |
Database hostname (default localhost) |
DATABASE_PORT |
Database port (default 3306) |
DATABASE_NAME |
Database name |
DATABASE_USER |
Database user |
DATABASE_PASSWORD |
Database password |
Discord
| Variable | Description |
|---|---|
DISCORD_CLIENT_ID |
Discord application (OAuth2) client ID |
DISCORD_CLIENT_SECRET |
Discord application client secret |
DISCORD_REDIRECT_URI |
OAuth2 callback URL (e.g. http://localhost:5000/discord/callback) |
DISCORD_BOT_TOKEN |
Bot token used for role management (needs MANAGE_ROLES permission) |
DISCORD_GUILD_ID |
Discord server (guild) ID where roles are managed |
Usage
Local development
# Create a virtual environment
python -m venv .venv && source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run the dev server
flask run
Production (Docker Compose)
docker compose up -d --build
The application listens on port 8000 by default. Place it behind a reverse proxy (e.g., Caddy, nginx, Traefik) that terminates TLS.
Note:
WEB_CONCURRENCYmust remain 1 while login codes are stored in memory; otherwise codes generated by one worker won't be visible to another. The RCON library (mcrcon) uses signal-based timeouts, soGUNICORN_THREADSmust also stay at 1.
Project structure
app.py # Flask application factory and configuration
auth.py # One-time login code generation & verification
db.py # Database access layer (MySQL)
discord_auth.py # Discord OAuth2 flow (link / unlink accounts)
discord_bot.py # Discord Bot API helpers (role CRUD & sync)
rcon.py # Thread-safe RCON connection wrapper
teams_service.py # Game-side team operations via RCON
gunicorn.conf.py # Gunicorn settings
wsgi.py # WSGI entry point
blueprints/
auth.py # Login, verify, logout routes
teams.py # Team CRUD, invites, member management routes
discord.py # Discord OAuth2 linking routes
templates/ # Jinja2 HTML templates
static/ # CSS assets
tests/ # Unit tests