Skip to main content

Environment Variables (.env)

Create a .env file in the same directory as docker-compose.yml and set the required values before starting the application.

Security (Required)

In the shipped Docker image, STUDIO_ENCRYPTION_KEY, STUDIO_JWT_SECRET, STUDIO_AGENT_SERVICE_TOKEN, and REDIS_PASSWORD are hard-required - startup fails if any is missing. Auto-generation of STUDIO_ENCRYPTION_KEY/STUDIO_JWT_SECRET only applies when STUDIO_ENV=dev.

Public Ports

Database

FastMCP

Agent MCP

Redis

Logging

GeoIP (Optional)

The GeoLite2-Country MMDB is downloaded at Docker build time and works air-gapped after build. When a MaxMind license key is configured, you can update the database at runtime via the Settings UI.
Get a free MaxMind license key at maxmind.com/en/geolite2/signup.

Security Controls

See Security > Prompt Injection Protection for details on what is scanned and how blocked attempts are reported.

SSL/TLS (Optional)

The SSL domain and ACME contact email are not environment variables - they are set as ServerConfig fields via the SSL / TLS settings in the UI, see below.

Generate Secrets


Server Settings (UI)

Server settings are managed through the Settings tab on the Server page (/server > Settings tab).

General

Security

SSL / TLS

Global Variables

Server-level key-value pairs accessible in all tool transform templates as {{ vars.key_name }}. Manage via the Global Variables card on the Settings tab, or via the API: PATCH /api/v1/server/config with global_variables.
Maximum 100 global variables. Names must match ^[a-zA-Z_]\w{0,63}$.

CORS Configuration

Default CORS origins allow only localhost:3000 and localhost:5173. For production, update to your actual domain:
Never use ["*"] in production - it allows any origin to make API requests.
Update via the Settings UI or the API: PATCH /api/v1/server/config with cors_origins.

Encryption Key Management

The STUDIO_ENCRYPTION_KEY is a symmetric encryption key used to encrypt:
  • Database connection passwords
  • Bearer authentication tokens
  • DNS API credentials for SSL
  • Sensitive extra_params fields (e.g., BigQuery credentials_json)
  • TOTP 2FA secrets
  • OAuth2 client credentials (MCP auth)
  • OAuth2 introspection client secret (MCP auth)
If not set, a key is auto-generated on first run. Set it explicitly in .env to persist encrypted data across container restarts.

Key Rotation

SMKRV MCP Studio supports encryption key rotation. To rotate:
  1. Generate a new key: python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
  2. Set STUDIO_ENCRYPTION_KEY to new_key,old_key (comma-separated, new key first)
  3. Restart the backend - new data is encrypted with the new key, old data can still be decrypted with the old key
  4. After all data has been re-encrypted (on next update of each entity), remove the old key

See Also