# ============================================================
# SEARCH PROVIDER SELECTION
# ============================================================
# Choose which search provider to use: google, brave, or tavily
# Default: google (for backwards compatibility)
#
# Recommended: brave (better pricing, no sunset date)
# ============================================================
#SEARCH_PROVIDER=google
# ============================================================
# BRAVE SEARCH API CONFIGURATION (Recommended)
# ============================================================
# Why Brave?
# - 2,000 free queries/month (vs Google's 100/day)
# - $3/month for 5,000 queries (vs Google's $5/1,000)
# - Privacy-focused, no tracking
# - No sunset date announced
#
# Get API key: https://api.search.brave.com/app/keys
# Free tier: No credit card required!
# ============================================================
#BRAVE_API_KEY=your_brave_api_key_here
# ============================================================
# TAVILY SEARCH API CONFIGURATION (AI-Optimized)
# ============================================================
# Why Tavily?
# - Optimized for AI agents and research workflows
# - 1,000 free queries/month
# - $30/month for 4,000 queries
# - Advanced search depth for comprehensive results
# - Quality scoring for better source ranking
#
# Get API key: https://app.tavily.com/sign-in
# Best for: Deep research, synthesis, academic use
# ============================================================
#TAVILY_API_KEY=your_tavily_api_key_here
# ============================================================
# GOOGLE CUSTOM SEARCH API CONFIGURATION (Legacy)
# ============================================================
# IMPORTANT: Google CLOSED this API to new users in 2024!
# API SUNSET: January 1, 2027 - migrate to Brave or Tavily
# ============================================================
# Required (if using Google): Your Google API Key
# Get from: https://console.cloud.google.com/apis/credentials
# NOTE: You need an EXISTING key (new keys cannot be created)
GOOGLE_API_KEY=your_google_api_key_here
# Required (if using Google): Your Custom Search Engine ID
# Get from: https://programmablesearchengine.google.com/
GOOGLE_SEARCH_ENGINE_ID=your_search_engine_id_here
# ============================================================
# GOOGLE USAGE LIMITS (FREE TIER)
# ============================================================
# - 100 queries per day FREE
# - After 100: $5 per 1,000 queries (max 10k/day)
#
# Monitor usage: https://console.cloud.google.com/apis/dashboard
# Enable billing: https://console.cloud.google.com/billing
# ============================================================
# ============================================================
# USAGE TRACKING (Optional)
# ============================================================
# Track your API usage and costs across all providers
# Helps prevent unexpected bills and quota overruns
#
# USAGE_TRACKING_ENABLED: Enable/disable tracking (default: false)
# USAGE_TRACKING_PERSIST: Save to SQLite database for history (default: false)
# USAGE_TRACKING_DB_PATH: Database file location (default: ./.mcp-usage-tracking.db)
#
# Thresholds (0 = unlimited):
# USAGE_MAX_SEARCHES_PER_MONTH: Alert when approaching search limit
# USAGE_MAX_COST_PER_MONTH: Alert when approaching cost limit (USD)
# ============================================================
#USAGE_TRACKING_ENABLED=true
#USAGE_TRACKING_PERSIST=true
#USAGE_TRACKING_DB_PATH=./.mcp-usage-tracking.db
#USAGE_MAX_SEARCHES_PER_MONTH=1000
#USAGE_MAX_COST_PER_MONTH=10.00
# ============================================================
# OPTIONAL CONFIGURATION
# ============================================================
# Transport mode (stdio or http)
# Use stdio for Claude Code/Desktop/Cline (default)
# Use http for testing or custom integrations
#MCP_TRANSPORT=stdio
# Port for HTTP mode (only used when MCP_TRANSPORT=http)
#PORT=3000
# ============================================================
# DIRECT API MODE (Advanced Users Only)
# ============================================================
# By default, the server uses Agent Mode which leverages your
# existing Claude session - NO additional API key required.
#
# Only enable Direct API mode if you:
# - Are running automated scripts without Claude
# - Need synthesis in non-interactive workflows
#
# To enable:
# 1. Get Anthropic API key: https://console.anthropic.com/
# 2. Uncomment the lines below
# 3. Rebuild: npm run build
#
#ANTHROPIC_API_KEY=your_anthropic_api_key_here
#USE_DIRECT_API=true
# ============================================================
# TROUBLESHOOTING
# ============================================================
# Error: "403 Forbidden" or "Access Denied"
# -> Check API key is correct
# -> Verify Custom Search API is enabled in Google Cloud Console
# -> You may have hit the 100/day limit (enable billing or wait)
#
# Error: "429 Too Many Requests"
# -> You exceeded 100 queries today
# -> Wait until midnight UTC or enable billing
#
# Error: "API not enabled"
# -> Go to: https://console.cloud.google.com/apis/library/customsearch.googleapis.com
# -> Click "Enable"
# -> Wait 2-3 minutes
#
# Still stuck? See ALTERNATIVES.md for other search APIs
# ============================================================