99# in modules (not part of Settings). Those sections are labeled explicitly.
1010
1111# =============================================================================
12- # Required: change before use
12+ # REQUIRED SECRETS - Application will NOT start without these
13+ # =============================================================================
14+ #
15+ # ⚠️ SECURITY WARNING: JWT_SECRET_KEY and AUTH_ENCRYPTION_SECRET are REQUIRED
16+ # in EVERY environment — including local development.
17+ # The application will refuse to start if either value is a placeholder
18+ # (__REPLACE_ME__) or a known-weak default.
19+ #
20+ # Quickstart (fresh checkout):
21+ # 1. make install-dev # installs Python deps — does NOT touch .env
22+ # 2. make init-secrets # generates .env.secrets (prompts before overwrite)
23+ # 3. Copy values from .env.secrets into this file, OR:
24+ # make init-secrets-patch-env # patches secrets directly into .env (no copy needed)
25+ #
26+ # Docker Compose / CI (non-interactive):
27+ # python3 -m mcpgateway.scripts.init_secrets --patch-env .env
28+ # # or: python3 -m mcpgateway.scripts.init_secrets --force && \
29+ # # grep -E '^(JWT_SECRET_KEY|AUTH_ENCRYPTION_SECRET|BASIC_AUTH_PASSWORD)=' .env.secrets >> .env
30+ #
31+ # What each path writes:
32+ # make init-secrets / --stdout / --force (writes .env.secrets):
33+ # - JWT_SECRET_KEY (REQUIRED — all environments)
34+ # - AUTH_ENCRYPTION_SECRET (REQUIRED — all environments)
35+ # - BASIC_AUTH_PASSWORD (for UI/API Basic Auth)
36+ # - PLATFORM_ADMIN_PASSWORD (for bootstrap admin account)
37+ #
38+ # make setup / make init-secrets-patch-env / --patch-env (in-place patch):
39+ # - JWT_SECRET_KEY (patched when placeholder or weak)
40+ # - AUTH_ENCRYPTION_SECRET (patched when placeholder or weak)
41+ # - BASIC_AUTH_PASSWORD (patched when "changeme" or placeholder)
42+ # NOTE: PLATFORM_ADMIN_PASSWORD is NOT patched by this path — set it manually
43+ # or via helm/k8s secrets before production deployment.
44+ #
1345# =============================================================================
1446
15- # Admin UI HTTP Basic Auth credentials
16- # PRODUCTION: Change these values
17- BASIC_AUTH_USER = admin
18- BASIC_AUTH_PASSWORD = changeme
19-
20- # JWT secret used to sign tokens
21- # Generate with: python -m mcpgateway.scripts.init_secrets --stdout
47+ # JWT secret used to sign tokens (REQUIRED — all environments, including development)
48+ # Generate with: python3 -m mcpgateway.scripts.init_secrets
2249JWT_SECRET_KEY = __REPLACE_ME__run_init-secrets_before_starting
2350
24- # Passphrase used to encrypt stored auth secrets
25- # Generate with: python -m mcpgateway.scripts.init_secrets --stdout
51+ # Passphrase used to encrypt stored auth secrets (REQUIRED — all environments, including development)
52+ # Generate with: python3 -m mcpgateway.scripts.init_secrets
2653AUTH_ENCRYPTION_SECRET = __REPLACE_ME__run_init-secrets_before_starting
2754
55+ # =============================================================================
56+ # Environment Mode
57+ # =============================================================================
58+ # Controls CORS, cookie security, and operational defaults — but NOT secret
59+ # enforcement. Placeholder/weak secrets are rejected in every environment.
60+ # - development: Relaxed CORS (localhost:3000/8080), insecure cookies, dev info
61+ # - staging: Production-like CORS and cookie defaults, staging domain
62+ # - production: Strict CORS (APP_DOMAIN only), secure cookies, no debug info
63+ # Default: development (if not set)
64+ ENVIRONMENT = development
65+
66+ # =============================================================================
67+ # Admin UI HTTP Basic Auth credentials
68+ # =============================================================================
69+ # BASIC_AUTH_PASSWORD is patched to a strong value by make setup / make init-secrets-patch-env.
70+ # PLATFORM_ADMIN_PASSWORD must be set manually — it is not patched by the automated path.
71+ BASIC_AUTH_USER = admin
72+ BASIC_AUTH_PASSWORD = changeme # pragma: allowlist secret
73+
2874# -----------------------------------------------------------------------------
2975# CSRF Protection Configuration
3076# -----------------------------------------------------------------------------
@@ -588,7 +634,7 @@ DATAPLANE_PUBLISHER_INTERVAL_SECONDS = 60
588634
589635# Health checks
590636# HEALTH_CHECK_INTERVAL=60
591- # HEALTH_CHECK_TIMEOUT=5
637+ # HEALTH_CHECK_TIMEOUT=30
592638# UNHEALTHY_THRESHOLD=3
593639# GATEWAY_VALIDATION_TIMEOUT=5
594640# MAX_CONCURRENT_HEALTH_CHECKS=10
@@ -988,11 +1034,12 @@ MCPGATEWAY_SKIP_MIGRATIONS=false
9881034# ECDSA (Asymmetric): ES256, ES384, ES512 - High performance, modern crypto
9891035# JWT_ALGORITHM=HS256
9901036
991- # === HMAC (Symmetric) Configuration - Default for Development ===
1037+ # === HMAC (Symmetric) Configuration ===
9921038# Secret used to sign JWTs (required for HMAC algorithms: HS256, HS384, HS512)
993- # PRODUCTION: Use a strong, random secret (minimum 32 characters)
994- # Generate with: openssl rand -base64 32
995- # JWT_SECRET_KEY=my-test-key-but-now-longer-than-32-bytes
1039+ # REQUIRED in all environments — see "REQUIRED SECRETS" section at the top of this file.
1040+ # Use a strong, random secret (minimum 32 characters). Generate with:
1041+ # python3 -m mcpgateway.scripts.init_secrets
1042+ # JWT_SECRET_KEY=
9961043
9971044# === RSA/ECDSA (Asymmetric) Configuration - Recommended for Production ===
9981045# Public and private key paths (required for asymmetric algorithms: RS*, ES*)
@@ -1163,9 +1210,9 @@ VALIDATE_TOKEN_ENVIRONMENT=true
11631210# SECURITY: Keep this false in production unless you explicitly need public sign-up
11641211# PUBLIC_REGISTRATION_ENABLED=false
11651212
1166- # Admin protection mode
1167- # When true (default), no admin can be demoted, deactivated, or locked out via API/UI
1168- # When false, only the last remaining active admin is protected
1213+ # Admin login-lockout protection
1214+ # When true (default), active admin accounts can bypass login lockout
1215+ # Admin self-demotion and last-active-admin protection are always enforced independently
11691216# PROTECT_ALL_ADMINS=true
11701217
11711218# Platform admin user (bootstrap from environment)
@@ -1286,7 +1333,8 @@ VALIDATE_TOKEN_ENVIRONMENT=true
12861333
12871334# Used to derive an AES encryption key for secure auth storage
12881335# Must be a non-empty string (e.g. passphrase or random secret)
1289- # AUTH_ENCRYPTION_SECRET=my-test-salt
1336+ # Generate with: python3 -m mcpgateway.scripts.init_secrets
1337+ # AUTH_ENCRYPTION_SECRET=
12901338
12911339# Identity Propagation - forward end-user identity to upstream MCP servers
12921340# IDENTITY_PROPAGATION_ENABLED=false
@@ -1571,6 +1619,11 @@ VALIDATE_TOKEN_ENVIRONMENT=true
15711619# MAX_TEAMS_PER_USER=50
15721620# MAX_MEMBERS_PER_TEAM=100
15731621
1622+ # Hard ceiling on how many members can be seeded in a single POST /teams request
1623+ # (the `members` array). Validated at the request boundary before any write; the
1624+ # per-team MAX_MEMBERS_PER_TEAM limit still applies underneath.
1625+ # MAX_TEAM_MEMBER_SEEDS=500
1626+
15741627# Team Invitation Settings
15751628# INVITATION_EXPIRY_DAYS=7
15761629# REQUIRE_EMAIL_VERIFICATION_FOR_INVITES=true
@@ -2474,11 +2527,11 @@ VALIDATE_TOKEN_ENVIRONMENT=true
24742527# Project defaults block sets HEALTH_CHECK_INTERVAL=300 for local dev
24752528# HEALTH_CHECK_INTERVAL=60
24762529
2477- # Health check timeout in seconds (default: 5 )
2478- # HEALTH_CHECK_TIMEOUT=5
2530+ # Health check timeout in seconds (default: 30 )
2531+ # HEALTH_CHECK_TIMEOUT=30
24792532
2480- # Per-check timeout (seconds) to bound total time of one gateway health check (default: 5 .0)
2481- # GATEWAY_HEALTH_CHECK_TIMEOUT=5 .0
2533+ # Per-check timeout (seconds) to bound total time of one gateway health check (default: 30 .0)
2534+ # GATEWAY_HEALTH_CHECK_TIMEOUT=30 .0
24822535
24832536# Consecutive failures before marking gateway offline (default: 3)
24842537# UNHEALTHY_THRESHOLD=3
@@ -3053,11 +3106,6 @@ PLUGINS_CLI_MARKUP_MODE=rich
30533106
30543107# --- Runtime / launcher envs --------------------------------------------------
30553108
3056- # Runtime/launcher env (docker-entrypoint.sh)
3057- # HTTP server to use (for containers)
3058- # Options: gunicorn (default, stable), granian (alternative, Rust-based)
3059- # HTTP_SERVER=gunicorn
3060-
30613109# Disable access logging for performance
30623110# Options: true, false (default)
30633111# When true: Disables both gunicorn and uvicorn access logs
@@ -3068,7 +3116,7 @@ PLUGINS_CLI_MARKUP_MODE=rich
30683116
30693117# Force start even if another instance is running
30703118# Options: true, false (default)
3071- # Bypasses the lock file check at /tmp/mcpgateway-gunicorn.lock or /tmp/mcpgateway-granian.lock
3119+ # Bypasses the lock file check at /tmp/mcpgateway-gunicorn.lock
30723120# FORCE_START=false
30733121
30743122# --- Gunicorn Production Server Configuration --------------------------------
@@ -3108,30 +3156,9 @@ PLUGINS_CLI_MARKUP_MODE=rich
31083156# WARNING: Disables preload_app. Not for production!
31093157# GUNICORN_DEV_MODE=false
31103158
3111- # --- Granian Runtime Configuration -------------------------------------------
3112-
3113- # These settings are used by run-granian.sh for production deployments.
3114- # They control the Granian server behavior.
3115- # GRANIAN_WORKERS=auto
3116- # GRANIAN_RUNTIME_MODE=auto
3117- # GRANIAN_RUNTIME_THREADS=1
3118- # GRANIAN_BLOCKING_THREADS=1
3119- # GRANIAN_HTTP=auto
3120- # GRANIAN_LOOP=uvloop
3121- # GRANIAN_TASK_IMPL=auto
3122- # GRANIAN_HTTP1_PIPELINE_FLUSH=true
3123- # GRANIAN_HTTP1_BUFFER_SIZE=524288
3124- # GRANIAN_BACKLOG=2048
3125- # GRANIAN_BACKPRESSURE=512
3126- # GRANIAN_RESPAWN_FAILED=true
3127- # GRANIAN_WORKERS_LIFETIME=
3128- # GRANIAN_WORKERS_MAX_RSS=
3129- # GRANIAN_DEV_MODE=false
3130- # GRANIAN_LOG_LEVEL=info
3131-
31323159# --- SSL/TLS Configuration (launcher) ----------------------------------------
31333160
3134- # Enable HTTPS for production deployments (run-gunicorn.sh / run-granian.sh )
3161+ # Enable HTTPS for production deployments (run-gunicorn.sh)
31353162
31363163# Enable TLS/SSL
31373164# Options: true, false (default)
0 commit comments