version: '3.8'

# MCP ABAP ADT Server - Header-based authentication only
# Uses v2 server with proper destination header handling
#
# This configuration expects all authentication parameters to be passed
# via HTTP headers in each request. No service keys or sessions needed.
#
# Required headers for each request:
# - x-mcp-destination: Destination name (requires --allow-destination-header flag)
# OR
# - x-sap-url: SAP system URL
# - x-sap-auth-type: jwt, basic, or xsuaa
# - x-sap-jwt-token: JWT token (for jwt auth)
# - x-sap-refresh-token: Refresh token (optional, for auto-refresh)
# OR
# - x-sap-login: Username (for basic auth)
# - x-sap-password: Password (for basic auth)
#
# Usage: docker-compose -f docker-compose.headerless.yml up -d

services:
  mcp-abap-adt:
    build:
      context: ..
      dockerfile: docker/Dockerfile
    image: mcp-abap-adt:headerless
    container_name: mcp-abap-adt-headerless
    restart: unless-stopped

    # HTTP transport for client connections
    ports:
      - "3000:3000"

    # Minimal environment - no auth-broker needed
    environment:
      - NODE_ENV=production
      - MCP_HTTP_PORT=3000
      - MCP_HTTP_HOST=0.0.0.0

    # No volumes needed - all auth via headers

    # Resource limits
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 512M
        reservations:
          cpus: '0.25'
          memory: 256M

    # Healthcheck
    healthcheck:
      test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s

    # Logging
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
