# UniFi MCP Server - Docker Compose Configuration
#
# Usage:
# cp .env.example .env # Create and configure your .env file
# docker-compose up -d # Start the server
# docker-compose logs -f # View logs
# docker-compose down # Stop the server
services:
unifi-mcp-server:
build:
context: .
dockerfile: Dockerfile
container_name: unifi-mcp-server
restart: unless-stopped
# Environment variables from .env file
environment:
- NODE_ENV=production
- PORT=${PORT:-3000}
- BASE_URL=${BASE_URL:-http://localhost:3000}
# Cloudflare Access for SaaS (OAuth)
- CF_ACCESS_TEAM=${CF_ACCESS_TEAM}
- CF_CLIENT_ID=${CF_CLIENT_ID}
- CF_CLIENT_SECRET=${CF_CLIENT_SECRET}
# UniFi Controller (API Key auth)
- UNIFI_HOST=${UNIFI_HOST}
- UNIFI_PORT=${UNIFI_PORT:-443}
- UNIFI_API_KEY=${UNIFI_API_KEY}
- UNIFI_SITE=${UNIFI_SITE:-default}
- NODE_TLS_REJECT_UNAUTHORIZED=0
# Expose port to host
# Your Cloudflare tunnel will connect to this port
ports:
- "${PORT:-3000}:3000"
# Health check
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
# Resource limits (optional, adjust as needed)
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.1'
memory: 64M
# Logging configuration
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"