# Zen MCP Server Environment Configuration # Copy this file to .env and fill in your values # Required: Workspace root directory for file access # This should be the HOST path that contains all files Claude might reference # Defaults to $HOME for direct usage, auto-configured for Docker WORKSPACE_ROOT=/Users/your-username # API Keys - At least one is required # # IMPORTANT: Use EITHER OpenRouter OR native APIs (Gemini/OpenAI), not both! # Having both creates ambiguity about which provider serves each model. # # Option 1: Use native APIs (recommended for direct access) # Get your Gemini API key from: https://makersuite.google.com/app/apikey GEMINI_API_KEY=your_gemini_api_key_here # Get your OpenAI API key from: https://platform.openai.com/api-keys OPENAI_API_KEY=your_openai_api_key_here # Get your X.AI API key from: https://console.x.ai/ XAI_API_KEY=your_xai_api_key_here # Option 2: Use OpenRouter for access to multiple models through one API # Get your OpenRouter API key from: https://openrouter.ai/ # If using OpenRouter, comment out the native API keys above OPENROUTER_API_KEY=your_openrouter_api_key_here # Option 3: Use custom API endpoints for local models (Ollama, vLLM, LM Studio, etc.) # IMPORTANT: Since this server ALWAYS runs in Docker, you MUST use host.docker.internal instead of localhost # ❌ WRONG: http://localhost:11434/v1 (Docker containers cannot reach localhost) # ✅ CORRECT: http://host.docker.internal:11434/v1 (Docker can reach host services) # CUSTOM_API_URL=http://host.docker.internal:11434/v1 # Ollama example (NOT localhost!) # CUSTOM_API_KEY= # Empty for Ollama (no auth needed) # CUSTOM_MODEL_NAME=llama3.2 # Default model name # Optional: Default model to use # Options: 'auto' (Claude picks best model), 'pro', 'flash', 'o3', 'o3-mini', 'o4-mini', 'o4-mini-high' etc # When set to 'auto', Claude will select the best model for each task # Defaults to 'auto' if not specified DEFAULT_MODEL=auto # Optional: Default thinking mode for ThinkDeep tool # NOTE: Only applies to models that support extended thinking (e.g., Gemini 2.5 Pro) # Flash models (2.0) will use system prompt engineering instead # Token consumption per mode: # minimal: 128 tokens - Quick analysis, fastest response # low: 2,048 tokens - Light reasoning tasks # medium: 8,192 tokens - Balanced reasoning (good for most cases) # high: 16,384 tokens - Complex analysis (recommended for thinkdeep) # max: 32,768 tokens - Maximum reasoning depth, slowest but most thorough # Defaults to 'high' if not specified DEFAULT_THINKING_MODE_THINKDEEP=high # Optional: Model usage restrictions # Limit which models can be used from each provider for cost control, compliance, or standardization # Format: Comma-separated list of allowed model names (case-insensitive, whitespace tolerant) # Empty or unset = all models allowed (default behavior) # If you want to disable a provider entirely, don't set its API key # # Supported OpenAI models: # - o3 (200K context, high reasoning) # - o3-mini (200K context, balanced) # - o4-mini (200K context, latest balanced, temperature=1.0 only) # - o4-mini-high (200K context, enhanced reasoning, temperature=1.0 only) # - mini (shorthand for o4-mini) # # Supported Google/Gemini models: # - gemini-2.5-flash-preview-05-20 (1M context, fast, supports thinking) # - gemini-2.5-pro-preview-06-05 (1M context, powerful, supports thinking) # - flash (shorthand for gemini-2.5-flash-preview-05-20) # - pro (shorthand for gemini-2.5-pro-preview-06-05) # # Supported X.AI GROK models: # - grok-3 (131K context, advanced reasoning) # - grok-3-fast (131K context, higher performance but more expensive) # - grok (shorthand for grok-3) # - grok3 (shorthand for grok-3) # - grokfast (shorthand for grok-3-fast) # # Examples: # OPENAI_ALLOWED_MODELS=o3-mini,o4-mini,mini # Only allow mini models (cost control) # GOOGLE_ALLOWED_MODELS=flash # Only allow Flash (fast responses) # XAI_ALLOWED_MODELS=grok-3 # Only allow standard GROK (not fast variant) # OPENAI_ALLOWED_MODELS=o4-mini # Single model standardization # GOOGLE_ALLOWED_MODELS=flash,pro # Allow both Gemini models # XAI_ALLOWED_MODELS=grok,grok-3-fast # Allow both GROK variants # # Note: These restrictions apply even in 'auto' mode - Claude will only pick from allowed models # OPENAI_ALLOWED_MODELS= # GOOGLE_ALLOWED_MODELS= # XAI_ALLOWED_MODELS= # Optional: Custom model configuration file path # Override the default location of custom_models.json # CUSTOM_MODELS_CONFIG_PATH=/path/to/your/custom_models.json # Optional: Redis configuration (auto-configured for Docker) # The Redis URL for conversation threading - typically managed by docker-compose # REDIS_URL=redis://redis:6379/0 # Optional: Conversation timeout (hours) # How long AI-to-AI conversation threads persist before expiring # Longer timeouts use more Redis memory but allow resuming conversations later # Defaults to 3 hours if not specified CONVERSATION_TIMEOUT_HOURS=3 # Optional: Max conversation turns # Maximum number of turns allowed in an AI-to-AI conversation thread # Each exchange (Claude asks, Gemini responds) counts as 2 turns # So 20 turns = 10 exchanges. Defaults to 20 if not specified MAX_CONVERSATION_TURNS=20 # Optional: Logging level (DEBUG, INFO, WARNING, ERROR) # DEBUG: Shows detailed operational messages for troubleshooting (default) # INFO: Shows general operational messages # WARNING: Shows only warnings and errors # ERROR: Shows only errors LOG_LEVEL=DEBUG