Skip to content

Commit 3fb659c

Browse files
authored
Merge branch 'main' into fix_redis_connection_leak
2 parents ca39a83 + 3fe3035 commit 3fb659c

150 files changed

Lines changed: 11787 additions & 5024 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.0.5
2+
current_version = 1.0.6
33
commit = False
44
tag = False
55
sign-tags = True

.dockerignore

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ agent_runtimes/
1313
charts/
1414
deployment/
1515
docs/
16-
deployment/k8s/
1716
mcp-servers/
1817
!mcp-servers/
1918
!mcp-servers/rust/
@@ -24,13 +23,10 @@ mcp-servers/
2423
tests/
2524
test/
2625
attic/
27-
*.md
2826
.benchmarks/
2927
.claude
3028

3129
# Rust MCP servers built from the root Cargo workspace.
32-
!mcp-servers/
33-
!mcp-servers/rust/
3430
!mcp-servers/rust/fast-time-server/
3531
!mcp-servers/rust/fast-time-server/Cargo.toml
3632
!mcp-servers/rust/fast-time-server/src/
@@ -48,8 +44,6 @@ attic/
4844
# Development environment directories
4945
.devcontainer/
5046
.github/
51-
.vscode/
52-
.idea/
5347

5448
#----------------------------------------------------------------------
5549
# 2. Version control
@@ -65,7 +59,6 @@ attic/
6559
# Byte-compiled files
6660
__pycache__/
6761
*.py[cod]
68-
*.pyc
6962
*$py.class
7063

7164
# C extensions
@@ -130,11 +123,8 @@ cython_debug/
130123
#----------------------------------------------------------------------
131124
# 4. Virtual environments
132125
#----------------------------------------------------------------------
133-
.env
134126
.venv
135-
.venv/
136127
**/.venv
137-
**/.venv/
138128
env/
139129
venv/
140130
ENV/
@@ -199,7 +189,6 @@ podman-compose*.yaml
199189
*~
200190

201191
# Emacs
202-
*~
203192
\#*\#
204193
.\#*
205194

@@ -237,7 +226,6 @@ MANIFEST.in
237226
.travis.*
238227
.gitlab-ci.yml
239228
.circleci/
240-
.github/
241229
azure-pipelines.yml
242230
Jenkinsfile
243231

@@ -260,8 +248,6 @@ mypy.ini
260248
*.db
261249
*.sqlite
262250
*.sqlite3
263-
mcp.db
264-
db.sqlite3
265251
# Explicit database file patterns in application directories
266252
mcpgateway/*.db
267253
mcpgateway/*.sqlite
@@ -313,14 +299,9 @@ local_settings.py
313299
# 10. Framework-specific files
314300
#----------------------------------------------------------------------
315301
# Django
316-
*.log
317-
local_settings.py
318-
db.sqlite3
319302
db.sqlite3-journal
320-
media/
321303

322304
# Flask
323-
instance/
324305
.webassets-cache
325306

326307
# Scrapy
@@ -333,7 +314,6 @@ docs/build/
333314
# PyBuilder
334315
target/
335316
**/target/
336-
**/target/**
337317

338318
# Jupyter Notebook
339319
.ipynb_checkpoints
@@ -371,25 +351,17 @@ celerybeat.pid
371351
*.rej
372352
.backup/
373353
backup/
374-
tmp/
375354
temp/
376355

377356
#----------------------------------------------------------------------
378357
# 12. Documentation and miscellaneous
379358
#----------------------------------------------------------------------
380359
*.md
381360
!README.md
382-
383-
# Application configuration files (explicitly include)
384-
!mcp-catalog.yml
385-
LICENSE
386-
CHANGELOG
387-
AUTHORS
388-
CONTRIBUTORS
389-
TODO
390-
TODO.md
391-
DEVELOPING.md
392-
CONTRIBUTING.md
361+
!CHANGELOG.md
362+
!AUTHORS.md
363+
!DEVELOPING.md
364+
!CONTRIBUTING.md
393365

394366
# Spelling
395367
.spellcheck-en.txt
@@ -410,7 +382,6 @@ Desktop.ini
410382
$RECYCLE.BIN/
411383

412384
# Linux
413-
*~
414385
.fuse_hidden*
415386
.directory
416387
.Trash-*

.env.example

Lines changed: 78 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,68 @@
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
2249
JWT_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
2653
AUTH_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)

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
# Explicitly ensure shell scripts and other Unix files use LF
55
*.sh text eol=lf
66
*.py text eol=lf
7+
.secrets.baseline merge=secrets-baseline
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# ===============================================================
2+
# Compose Production Smoke — Skip Reporter
3+
# ===============================================================
4+
#
5+
# This workflow is the complement of compose-prod-smoke.yml.
6+
# It runs on every PR and immediately reports success for the
7+
# "Compose Production Smoke Complete" required status check so
8+
# that PRs are not blocked waiting for a check that only runs
9+
# in the merge queue.
10+
#
11+
# Together with the compose-prod-smoke-complete gate job in
12+
# compose-prod-smoke.yml, the required check always has a result:
13+
# - Pull request → this workflow reports success (skipped)
14+
# - Merge queue → compose-prod-smoke.yml runs the real check
15+
#
16+
# ===============================================================
17+
18+
name: Compose Production Smoke Skip Reporter
19+
20+
on:
21+
pull_request:
22+
types: [opened, synchronize, ready_for_review]
23+
branches: ["main"]
24+
25+
permissions:
26+
contents: read
27+
28+
jobs:
29+
compose-prod-smoke-complete:
30+
name: Compose Production Smoke Complete
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Compose production smoke skipped on PR — runs in merge queue
34+
run: echo "Compose production smoke skipped — the real check runs in the merge queue via compose-prod-smoke.yml"

0 commit comments

Comments
 (0)