# Foundry MCP Server Configuration
# =============================================================================
# Logging Configuration
# =============================================================================
LOG_LEVEL=info
LOG_FORMAT=simple
ENABLE_FILE_LOGGING=false
# LOG_FILE_PATH=./logs/mcp-server.log
# =============================================================================
# Foundry VTT Connection Settings
# =============================================================================
FOUNDRY_HOST=localhost
FOUNDRY_PORT=31415
FOUNDRY_NAMESPACE=/foundry-mcp
FOUNDRY_CONNECTION_TIMEOUT=10000
# Reconnection Settings
FOUNDRY_RECONNECT_ATTEMPTS=5
FOUNDRY_RECONNECT_DELAY=1000
# =============================================================================
# Connection Type (WebRTC vs WebSocket)
# =============================================================================
# Connection type: 'auto' (recommended), 'webrtc', or 'websocket'
# - auto: Automatically selects based on Foundry's protocol (HTTPS→WebRTC, HTTP→WebSocket)
# - webrtc: Uses WebRTC for encrypted P2P connection (works over internet, no SSL certs needed)
# - websocket: Uses traditional WebSocket (localhost only, or requires SSL setup for remote)
FOUNDRY_CONNECTION_TYPE=auto
# =============================================================================
# WebRTC Configuration (Used when connection type is 'webrtc' or 'auto' with HTTPS)
# =============================================================================
# IMPORTANT: For HTTPS Foundry instances (e.g., Forge), the MCP server MUST run on
# the same machine as your browser (not the Foundry server).
#
# How it works:
# - Signaling uses HTTP POST to localhost (allowed from HTTPS pages via browser security exception)
# - After handshake, WebRTC creates encrypted P2P data channel (no SSL certificates needed)
# - Foundry server can be on Forge cloud, MCP server runs locally on your PC
#
# STUN servers for NAT traversal (comma-separated list)
# Default: Google's free STUN servers
# FOUNDRY_STUN_SERVERS=stun:stun.l.google.com:19302,stun:stun1.l.google.com:19302
# =============================================================================
# WebSocket Configuration (Legacy - Used only when connection type is 'websocket')
# =============================================================================
# Enable remote mode for map generation file uploads
# NOTE: Auto-detected when using WebRTC (HTTPS Foundry). Only needed for remote WebSocket setups.
# When enabled, generated maps are uploaded via base64 instead of written to local filesystem
# FOUNDRY_REMOTE_MODE=false
# Protocol: 'ws' for local/insecure, 'wss' for secure WebSocket (requires SSL/TLS)
# FOUNDRY_PROTOCOL=ws
# Custom data path for generated maps (used when Foundry is on remote machine)
# Example: \\192.168.1.100\FoundryData\Data\modules\foundry-mcp-bridge\generated-maps
# FOUNDRY_DATA_PATH=
# TLS certificate validation (set to false only for development with self-signed certs)
# FOUNDRY_REJECT_UNAUTHORIZED=true
# =============================================================================
# ComfyUI Configuration
# =============================================================================
# ComfyUI always runs locally on the same machine as the MCP server (localhost:31411)
# It is automatically spawned by the MCP server when needed for AI map generation
# Port for ComfyUI HTTP API
# COMFYUI_PORT=31411
# Host for ComfyUI server (usually localhost/127.0.0.1)
# COMFYUI_HOST=127.0.0.1
# ComfyUI installation path (auto-detected on startup)
# Windows default: %LOCALAPPDATA%\FoundryMCPServer\foundry-mcp-server\ComfyUI-headless
# Mac default: ~/Library/Application Support/FoundryMCPServer/foundry-mcp-server/ComfyUI-headless
# Linux default: ~/.local/share/FoundryMCPServer/foundry-mcp-server/ComfyUI-headless
# COMFYUI_INSTALL_PATH=
# Python command for running ComfyUI (auto-detected based on platform)
# Windows default: python/python.exe (embedded Python in ComfyUI directory)
# Mac/Linux default: python3 (system Python)
# COMFYUI_PYTHON_COMMAND=
# =============================================================================
# MCP Server Settings
# =============================================================================
SERVER_NAME=foundry-mcp-server
SERVER_VERSION=1.0.0
# =============================================================================
# Development Settings
# =============================================================================
NODE_ENV=production
# Enable debug logging for development
# LOG_LEVEL=debug
# LOG_FORMAT=json
# ENABLE_FILE_LOGGING=true
# LOG_FILE_PATH=./logs/debug.log