Feature Flags
Control available features during development via features.json.
Configuration
Create a features.json file in the project root:
{
"mcpapps": true,
"pulse": true,
"oauth-embedded": false
}
Location: features.json in project root (no environment variable needed)
Usage in Code
import { getFeatureGate } from './features/featureGate.js';
if (getFeatureGate().isFeatureEnabled('mcpapps')) {
// MCP Apps logic here
}
Behavior
- Lazy initialization: Feature gate loads config on first access
- Features not listed: Disabled by default
- Invalid JSON or missing file: All features disabled, error logged
- Partial validation: Invalid key-value pairs are skipped with a warning, valid pairs are loaded
Adding a New Feature Flag
- Add the feature name and default value to
features.json - Use
getFeatureGate().isFeatureEnabled('your-feature')in your code - No code changes needed to enable/disable - just update the JSON file