feat: add configurable environment variable override system
Add ZEN_MCP_FORCE_ENV_OVERRIDE configuration to control whether .env file values override system environment variables. This prevents conflicts when multiple AI tools pass different cached environment variables to the MCP server. - Use dotenv_values() to read configuration from .env file only - Apply conditional override based on configuration setting - Add appropriate logging for transparency - Update .env.example with detailed configuration documentation - Maintains backward compatibility with default behavior (false)
This commit is contained in:
25
.env.example
25
.env.example
@@ -167,6 +167,31 @@ DISABLED_TOOLS=analyze,refactor,testgen,secaudit,docgen,tracer
|
||||
# Leave empty for default language (English)
|
||||
# LOCALE=fr-FR
|
||||
|
||||
# ===========================================
|
||||
# Zen MCP Server Configuration
|
||||
# ===========================================
|
||||
|
||||
# Force .env file values to override system environment variables
|
||||
# This prevents issues where different AI tools (Claude Code, etc.) pass
|
||||
# conflicting or cached environment variables that override each other
|
||||
#
|
||||
# When enabled (true):
|
||||
# - .env file values take absolute precedence
|
||||
# - Prevents MCP clients from passing outdated/cached API keys
|
||||
# - Ensures consistent configuration across different AI tool integrations
|
||||
# - Solves environment variable conflicts between multiple AI applications
|
||||
#
|
||||
# When disabled (false):
|
||||
# - System environment variables take precedence (standard behavior)
|
||||
# - Suitable for production deployments with secure environment injection
|
||||
# - Respects container orchestrator and CI/CD pipeline configurations
|
||||
#
|
||||
# Recommended settings:
|
||||
# Development with multiple AI tools: true (prevents tool conflicts)
|
||||
# Production/Container deployments: false (preserves security practices)
|
||||
# CI/CD environments: false (respects pipeline secrets)
|
||||
ZEN_MCP_FORCE_ENV_OVERRIDE=false
|
||||
|
||||
# ===========================================
|
||||
# Docker Configuration
|
||||
# ===========================================
|
||||
|
||||
Reference in New Issue
Block a user