Skip to content

Commit 2257115

Browse files
authored
Update env variables (#1215)
Signed-off-by: Mihai Criveti <[email protected]>
1 parent dd35300 commit 2257115

File tree

3 files changed

+97
-30
lines changed

3 files changed

+97
-30
lines changed

.env.example

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ DATABASE_URL=sqlite:///./mcp.db
5252
# Database Connection Pool Configuration
5353
# Maximum number of persistent connections (default: 200, optimized for SQLite)
5454
DB_POOL_SIZE=200
55-
# Additional connections beyond pool_size (default: 10, reduced for SQLite)
55+
# Additional connections beyond pool_size (default: 10, reduced to 5 for SQLite)
5656
DB_MAX_OVERFLOW=5
57-
# Seconds to wait for connection before timeout (increased for reliability)
57+
# Seconds to wait for connection before timeout (default: 30, increased to 60 for reliability)
5858
DB_POOL_TIMEOUT=60
5959
# Seconds before recreating connection (default: 3600)
6060
DB_POOL_RECYCLE=3600
61-
# Maximum database retry attempts (default: 3, increased for stability)
61+
# Maximum database retry attempts (default: 3, increased to 5 for stability)
6262
DB_MAX_RETRIES=5
6363
# Retry interval in milliseconds (default: 2000)
6464
DB_RETRY_INTERVAL_MS=2000
@@ -215,47 +215,47 @@ OAUTH_DEFAULT_TIMEOUT=3600
215215
# Enable Dynamic Client Registration (RFC 7591)
216216
# When enabled, MCP Gateway can automatically register as an OAuth client with Authorization Servers
217217
# that support DCR, eliminating the need for manual client credential configuration.
218-
MCPGATEWAY_DCR_ENABLED=true
218+
DCR_ENABLED=true
219219

220220
# Auto-register when gateway has issuer but no client_id
221221
# When true, gateway automatically registers with the Authorization Server when configured
222222
# with an issuer URL but no client credentials.
223-
MCPGATEWAY_DCR_AUTO_REGISTER_ON_MISSING_CREDENTIALS=true
223+
DCR_AUTO_REGISTER_ON_MISSING_CREDENTIALS=true
224224

225225
# Default scopes to request during DCR
226-
# Comma-separated list of OAuth scopes to request when auto-registering
227-
MCPGATEWAY_DCR_DEFAULT_SCOPES=mcp:read
226+
# JSON array of OAuth scopes to request when auto-registering
227+
DCR_DEFAULT_SCOPES=["mcp:read"]
228228

229229
# Optional allowlist of issuer URLs for DCR (empty = allow any)
230-
# Comma-separated list of trusted Authorization Server issuer URLs
231-
# Example: https://auth.example.com,https://auth2.example.com
232-
# Leave empty to allow DCR with any issuer (not recommended for production)
233-
MCPGATEWAY_DCR_ALLOWED_ISSUERS=
230+
# JSON array of trusted Authorization Server issuer URLs
231+
# Example: ["https://auth.example.com", "https://auth2.example.com"]
232+
# Empty array [] allows DCR with any issuer (not recommended for production)
233+
DCR_ALLOWED_ISSUERS=[]
234234

235235
# Token endpoint authentication method for DCR
236236
# Options: client_secret_basic (default), client_secret_post, none
237237
# - client_secret_basic: Send credentials via HTTP Basic Auth header
238238
# - client_secret_post: Send credentials in POST body
239239
# - none: Public client (no client secret, PKCE-only)
240-
MCPGATEWAY_DCR_TOKEN_ENDPOINT_AUTH_METHOD=client_secret_basic
240+
DCR_TOKEN_ENDPOINT_AUTH_METHOD=client_secret_basic
241241

242242
# AS metadata cache TTL in seconds (RFC 8414 discovery)
243243
# How long to cache Authorization Server metadata after discovery
244-
MCPGATEWAY_DCR_METADATA_CACHE_TTL=3600
244+
DCR_METADATA_CACHE_TTL=3600
245245

246246
# Template for client_name in DCR requests
247247
# {gateway_name} will be replaced with the actual gateway name
248-
MCPGATEWAY_DCR_CLIENT_NAME_TEMPLATE=MCP Gateway ({gateway_name})
248+
DCR_CLIENT_NAME_TEMPLATE=MCP Gateway ({gateway_name})
249249

250250
# Enable OAuth AS metadata discovery (RFC 8414)
251251
# When enabled, gateway automatically discovers Authorization Server endpoints
252252
# from the issuer URL using well-known metadata endpoints
253-
MCPGATEWAY_OAUTH_DISCOVERY_ENABLED=true
253+
OAUTH_DISCOVERY_ENABLED=true
254254

255255
# Preferred PKCE code challenge method
256256
# Options: S256 (SHA-256, recommended), plain (not recommended)
257257
# PKCE (Proof Key for Code Exchange) is always enabled for Authorization Code flows
258-
MCPGATEWAY_OAUTH_PREFERRED_CODE_CHALLENGE_METHOD=S256
258+
OAUTH_PREFERRED_CODE_CHALLENGE_METHOD=S256
259259

260260
# ==============================================================================
261261
# SSO (Single Sign-On) Configuration
@@ -315,6 +315,12 @@ SSO_TRUSTED_DOMAINS=[]
315315
# Keep local admin authentication when SSO is enabled
316316
SSO_PRESERVE_ADMIN_AUTH=true
317317

318+
# SSO Issuers Configuration
319+
# Optional JSON array of issuer URLs for SSO providers
320+
# Example: ["https://idp1.example.com", "https://idp2.example.com"]
321+
# Default: null (not set)
322+
# SSO_ISSUERS=["https://idp.example.com"]
323+
318324
# SSO Admin Assignment Settings
319325
# Email domains that automatically get admin privileges, e.g., ["yourcompany.com"]
320326
SSO_AUTO_ADMIN_DOMAINS=[]

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,7 @@ The LLM Chat MCP Client allows you to interact with MCP servers using conversati
12991299
| `SSO_TRUSTED_DOMAINS` | Trusted email domains (JSON array) | `[]` | JSON array |
13001300
| `SSO_PRESERVE_ADMIN_AUTH` | Preserve local admin authentication when SSO enabled | `true` | bool |
13011301
| `SSO_REQUIRE_ADMIN_APPROVAL` | Require admin approval for new SSO registrations | `false` | bool |
1302+
| `SSO_ISSUERS` | Optional JSON array of issuer URLs for SSO providers | (none) | JSON array |
13021303

13031304
**GitHub OAuth:**
13041305
| Setting | Description | Default | Options |
@@ -1371,18 +1372,18 @@ ContextForge implements **OAuth 2.0 Dynamic Client Registration (RFC 7591)** and
13711372
- ✅ Encrypted credential storage with Fernet encryption
13721373
- ✅ Configurable issuer allowlist for security
13731374

1374-
| Setting | Description | Default | Options |
1375-
|-------------------------------------------------------|----------------------------------------------------------------|--------------------------------|---------------|
1376-
| `MCPGATEWAY_DCR_ENABLED` | Enable Dynamic Client Registration (RFC 7591) | `true` | bool |
1377-
| `MCPGATEWAY_DCR_AUTO_REGISTER_ON_MISSING_CREDENTIALS` | Auto-register when gateway has issuer but no client_id | `true` | bool |
1378-
| `MCPGATEWAY_DCR_DEFAULT_SCOPES` | Default OAuth scopes to request during DCR | `mcp:read` | string |
1379-
| `MCPGATEWAY_DCR_ALLOWED_ISSUERS` | Allowlist of trusted issuer URLs (empty = allow any) | `[]` | JSON array |
1380-
| `MCPGATEWAY_DCR_TOKEN_ENDPOINT_AUTH_METHOD` | Token endpoint auth method | `client_secret_basic` | `client_secret_basic`, `client_secret_post`, `none` |
1381-
| `MCPGATEWAY_DCR_METADATA_CACHE_TTL` | AS metadata cache TTL in seconds | `3600` | int |
1382-
| `MCPGATEWAY_DCR_CLIENT_NAME_TEMPLATE` | Template for client_name in DCR requests | `MCP Gateway ({gateway_name})` | string |
1383-
| `MCPGATEWAY_OAUTH_DISCOVERY_ENABLED` | Enable AS metadata discovery (RFC 8414) | `true` | bool |
1384-
| `MCPGATEWAY_OAUTH_PREFERRED_CODE_CHALLENGE_METHOD` | PKCE code challenge method | `S256` | `S256`, `plain` |
1385-
| `JWT_AUDIENCE_VERIFICATION` | JWT audience verification (disable for DCR) | `true` | bool |
1375+
| Setting | Description | Default | Options |
1376+
|--------------------------------------------|----------------------------------------------------------------|--------------------------------|---------------|
1377+
| `DCR_ENABLED` | Enable Dynamic Client Registration (RFC 7591) | `true` | bool |
1378+
| `DCR_AUTO_REGISTER_ON_MISSING_CREDENTIALS` | Auto-register when gateway has issuer but no client_id | `true` | bool |
1379+
| `DCR_DEFAULT_SCOPES` | Default OAuth scopes to request during DCR | `["mcp:read"]` | JSON array |
1380+
| `DCR_ALLOWED_ISSUERS` | Allowlist of trusted issuer URLs (empty = allow any) | `[]` | JSON array |
1381+
| `DCR_TOKEN_ENDPOINT_AUTH_METHOD` | Token endpoint auth method | `client_secret_basic` | `client_secret_basic`, `client_secret_post`, `none` |
1382+
| `DCR_METADATA_CACHE_TTL` | AS metadata cache TTL in seconds | `3600` | int |
1383+
| `DCR_CLIENT_NAME_TEMPLATE` | Template for client_name in DCR requests | `MCP Gateway ({gateway_name})` | string |
1384+
| `OAUTH_DISCOVERY_ENABLED` | Enable AS metadata discovery (RFC 8414) | `true` | bool |
1385+
| `OAUTH_PREFERRED_CODE_CHALLENGE_METHOD` | PKCE code challenge method | `S256` | `S256`, `plain` |
1386+
| `JWT_AUDIENCE_VERIFICATION` | JWT audience verification (disable for DCR) | `true` | bool |
13861387

13871388
**Documentation:**
13881389
- [DCR Configuration Guide](https://ibm.github.io/mcp-context-forge/manage/dcr/) - Complete DCR setup and troubleshooting

charts/mcp-stack/values.yaml

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ mcpContextForge:
139139

140140
# ─ Cache behaviour ─
141141
CACHE_TYPE: redis # Backend cache driver (redis, memory, database)
142-
CACHE_PREFIX: mcpgw # Prefix applied to every cache key
142+
CACHE_PREFIX: "mcpgw:" # Prefix applied to every cache key
143143
SESSION_TTL: "3600" # TTL (s) for user sessions
144144
MESSAGE_TTL: "600" # TTL (s) for ephemeral messages (completions)
145145

@@ -164,6 +164,22 @@ mcpContextForge:
164164
MCPGATEWAY_A2A_MAX_RETRIES: "3" # maximum retry attempts for A2A calls
165165
MCPGATEWAY_A2A_METRICS_ENABLED: "true" # enable A2A agent metrics collection
166166

167+
# ─ MCP Server Catalog Configuration ─
168+
MCPGATEWAY_CATALOG_ENABLED: "true" # enable MCP server catalog feature
169+
MCPGATEWAY_CATALOG_FILE: "mcp-catalog.yml" # path to catalog configuration file
170+
MCPGATEWAY_CATALOG_AUTO_HEALTH_CHECK: "true" # automatically health check catalog servers
171+
MCPGATEWAY_CATALOG_CACHE_TTL: "3600" # catalog cache TTL in seconds
172+
MCPGATEWAY_CATALOG_PAGE_SIZE: "100" # number of catalog servers per page
173+
174+
# ─ UI Configuration ─
175+
MCPGATEWAY_UI_TOOL_TEST_TIMEOUT: "60000" # tool test timeout in milliseconds for the admin UI
176+
177+
# ─ LLM Chat Feature ─
178+
LLMCHAT_ENABLED: "false" # enable LLM Chat feature
179+
180+
# ─ Default Configuration ─
181+
DEFAULT_ROOTS: "[]" # default roots configuration (JSON array)
182+
167183
# ─ Security & CORS ─
168184
ENVIRONMENT: development # deployment environment (development/production)
169185
APP_DOMAIN: http://localhost # domain for production CORS origins
@@ -214,7 +230,7 @@ mcpContextForge:
214230
FEDERATION_ENABLED: "true" # enable federated mode
215231
FEDERATION_DISCOVERY: "false" # advertise & discover peers automatically
216232
FEDERATION_PEERS: '[]' # explicit peer list (JSON array)
217-
FEDERATION_TIMEOUT: "30" # seconds before peer request timeout
233+
FEDERATION_TIMEOUT: "120" # seconds before peer request timeout
218234
FEDERATION_SYNC_INTERVAL: "300" # seconds between peer syncs
219235

220236
# ─ Resource cache ─
@@ -285,6 +301,29 @@ mcpContextForge:
285301
ENABLE_OVERWRITE_BASE_HEADERS: "false" # enable overwriting of base headers (advanced usage)
286302
DEFAULT_PASSTHROUGH_HEADERS: '["X-Tenant-Id", "X-Trace-Id"]' # default headers to pass through (JSON array)
287303

304+
# ─ Advanced Validation Configuration ─
305+
# These are advanced security validation settings with sensible defaults.
306+
# Most users won't need to change these values.
307+
VALIDATION_ALLOWED_URL_SCHEMES: '["http://", "https://", "ws://", "wss://"]' # allowed URL schemes (JSON array)
308+
VALIDATION_ALLOWED_MIME_TYPES: '["text/plain", "text/html", "text/css", "text/markdown", "text/javascript", "application/json", "application/xml", "application/pdf", "image/png", "image/jpeg", "image/gif", "image/svg+xml", "application/octet-stream"]' # allowed MIME types (JSON array)
309+
VALIDATION_DANGEROUS_HTML_PATTERN: '<(script|iframe|object|embed|link|meta|base|form|img|svg|video|audio|source|track|area|map|canvas|applet|frame|frameset|html|head|body|style)\b|</*(script|iframe|object|embed|link|meta|base|form|img|svg|video|audio|source|track|area|map|canvas|applet|frame|frameset|html|head|body|style)>' # pattern to detect dangerous HTML tags
310+
VALIDATION_DANGEROUS_JS_PATTERN: '(?i)(?:^|\s|[\"''`<>=])(javascript:|vbscript:|data:\s*[^,]*[;\s]*(javascript|vbscript)|\bon[a-z]+\s*=|<\s*script\b)' # pattern to detect JavaScript injection
311+
VALIDATION_NAME_PATTERN: '^[a-zA-Z0-9_.\-\s]+$' # pattern for validating names (allows spaces)
312+
VALIDATION_IDENTIFIER_PATTERN: '^[a-zA-Z0-9_\-\.]+$' # pattern for validating IDs (no spaces)
313+
VALIDATION_SAFE_URI_PATTERN: '^[a-zA-Z0-9_\-.:/?=&%]+$' # pattern for safe URI characters
314+
VALIDATION_UNSAFE_URI_PATTERN: '[<>"''\\]' # pattern to detect unsafe URI characters
315+
VALIDATION_TOOL_NAME_PATTERN: '^[a-zA-Z][a-zA-Z0-9._-]*$' # MCP tool naming pattern
316+
VALIDATION_TOOL_METHOD_PATTERN: '^[a-zA-Z][a-zA-Z0-9_\./-]*$' # MCP tool method naming pattern
317+
VALIDATION_MAX_NAME_LENGTH: "255" # maximum length for names
318+
VALIDATION_MAX_DESCRIPTION_LENGTH: "8192" # maximum length for descriptions (8KB)
319+
VALIDATION_MAX_TEMPLATE_LENGTH: "65536" # maximum length for templates (64KB)
320+
VALIDATION_MAX_CONTENT_LENGTH: "1048576" # maximum length for content (1MB)
321+
VALIDATION_MAX_JSON_DEPTH: "10" # maximum JSON nesting depth
322+
VALIDATION_MAX_URL_LENGTH: "2048" # maximum URL length
323+
VALIDATION_MAX_RPC_PARAM_SIZE: "262144" # maximum RPC parameter size (256KB)
324+
VALIDATION_MAX_METHOD_LENGTH: "128" # maximum method name length
325+
VALIDATION_MAX_REQUESTS_PER_MINUTE: "60" # rate limiting: max requests per minute
326+
288327
####################################################################
289328
# SENSITIVE SETTINGS
290329
# Rendered into an Opaque Secret. NO $(VAR) expansion here.
@@ -321,6 +360,9 @@ mcpContextForge:
321360
PASSWORD_REQUIRE_SPECIAL: "false" # require special characters in passwords
322361
MAX_FAILED_LOGIN_ATTEMPTS: "5" # maximum failed login attempts before lockout
323362
ACCOUNT_LOCKOUT_DURATION_MINUTES: "30" # account lockout duration in minutes
363+
MIN_PASSWORD_LENGTH: "12" # minimum password length for validation
364+
MIN_SECRET_LENGTH: "32" # minimum secret key length for validation
365+
REQUIRE_STRONG_SECRETS: "false" # enforce strong secrets (fail startup on weak secrets)
324366

325367
# ─ MCP Client Authentication ─
326368
MCP_CLIENT_AUTH_ENABLED: "true" # enable JWT authentication for MCP client operations
@@ -330,6 +372,23 @@ mcpContextForge:
330372
# ─ OAuth Configuration ─
331373
OAUTH_REQUEST_TIMEOUT: "30" # OAuth request timeout in seconds
332374
OAUTH_MAX_RETRIES: "3" # maximum retries for OAuth token requests
375+
OAUTH_DEFAULT_TIMEOUT: "3600" # default OAuth token timeout in seconds
376+
377+
# ─ OAuth Dynamic Client Registration (DCR) & PKCE ─
378+
DCR_ENABLED: "true" # enable Dynamic Client Registration (RFC 7591)
379+
DCR_AUTO_REGISTER_ON_MISSING_CREDENTIALS: "true" # auto-register when gateway has issuer but no client_id
380+
DCR_DEFAULT_SCOPES: '["mcp:read"]' # default OAuth scopes to request during DCR (JSON array)
381+
DCR_ALLOWED_ISSUERS: "[]" # allowlist of trusted issuer URLs for DCR (empty = allow any)
382+
DCR_TOKEN_ENDPOINT_AUTH_METHOD: "client_secret_basic" # token endpoint auth method for DCR
383+
DCR_METADATA_CACHE_TTL: "3600" # AS metadata cache TTL in seconds (RFC 8414 discovery)
384+
DCR_CLIENT_NAME_TEMPLATE: "MCP Gateway ({gateway_name})" # template for client_name in DCR requests
385+
OAUTH_DISCOVERY_ENABLED: "true" # enable AS metadata discovery (RFC 8414)
386+
OAUTH_PREFERRED_CODE_CHALLENGE_METHOD: "S256" # PKCE code challenge method (S256 or plain)
387+
388+
# ─ JWT Configuration (Advanced) ─
389+
JWT_AUDIENCE_VERIFICATION: "true" # JWT audience verification (disable for DCR)
390+
JWT_PRIVATE_KEY_PATH: "" # path to JWT private key file (RSA/ECDSA algorithms)
391+
JWT_PUBLIC_KEY_PATH: "" # path to JWT public key file (RSA/ECDSA algorithms)
333392

334393
# ─ SSO (Single Sign-On) Configuration ─
335394
SSO_ENABLED: "false" # master switch for Single Sign-On authentication
@@ -338,6 +397,7 @@ mcpContextForge:
338397
SSO_PRESERVE_ADMIN_AUTH: "true" # preserve local admin authentication when SSO enabled
339398
SSO_REQUIRE_ADMIN_APPROVAL: "false" # require admin approval for new SSO registrations
340399
SSO_AUTO_ADMIN_DOMAINS: "[]" # email domains that automatically get admin privileges
400+
SSO_ISSUERS: "" # optional JSON array of issuer URLs for SSO providers
341401

342402
# ─ GitHub OAuth ─
343403
SSO_GITHUB_ENABLED: "false" # enable GitHub OAuth authentication

0 commit comments

Comments
 (0)