No description
  • Python 78.5%
  • HTML 14.9%
  • CSS 5.1%
  • Mako 0.8%
  • Dockerfile 0.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-03-14 20:35:05 +00:00
alembic Add Warp to Base with db migration 2026-03-14 13:31:49 +00:00
blueprints Reorganize UI 2026-03-14 20:32:23 +00:00
static Reorganize UI 2026-03-14 20:32:23 +00:00
templates Reorganize UI 2026-03-14 20:32:23 +00:00
tests Fix tests 2026-02-17 11:59:59 +00:00
.dockerignore Initial commit 2026-02-02 16:46:26 +00:00
.gitignore User team added to game, discord, and db 2026-02-17 10:07:03 +00:00
.gitlab-ci.yml Add logging 2026-02-18 10:52:47 +00:00
alembic.ini Add Alembic and SQL migrations 2026-03-13 12:45:04 +00:00
app.py Refactoring - blueprints 2026-02-25 19:04:05 +00:00
auth.py Add logging 2026-02-18 10:52:47 +00:00
db.py Removed unused functions, added color to db 2026-03-14 18:17:16 +00:00
discord_auth.py Add logging 2026-02-18 10:52:47 +00:00
discord_bot.py Add logging 2026-02-18 10:52:47 +00:00
docker-compose.yml Initial commit 2026-02-02 16:46:26 +00:00
Dockerfile Initial commit 2026-02-02 16:46:26 +00:00
env_example A few tweaks 2026-02-18 11:18:28 +00:00
gunicorn.conf.py Initial commit 2026-02-02 16:46:26 +00:00
LICENSE Add LICENSE 2026-02-02 18:01:14 +00:00
rcon.py Pipeline test 2026-02-02 17:22:10 +00:00
README.md Update README 2026-03-06 19:36:18 +00:00
requirements.txt Add Alembic and SQL migrations 2026-03-13 12:45:04 +00:00
teams_service.py Refactoring teams 2026-03-14 18:08:00 +00:00
wsgi.py Pipeline test 2026-02-02 17:22:10 +00:00

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_CONCURRENCY must 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, so GUNICORN_THREADS must 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