Configuration Reference
This guide provides comprehensive configuration options for ContextForge, including database setup, environment variables, and deployment-specific settings.
🔐 Required: Change Before Use
These variables have insecure defaults and must be changed before production deployment:
| Variable | Description | Default | Action Required |
|---|---|---|---|
JWT_SECRET_KEY |
Secret key for signing JWT tokens | my-test-key |
Generate with openssl rand -hex 32 |
AUTH_ENCRYPTION_SECRET |
Passphrase for encrypting stored credentials | my-test-salt |
Generate with openssl rand -hex 32 |
BASIC_AUTH_USER |
Username for HTTP Basic auth | admin |
Change for production |
BASIC_AUTH_PASSWORD |
Password for HTTP Basic auth | changeme |
Set a strong password |
PLATFORM_ADMIN_EMAIL |
Email for bootstrap admin user | admin@example.com |
Use real admin email |
PLATFORM_ADMIN_PASSWORD |
Password for bootstrap admin user | changeme |
Set a strong password |
DEFAULT_USER_PASSWORD |
Default password for new users | changeme |
Set a strong password |
Copy .env.example to .env and update these values.
!!! warning "Startup Validation"
If any required .env variable is missing or invalid, the gateway will fail fast at startup with a validation error via Pydantic.
🔒 Security Defaults (Secure by Default)
These settings are enabled by default for security—only disable for backward compatibility:
| Variable | Description | Default |
|---|---|---|
REQUIRE_JTI |
Require JTI claim in tokens for revocation support | true |
REQUIRE_TOKEN_EXPIRATION |
Require exp claim in tokens | true |
PUBLIC_REGISTRATION_ENABLED |
Allow public user self-registration | false |
PROTECT_ALL_ADMINS |
Prevent any admin from being demoted or deactivated via API/UI | true |
⚙️ Project Defaults (Dev Setup)
These values in .env.example differ from code defaults to provide a working local/dev setup:
| Variable | Description | Default |
|---|---|---|
HOST |
Bind address | 0.0.0.0 |
MCPGATEWAY_UI_ENABLED |
Enable Admin UI dashboard | true |
MCPGATEWAY_ADMIN_API_ENABLED |
Enable Admin API endpoints | true |
DATABASE_URL |
SQLAlchemy connection URL | sqlite:///./mcp.db |
🗄️ Database Configuration
ContextForge supports multiple database backends with full feature parity across all supported systems.
Supported Databases
| Database | Support Level | Connection String Example | Notes |
|---|---|---|---|
| SQLite | ✅ Full | sqlite:///./mcp.db |
Default, file-based |
| PostgreSQL | ✅ Full | postgresql+psycopg://postgres:changeme@localhost:5432/mcp |
Recommended for production |
| MariaDB | ✅ Full | mysql+pymysql://mysql:changeme@localhost:3306/mcp |
36+ tables, MariaDB 10.6+ |
| MySQL | ✅ Full | mysql+pymysql://admin:changeme@localhost:3306/mcp |
Alternative MySQL variant |
PostgreSQL System Dependencies
!!! warning "Required: libpq Development Headers"
The PostgreSQL adapter (psycopg[c]) requires the libpq development headers to compile. Install them before running pip install .[postgres]:
=== "Debian/Ubuntu"
```bash
sudo apt-get install libpq-dev
```
=== "RHEL/CentOS/Fedora"
```bash
sudo dnf install postgresql-devel
```
=== "macOS (Homebrew)"
```bash
brew install libpq
```
After installing the system dependencies, install the Python package:
```bash
pip install .[postgres]
```
MariaDB/MySQL Setup Details
!!! success "MariaDB & MySQL Full Support" MariaDB and MySQL are fully supported alongside SQLite and PostgreSQL:
- **36+ database tables** work perfectly with MariaDB 10.6+ and MySQL 8.0+
- All **VARCHAR length issues** have been resolved for MariaDB/MySQL compatibility
- Complete feature parity with SQLite and PostgreSQL
- Supports all ContextForge features including federation, caching, and A2A agents
Connection String Format
DATABASE_URL=mysql+pymysql://[username]:[password]@[host]:[port]/[database]
Local MariaDB/MySQL Installation
=== "Ubuntu/Debian (MariaDB)" ```bash # Install MariaDB server sudo apt update && sudo apt install mariadb-server
# Secure installation (optional)
sudo mariadb-secure-installation
# Create database and user
sudo mariadb -e "CREATE DATABASE mcp;"
sudo mariadb -e "CREATE USER 'mysql'@'localhost' IDENTIFIED BY 'changeme';"
sudo mariadb -e "GRANT ALL PRIVILEGES ON mcp.* TO 'mysql'@'localhost';"
sudo mariadb -e "FLUSH PRIVILEGES;"
```
=== "Ubuntu/Debian (MySQL)" ```bash # Install MySQL server sudo apt update && sudo apt install mysql-server
# Secure installation (optional)
sudo mysql_secure_installation
# Create database and user
sudo mysql -e "CREATE DATABASE mcp;"
sudo mysql -e "CREATE USER 'mysql'@'localhost' IDENTIFIED BY 'changeme';"
sudo mysql -e "GRANT ALL PRIVILEGES ON mcp.* TO 'mysql'@'localhost';"
sudo mysql -e "FLUSH PRIVILEGES;"
```
=== "macOS (Homebrew - MariaDB)" ```bash # Install MariaDB brew install mariadb brew services start mariadb
# Create database and user
mariadb -u root -e "CREATE DATABASE mcp;"
mariadb -u root -e "CREATE USER 'mysql'@'localhost' IDENTIFIED BY 'changeme';"
mariadb -u root -e "GRANT ALL PRIVILEGES ON mcp.* TO 'mysql'@'localhost';"
mariadb -u root -e "FLUSH PRIVILEGES;"
```
Docker MariaDB/MySQL Setup
# Start MariaDB container (recommended)
docker run -d --name mariadb-mcp \
-e MYSQL_ROOT_PASSWORD=mysecretpassword \
-e MYSQL_DATABASE=mcp \
-e MYSQL_USER=mysql \
-e MYSQL_PASSWORD=changeme \
-p 3306:3306 \
registry.redhat.io/rhel9/mariadb-106:12.0.2-ubi10
# Or start MySQL container
docker run -d --name mysql-mcp \
-e MYSQL_ROOT_PASSWORD=mysecretpassword \
-e MYSQL_DATABASE=mcp \
-e MYSQL_USER=mysql \
-e MYSQL_PASSWORD=changeme \
-p 3306:3306 \
mysql:8
# Connection string for ContextForge (same for both)
DATABASE_URL=mysql+pymysql://mysql:changeme@localhost:3306/mcp
🔧 Environment Variables Reference
Basic Settings
| Setting | Description | Default | Options |
|---|---|---|---|
APP_NAME |
Gateway / OpenAPI title | ContextForge |
string |
HOST |
Bind address for the app | 127.0.0.1 |
IPv4/IPv6 |
PORT |
Port the server listens on | 4444 |
1-65535 |
CLIENT_MODE |
Client-only mode for gateway-as-client | false |
bool |
DATABASE_URL |
SQLAlchemy connection URL | sqlite:///./mcp.db |
any SQLAlchemy dialect |
APP_ROOT_PATH |
Subpath prefix for app (e.g. /gateway) |
(empty) | string |
TEMPLATES_DIR |
Path to Jinja2 templates | mcpgateway/templates |
path |
STATIC_DIR |
Path to static files | mcpgateway/static |
path |
PROTOCOL_VERSION |
MCP protocol version supported | 2025-06-18 |
string |
FORGE_CONTENT_TYPE |
Content-Type for outgoing requests to Forge | application/json |
application/json, application/x-www-form-urlencoded |
!!! tip "Subpath Deployment"
Use APP_ROOT_PATH=/foo if reverse-proxying under a subpath like https://host.com/foo/.
Authentication
| Setting | Description | Default | Options |
|---|---|---|---|
BASIC_AUTH_USER |
Username for HTTP Basic authentication (when enabled) | admin |
string |
BASIC_AUTH_PASSWORD |
Password for HTTP Basic authentication (when enabled) | changeme |
string |
API_ALLOW_BASIC_AUTH |
Enable Basic auth for API endpoints (disabled by default for security) | false |
bool |
DOCS_ALLOW_BASIC_AUTH |
Enable Basic auth for docs endpoints (disabled by default) | false |
bool |
PLATFORM_ADMIN_EMAIL |
Email for bootstrap platform admin user (auto-created with admin privileges) | admin@example.com |
string |
AUTH_REQUIRED |
Require authentication for all API routes | true |
bool |
JWT_ALGORITHM |
Algorithm used to sign the JWTs (HS256 is default, HMAC-based) |
HS256 |
PyJWT algs |
JWT_SECRET_KEY |
Secret key used to sign JWT tokens for API access | my-test-key |
string |
JWT_PUBLIC_KEY_PATH |
If an asymmetric algorithm is used, a public key is required | (empty) | path to pem |
JWT_PRIVATE_KEY_PATH |
If an asymmetric algorithm is used, a private key is required | (empty) | path to pem |
JWT_AUDIENCE |
JWT audience claim for token validation | mcpgateway-api |
string |
JWT_AUDIENCE_VERIFICATION |
Disables jwt audience verification (useful for DCR) | true |
boolean |
JWT_ISSUER_VERIFICATION |
Disables jwt issuer verification (useful for custom auth) | true |
boolean |
JWT_ISSUER |
JWT issuer claim for token validation | mcpgateway |
string |
TOKEN_EXPIRY |
Expiry of generated JWTs in minutes | 10080 |
int > 0 |
REQUIRE_TOKEN_EXPIRATION |
Require all JWT tokens to have expiration claims | true |
bool |
REQUIRE_JTI |
Require JTI (JWT ID) claim in all tokens for revocation support | true |
bool |
REQUIRE_USER_IN_DB |
Require all authenticated users to exist in the database | false |
bool |
EMBED_ENVIRONMENT_IN_TOKENS |
Embed environment claim in gateway-issued JWTs | false |
bool |
VALIDATE_TOKEN_ENVIRONMENT |
Reject tokens with mismatched environment claim | false |
bool |
AUTH_ENCRYPTION_SECRET |
Passphrase used to derive AES key for encrypting tool auth headers | my-test-salt |
string |
OAUTH_REQUEST_TIMEOUT |
OAuth request timeout in seconds | 30 |
int > 0 |
OAUTH_MAX_RETRIES |
Maximum retries for OAuth token requests | 3 |
int > 0 |
OAUTH_DEFAULT_TIMEOUT |
Default OAuth token timeout in seconds | 3600 |
int > 0 |
INSECURE_ALLOW_QUERYPARAM_AUTH |
Enable query parameter authentication for gateways (see security warning) | false |
bool |
INSECURE_QUERYPARAM_AUTH_ALLOWED_HOSTS |
JSON array of hosts allowed to use query param auth | [] |
JSON array |
!!! warning "Query Parameter Authentication (INSECURE)"
The INSECURE_ALLOW_QUERYPARAM_AUTH setting enables API key authentication via URL query parameters. This is inherently insecure (CWE-598) as API keys may appear in proxy logs, browser history, and server access logs. Only enable this when the upstream MCP server (e.g., Tavily) requires this authentication method. Always configure INSECURE_QUERYPARAM_AUTH_ALLOWED_HOSTS to restrict which hosts can use this feature.
!!! info "Basic Authentication"
Basic Authentication is DISABLED by default for security. BASIC_AUTH_USER/PASSWORD are only used when Basic auth is explicitly enabled:
- `API_ALLOW_BASIC_AUTH=true` - Enable for API endpoints (e.g., `/api/metrics/*`)
- `DOCS_ALLOW_BASIC_AUTH=true` - Enable for docs endpoints (`/docs`, `/redoc`)
**Recommended:** Use JWT tokens instead of Basic auth:
```bash
export MCPGATEWAY_BEARER_TOKEN=$(python3 -m mcpgateway.utils.create_jwt_token ...)
curl -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" http://localhost:4444/api/...
```
!!! tip "JWT Token Generation"
JWT_SECRET_KEY is used to sign JSON Web Tokens. Generate tokens via:
bash export MCPGATEWAY_BEARER_TOKEN=$(python3 -m mcpgateway.utils.create_jwt_token --username admin@example.com --exp 10080 --secret my-test-key)
UI Features
For detailed guidance on embedding and section customization, see Admin UI Customization.
| Setting | Description | Default | Options |
|---|---|---|---|
MCPGATEWAY_UI_ENABLED |
Enable the interactive Admin dashboard | false |
bool |
MCPGATEWAY_ADMIN_API_ENABLED |
Enable API endpoints for admin ops | false |
bool |
MCPGATEWAY_UI_AIRGAPPED |
Use local CDN assets for airgapped deployments | false |
bool |
MCPGATEWAY_UI_EMBEDDED |
Embedded UI mode (hides logout + team selector by default) | false |
bool |
MCPGATEWAY_UI_HIDE_SECTIONS |
CSV/JSON list of UI sections to hide (overview, servers, gateways, tools, prompts, resources, roots, mcp-registry, metrics, plugins, export-import, logs, version-info, maintenance, teams, users, agents, tokens, settings) | [] |
CSV/JSON list |
MCPGATEWAY_UI_HIDE_HEADER_ITEMS |
CSV/JSON list of header items to hide (logout, team_selector, user_identity, theme_toggle) | [] |
CSV/JSON list |
MCPGATEWAY_BULK_IMPORT_ENABLED |
Enable bulk import endpoint for tools | true |
bool |
MCPGATEWAY_BULK_IMPORT_MAX_TOOLS |
Maximum number of tools per bulk import request | 200 |
int |
MCPGATEWAY_BULK_IMPORT_RATE_LIMIT |
Rate limit for bulk import endpoint (requests per minute) | 10 |
int |
MCPGATEWAY_UI_TOOL_TEST_TIMEOUT |
Tool test timeout in milliseconds for the admin UI | 60000 |
int |
!!! note "Per-Request UI Hiding"
For embedded contexts, you can also hide UI sections per-request by adding ?ui_hide=... to the Admin UI URL.
Example:
```text
/admin/?ui_hide=prompts,resources,teams
```
The query value is stored in an HttpOnly cookie with a 30-day lifetime. Clear it by visiting:
```text
/admin/?ui_hide=
```
!!! tip "Production Settings"
Set both UI and Admin API to false to disable management UI and APIs in production.
A2A (Agent-to-Agent) Features
| Setting | Description | Default | Options |
|---|---|---|---|
MCPGATEWAY_A2A_ENABLED |
Enable A2A agent features | true |
bool |
MCPGATEWAY_A2A_MAX_AGENTS |
Maximum number of A2A agents allowed | 100 |
int |
MCPGATEWAY_A2A_DEFAULT_TIMEOUT |
Default timeout for A2A HTTP requests (seconds) | 30 |
int |
MCPGATEWAY_A2A_MAX_RETRIES |
Maximum retry attempts for A2A calls | 3 |
int |
MCPGATEWAY_A2A_METRICS_ENABLED |
Enable A2A agent metrics collection | true |
bool |
Configuration Effects:
MCPGATEWAY_A2A_ENABLED=false: Completely disables A2A features (API endpoints return 404, admin tab hidden)MCPGATEWAY_A2A_METRICS_ENABLED=false: Disables metrics collection while keeping functionality
Direct Proxy Mode
| Setting | Description | Default | Options |
|---|---|---|---|
MCPGATEWAY_DIRECT_PROXY_ENABLED |
Enable direct_proxy gateway mode | false |
bool |
MCPGATEWAY_DIRECT_PROXY_TIMEOUT |
Timeout for direct proxy operations (seconds) | 30 |
int |
Configuration Effects:
MCPGATEWAY_DIRECT_PROXY_ENABLED=false(default): Gateways cannot usegateway_mode=direct_proxy; existing ones fall back to cache modeMCPGATEWAY_DIRECT_PROXY_ENABLED=true: Enables pass-through MCP operations bypassing the caching layer
Usage: Register a gateway with "gateway_mode": "direct_proxy", then send requests with the X-Context-Forge-Gateway-Id header set to the gateway's ID. All MCP operations (tools/list, tools/call, resources/list, resources/read) will be proxied directly to the remote server.
ToolOps
ToolOps streamlines the entire workflow by enabling seamless tool enrichment, automated test case generation, and comprehensive tool validation.
| Setting | Description | Default | Options |
|---|---|---|---|
TOOLOPS_ENABLED |
Enable ToolOps functionality | false |
bool |
LLM Chat MCP Client
The LLM Chat MCP Client allows you to interact with MCP servers using conversational AI from multiple LLM providers.
| Setting | Description | Default | Options |
|---|---|---|---|
LLMCHAT_ENABLED |
Enable LLM Chat functionality | true |
bool |
LLM_PROVIDER |
LLM provider selection | azure_openai |
azure_openai, openai, anthropic, aws_bedrock, ollama |
Azure OpenAI Configuration:
| Setting | Description | Default | Options |
|---|---|---|---|
AZURE_OPENAI_ENDPOINT |
Azure OpenAI endpoint URL | (none) | string |
AZURE_OPENAI_API_KEY |
Azure OpenAI API key | (none) | string |
AZURE_OPENAI_DEPLOYMENT |
Azure OpenAI deployment name | (none) | string |
AZURE_OPENAI_API_VERSION |
Azure OpenAI API version | 2024-02-15-preview |
string |
AZURE_OPENAI_TEMPERATURE |
Sampling temperature | 0.7 |
float (0.0-2.0) |
AZURE_OPENAI_MAX_TOKENS |
Maximum tokens to generate | (none) | int |
OpenAI Configuration:
| Setting | Description | Default | Options |
|---|---|---|---|
OPENAI_API_KEY |
OpenAI API key | (none) | string |
OPENAI_MODEL |
OpenAI model name | gpt-4o-mini |
string |
OPENAI_BASE_URL |
Base URL for OpenAI-compatible endpoints | (none) | string |
OPENAI_TEMPERATURE |
Sampling temperature | 0.7 |
float (0.0-2.0) |
OPENAI_MAX_RETRIES |
Maximum number of retries | 2 |
int |
Anthropic Claude Configuration:
| Setting | Description | Default | Options |
|---|---|---|---|
ANTHROPIC_API_KEY |
Anthropic API key | (none) | string |
ANTHROPIC_MODEL |
Claude model name | claude-3-5-sonnet-20241022 |
string |
ANTHROPIC_TEMPERATURE |
Sampling temperature | 0.7 |
float (0.0-1.0) |
ANTHROPIC_MAX_TOKENS |
Maximum tokens to generate | 4096 |
int |
ANTHROPIC_MAX_RETRIES |
Maximum number of retries | 2 |
int |
AWS Bedrock Configuration:
| Setting | Description | Default | Options |
|---|---|---|---|
AWS_BEDROCK_MODEL_ID |
Bedrock model ID | (none) | string |
AWS_BEDROCK_REGION |
AWS region name | us-east-1 |
string |
AWS_BEDROCK_TEMPERATURE |
Sampling temperature | 0.7 |
float (0.0-1.0) |
AWS_BEDROCK_MAX_TOKENS |
Maximum tokens to generate | 4096 |
int |
AWS_ACCESS_KEY_ID |
AWS access key ID (optional) | (none) | string |
AWS_SECRET_ACCESS_KEY |
AWS secret access key (optional) | (none) | string |
AWS_SESSION_TOKEN |
AWS session token (optional) | (none) | string |
IBM WatsonX AI Configuration:
| Setting | Description | Default | Options |
|---|---|---|---|
WATSONX_URL |
watsonx url | (none) | string |
WATSONX_APIKEY |
API key | (none) | string |
WATSONX_PROJECT_ID |
Project Id for WatsonX | (none) | string |
WATSONX_MODEL_ID |
Watsonx model id | ibm/granite-13b-chat-v2 |
string |
WATSONX_TEMPERATURE |
temperature (optional) | 0.7 |
float (0.0-1.0) |
Ollama Configuration:
| Setting | Description | Default | Options |
|---|---|---|---|
OLLAMA_BASE_URL |
Ollama base URL | http://localhost:11434 |
string |
OLLAMA_MODEL |
Ollama model name | llama3.2 |
string |
OLLAMA_TEMPERATURE |
Sampling temperature | 0.7 |
float (0.0-2.0) |
Provider Requirements:
- Azure OpenAI: Requires
AZURE_OPENAI_ENDPOINT,AZURE_OPENAI_API_KEY, andAZURE_OPENAI_DEPLOYMENT - OpenAI: Requires
OPENAI_API_KEY - Anthropic: Requires
ANTHROPIC_API_KEYandpip install langchain-anthropic - AWS Bedrock: Requires
AWS_BEDROCK_MODEL_IDandpip install langchain-aws boto3. Uses AWS credential chain if explicit credentials not provided. - IBM WatsonX AI: Requires
WATSONX_URL,WATSONX_APIKEY,WATSONX_PROJECT_ID,WATSONX_MODEL_IDandpip install langchain-ibm - Ollama: Requires local Ollama instance running (default:
http://localhost:11434)
Redis Configurations for Chat Sessions:
| Setting | Description | Default | Options |
|---|---|---|---|
LLMCHAT_SESSION_TTL |
Seconds for active_session key TTL | 300 |
int |
LLMCHAT_SESSION_LOCK_TTL |
Seconds for lock expiry | 30 |
int |
LLMCHAT_SESSION_LOCK_RETRIES |
How many times to poll while waiting | 10 |
int |
LLMCHAT_SESSION_LOCK_WAIT |
Seconds between polls | 0.2 |
float |
LLMCHAT_CHAT_HISTORY_TTL |
Seconds for chat history expiry | 3600 |
int |
LLMCHAT_CHAT_HISTORY_MAX_MESSAGES |
Maximum message history to store per user | 50 |
int |
LLM Settings (Internal API)
The LLM Settings feature enables ContextForge to act as a unified LLM provider with an OpenAI-compatible API.
| Setting | Description | Default | Options |
|---|---|---|---|
LLM_API_PREFIX |
API prefix for internal LLM endpoints | /v1 |
string |
LLM_REQUEST_TIMEOUT |
Request timeout for LLM API calls (seconds) | 120 |
int |
LLM_STREAMING_ENABLED |
Enable streaming responses | true |
bool |
LLM_HEALTH_CHECK_INTERVAL |
Provider health check interval (seconds) | 300 |
int |
Gateway Provider Settings:
| Setting | Description | Default | Options |
|---|---|---|---|
GATEWAY_MODEL |
Default model to use | gpt-4o |
string |
GATEWAY_BASE_URL |
Base URL for gateway LLM API | (auto) | string |
GATEWAY_TEMPERATURE |
Sampling temperature | 0.7 |
float |
API Endpoints:
# List available models
curl -H "Authorization: Bearer $TOKEN" http://localhost:4444/v1/models
# Chat completion
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4o", "messages": [{"role": "user", "content": "Hello"}]}' \
http://localhost:4444/v1/chat/completions
Email-Based Authentication & User Management
| Setting | Description | Default | Options |
|---|---|---|---|
EMAIL_AUTH_ENABLED |
Enable email-based authentication system | true |
bool |
PLATFORM_ADMIN_EMAIL |
Email for bootstrap platform admin user | admin@example.com |
string |
PLATFORM_ADMIN_PASSWORD |
Password for bootstrap platform admin user | changeme |
string |
PLATFORM_ADMIN_FULL_NAME |
Full name for bootstrap platform admin user | Platform Administrator |
string |
DEFAULT_USER_PASSWORD |
Default password for newly created users | changeme |
string |
ARGON2ID_TIME_COST |
Argon2id time cost (iterations) | 3 |
int > 0 |
ARGON2ID_MEMORY_COST |
Argon2id memory cost in KiB | 65536 |
int > 0 |
ARGON2ID_PARALLELISM |
Argon2id parallelism (threads) | 1 |
int > 0 |
PASSWORD_MIN_LENGTH |
Minimum password length | 8 |
int > 0 |
PASSWORD_REQUIRE_UPPERCASE |
Require uppercase letters in passwords | true |
bool |
PASSWORD_REQUIRE_LOWERCASE |
Require lowercase letters in passwords | true |
bool |
PASSWORD_REQUIRE_NUMBERS |
Require numbers in passwords | false |
bool |
PASSWORD_REQUIRE_SPECIAL |
Require special characters in passwords | true |
bool |
MAX_FAILED_LOGIN_ATTEMPTS |
Maximum failed login attempts before lockout | 10 |
int > 0 |
ACCOUNT_LOCKOUT_DURATION_MINUTES |
Account lockout duration in minutes | 1 |
int > 0 |
ACCOUNT_LOCKOUT_NOTIFICATION_ENABLED |
Send lockout notification emails | true |
bool |
FAILED_LOGIN_MIN_RESPONSE_MS |
Minimum failed-login response duration to reduce timing side channels | 250 |
int >= 0 |
PASSWORD_RESET_ENABLED |
Enable self-service forgot-password/reset flow | true |
bool |
PASSWORD_RESET_TOKEN_EXPIRY_MINUTES |
Password reset token expiry window | 60 |
int > 0 |
PASSWORD_RESET_RATE_LIMIT |
Max reset requests per email in rate window | 5 |
int > 0 |
PASSWORD_RESET_RATE_WINDOW_MINUTES |
Password reset rate-limit window | 15 |
int > 0 |
PASSWORD_RESET_INVALIDATE_SESSIONS |
Invalidate active sessions on reset | true |
bool |
PASSWORD_RESET_MIN_RESPONSE_MS |
Minimum forgot-password response duration | 250 |
int >= 0 |
PROTECT_ALL_ADMINS |
Prevent any admin from being demoted or deactivated via API/UI. When false, only the last active admin is protected. | true |
bool |
SMTP_ENABLED |
Enable SMTP notifications for auth emails | false |
bool |
SMTP_HOST |
SMTP host | (none) | string |
SMTP_PORT |
SMTP port | 587 |
int |
SMTP_USER |
SMTP username | (none) | string |
SMTP_PASSWORD |
SMTP password | (none) | string |
SMTP_FROM_EMAIL |
Sender email address | (none) | string |
SMTP_FROM_NAME |
Sender display name | ContextForge |
string |
SMTP_USE_TLS |
Use STARTTLS | true |
bool |
SMTP_USE_SSL |
Use implicit SSL/TLS | false |
bool |
SMTP_TIMEOUT_SECONDS |
SMTP timeout in seconds | 15 |
int > 0 |
When PASSWORD_RESET_ENABLED=false, self-service forgot/reset endpoints are disabled (403 on API and disabled/redirected UI flows).
When SMTP_ENABLED=false, reset requests are accepted but no email is delivered.
MCP Client Authentication
| Setting | Description | Default | Options |
|---|---|---|---|
MCP_CLIENT_AUTH_ENABLED |
Enable JWT authentication for MCP client operations | true |
bool |
MCP_REQUIRE_AUTH |
Require authentication for /mcp endpoints. If false, unauthenticated requests can access public items only | false |
bool |
TRUST_PROXY_AUTH |
Trust proxy authentication headers | false |
bool |
PROXY_USER_HEADER |
Header containing authenticated username from proxy | X-Authenticated-User |
string |
!!! warning "MCP Access Control Dependencies"
Full MCP access control (visibility + team scoping + membership validation) requires MCP_CLIENT_AUTH_ENABLED=true with valid JWT tokens containing team claims. When MCP_CLIENT_AUTH_ENABLED=false, access control relies on MCP_REQUIRE_AUTH plus tool/resource visibility only—team membership validation is skipped since there's no JWT to extract teams from.
SSO (Single Sign-On) Configuration
| Setting | Description | Default | Options |
|---|---|---|---|
SSO_ENABLED |
Master switch for Single Sign-On authentication | false |
bool |
SSO_AUTO_CREATE_USERS |
Automatically create users from SSO providers | true |
bool |
SSO_TRUSTED_DOMAINS |
Trusted email domains (JSON array) | [] |
JSON array |
SSO_PRESERVE_ADMIN_AUTH |
Preserve local admin authentication when SSO enabled | true |
bool |
SSO_REQUIRE_ADMIN_APPROVAL |
Require admin approval for new SSO registrations | false |
bool |
SSO_ISSUERS |
Optional JSON array of issuer URLs for SSO providers | (none) | JSON array |
SSO_AUTO_ADMIN_DOMAINS |
Email domains that automatically get admin privileges | [] |
JSON array |
GitHub OAuth:
| Setting | Description | Default | Options |
|---|---|---|---|
SSO_GITHUB_ENABLED |
Enable GitHub OAuth authentication | false |
bool |
SSO_GITHUB_CLIENT_ID |
GitHub OAuth client ID | (none) | string |
SSO_GITHUB_CLIENT_SECRET |
GitHub OAuth client secret | (none) | string |
SSO_GITHUB_ADMIN_ORGS |
GitHub orgs granting admin privileges (JSON) | [] |
JSON array |
Google OAuth:
| Setting | Description | Default | Options |
|---|---|---|---|
SSO_GOOGLE_ENABLED |
Enable Google OAuth authentication | false |
bool |
SSO_GOOGLE_CLIENT_ID |
Google OAuth client ID | (none) | string |
SSO_GOOGLE_CLIENT_SECRET |
Google OAuth client secret | (none) | string |
SSO_GOOGLE_ADMIN_DOMAINS |
Google admin domains (JSON) | [] |
JSON array |
IBM Security Verify OIDC:
| Setting | Description | Default | Options |
|---|---|---|---|
SSO_IBM_VERIFY_ENABLED |
Enable IBM Security Verify OIDC authentication | false |
bool |
SSO_IBM_VERIFY_CLIENT_ID |
IBM Security Verify client ID | (none) | string |
SSO_IBM_VERIFY_CLIENT_SECRET |
IBM Security Verify client secret | (none) | string |
SSO_IBM_VERIFY_ISSUER |
IBM Security Verify OIDC issuer URL | (none) | string |
Keycloak OIDC:
| Setting | Description | Default | Options |
|---|---|---|---|
SSO_KEYCLOAK_ENABLED |
Enable Keycloak OIDC authentication | false |
bool |
SSO_KEYCLOAK_BASE_URL |
Keycloak base URL | (none) | string |
SSO_KEYCLOAK_REALM |
Keycloak realm name | master |
string |
SSO_KEYCLOAK_CLIENT_ID |
Keycloak client ID | (none) | string |
SSO_KEYCLOAK_CLIENT_SECRET |
Keycloak client secret | (none) | string |
SSO_KEYCLOAK_MAP_REALM_ROLES |
Map Keycloak realm roles to gateway teams | true |
bool |
SSO_KEYCLOAK_MAP_CLIENT_ROLES |
Map Keycloak client roles to gateway RBAC | false |
bool |
SSO_KEYCLOAK_USERNAME_CLAIM |
JWT claim for username | preferred_username |
string |
SSO_KEYCLOAK_EMAIL_CLAIM |
JWT claim for email | email |
string |
SSO_KEYCLOAK_GROUPS_CLAIM |
JWT claim for groups/roles | groups |
string |
Microsoft Entra ID OIDC:
| Setting | Description | Default | Options |
|---|---|---|---|
SSO_ENTRA_ENABLED |
Enable Microsoft Entra ID OIDC authentication | false |
bool |
SSO_ENTRA_CLIENT_ID |
Microsoft Entra ID client ID | (none) | string |
SSO_ENTRA_CLIENT_SECRET |
Microsoft Entra ID client secret | (none) | string |
SSO_ENTRA_TENANT_ID |
Microsoft Entra ID tenant ID | (none) | string |
SSO_ENTRA_GROUPS_CLAIM |
JWT claim for Entra groups/roles | groups |
string |
SSO_ENTRA_ADMIN_GROUPS |
Groups granting platform_admin |
[] |
JSON array |
SSO_ENTRA_ROLE_MAPPINGS |
Map Entra groups to ContextForge roles | {} |
JSON object |
SSO_ENTRA_DEFAULT_ROLE |
Default role when no mapping matches | (none) | string/null |
SSO_ENTRA_SYNC_ROLES_ON_LOGIN |
Synchronize mapped roles on every login | true |
bool |
SSO_ENTRA_GRAPH_API_ENABLED |
Enable Graph API fallback for groups overage | true |
bool |
SSO_ENTRA_GRAPH_API_TIMEOUT |
Timeout (seconds) for Graph fallback request | 10 |
int |
SSO_ENTRA_GRAPH_API_MAX_GROUPS |
Maximum groups retained from Graph fallback (0 = unlimited) |
0 |
int |
Generic OIDC Provider (Auth0, Authentik, etc.):
| Setting | Description | Default | Options |
|---|---|---|---|
SSO_GENERIC_ENABLED |
Enable generic OIDC provider authentication | false |
bool |
SSO_GENERIC_PROVIDER_ID |
Provider ID (e.g., keycloak, auth0, authentik) | (none) | string |
SSO_GENERIC_DISPLAY_NAME |
Display name shown on login page | (none) | string |
SSO_GENERIC_CLIENT_ID |
Generic OIDC client ID | (none) | string |
SSO_GENERIC_CLIENT_SECRET |
Generic OIDC client secret | (none) | string |
SSO_GENERIC_AUTHORIZATION_URL |
Authorization endpoint URL | (none) |
…(truncated)