# =============================================================================
# Dolibarr MCP Server - Development Docker Compose
# Version 2.1.0
# =============================================================================
# Builds image locally from Dockerfile
# For production with pre-built images, use docker-compose.prod.yml
# =============================================================================
services:
# =============================================================================
# DragonflyDB Cache - High-performance Redis-compatible cache
# =============================================================================
dragonfly:
image: docker.dragonflydb.io/dragonflydb/dragonfly:latest
container_name: dolibarr-mcp-cache
restart: unless-stopped
ports:
- "${DRAGONFLY_PORT:-6379}:6379"
volumes:
- dragonfly-data:/data
command: >
--maxmemory=256mb
--proactor_threads=2
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
deploy:
resources:
limits:
cpus: '0.5'
memory: 300M
reservations:
cpus: '0.1'
memory: 64M
networks:
- dolibarr-mcp-network
# =============================================================================
# Dolibarr MCP Server - Main service with TOON format and cache support
# =============================================================================
dolibarr-mcp:
build:
context: ..
dockerfile: docker/Dockerfile
image: dolibarr-mcp:2.1.0
container_name: dolibarr-mcp-server
restart: unless-stopped
depends_on:
dragonfly:
condition: service_healthy
environment:
# Dolibarr API Configuration
- DOLIBARR_URL=${DOLIBARR_URL:-https://your-dolibarr-instance.com/api/index.php}
- DOLIBARR_API_KEY=${DOLIBARR_API_KEY:-your_api_key_here}
# Cache Configuration (DragonflyDB)
- CACHE_ENABLED=${CACHE_ENABLED:-true}
- DRAGONFLY_HOST=dragonfly
- DRAGONFLY_PORT=6379
- DRAGONFLY_PASSWORD=${DRAGONFLY_PASSWORD:-}
# Output Format Configuration
- OUTPUT_FORMAT=${OUTPUT_FORMAT:-toon}
# Logging Configuration
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- PYTHONUNBUFFERED=1
# MCP Server Configuration
- MCP_TRANSPORT=${MCP_TRANSPORT:-http}
- MCP_HTTP_PORT=${MCP_HTTP_PORT:-8080}
- MCP_HTTP_HOST=${MCP_HTTP_HOST:-0.0.0.0}
- MCP_SERVER_NAME=dolibarr-mcp
- MCP_SERVER_VERSION=2.1.0
# MCP Authentication (API Key)
- MCP_AUTH_ENABLED=${MCP_AUTH_ENABLED:-true}
- MCP_API_KEY=${MCP_API_KEY:-}
- MCP_API_KEYS=${MCP_API_KEYS:-}
volumes:
# Mount configuration if needed
- ../.env:/app/.env:ro
# Optional: Mount for custom configurations or plugins
# - ./config:/app/config:ro
# - ./plugins:/app/plugins:ro
# Expose port for HTTP interface
ports:
- "${MCP_EXTERNAL_PORT:-18004}:8080"
# Health check via HTTP endpoint (no auth required)
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
# Resource limits
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
# Logging
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
- dolibarr-mcp-network
# =============================================================================
# Test Service - For running integration tests
# =============================================================================
dolibarr-mcp-test:
build:
context: ..
dockerfile: docker/Dockerfile
image: dolibarr-mcp:2.1.0
container_name: dolibarr-mcp-test
depends_on:
dragonfly:
condition: service_healthy
environment:
- DOLIBARR_URL=${DOLIBARR_URL}
- DOLIBARR_API_KEY=${DOLIBARR_API_KEY}
- CACHE_ENABLED=true
- DRAGONFLY_HOST=dragonfly
- DRAGONFLY_PORT=6379
- OUTPUT_FORMAT=toon
- LOG_LEVEL=DEBUG
- MCP_AUTH_ENABLED=false
volumes:
- ../.env:/app/.env:ro
command: python -m pytest /app/tests -v --tb=short
profiles:
- test
networks:
- dolibarr-mcp-network
# =============================================================================
# Redis Commander - Optional web UI for cache monitoring
# =============================================================================
redis-commander:
image: rediscommander/redis-commander:latest
container_name: dolibarr-mcp-cache-ui
restart: unless-stopped
depends_on:
- dragonfly
environment:
- REDIS_HOSTS=local:dragonfly:6379
ports:
- "${REDIS_COMMANDER_PORT:-8081}:8081"
profiles:
- monitoring
networks:
- dolibarr-mcp-network
# =============================================================================
# Volumes
# =============================================================================
volumes:
dragonfly-data:
name: dolibarr-mcp-cache-data
# =============================================================================
# Networks
# =============================================================================
networks:
dolibarr-mcp-network:
driver: bridge
name: dolibarr-mcp-net
# =============================================================================
# Usage:
# =============================================================================
# Start all services (MCP + Cache):
# docker-compose up -d
#
# Start with cache monitoring UI:
# docker-compose --profile monitoring up -d
#
# Run tests:
# docker-compose --profile test up dolibarr-mcp-test
#
# View logs:
# docker-compose logs -f dolibarr-mcp
#
# Check cache stats:
# docker exec dolibarr-mcp-cache redis-cli INFO stats
#
# Stop all:
# docker-compose down
#
# Stop and remove volumes:
# docker-compose down -v
# =============================================================================