Environment Variables
MCPHub uses environment variables for configuration. This guide covers all available variables and their usage.Core Application Settings
Server Configuration
Variable | Default | Description |
---|---|---|
PORT | 3000 | Port number for the HTTP server |
INIT_TIMEOUT | 300000 | Initial timeout for the application |
BASE_PATH | '' | The base path of the application |
READONLY | false | Set to true to enable readonly mode |
MCPHUB_SETTING_PATH | Path to the MCPHub settings | |
NODE_ENV | development | Application environment (development , production , test ) |
Authentication & Security
JWT Configuration
Variable | Default | Description |
---|---|---|
JWT_SECRET | - | Secret key for JWT token signing (required) |
Configuration Examples
Development Environment
Production Environment
Docker Environment
Environment Variable Loading
MCPHub loads environment variables in the following order:- System environment variables
.env.local
(ignored by git).env.{NODE_ENV}
(e.g.,.env.production
).env
Using dotenv-expand
MCPHub supports variable expansion:Security Best Practices
- Never commit secrets to version control
- Use strong, unique secrets for production
- Rotate secrets regularly
- Use environment-specific files
- Validate all environment variables at startup
- Use Docker secrets for container deployments