If validation identifies issues with the upgrade, you can restore your previous working deployment using one of these rollback methods.

Image-only rollback

Follow these steps to restore the previous Docker image while keeping the existing profile configuration unchanged:
  1. Stop the running profile:
    Set-Location $env:OEMCP_HOME
    .\mcpgen.ps1 stop $Profile
  2. Reload the previous image:
    # Reload previous version image
    & 'C:\path\to\previous-distribution\load_images.ps1'
  3. Restart the profile:
    .\mcpgen.ps1 start $Profile

Complete profile rollback

Follow these steps to restore the profile directory from backup and return the deployment to its previous working state:
  1. Stop the running profile:
    Set-Location $env:OEMCP_HOME
    .\mcpgen.ps1 stop $Profile
  2. Move the current generated profile aside for analysis:
    # Preserve upgraded profile
    Move-Item "generated\$Profile" "generated\$Profile.post-upgrade"
  3. Restore and restart the profile:
    # Restore from backup
    Expand-Archive -LiteralPath "..\$Profile-backup-<timestamp>.zip" `
      -DestinationPath . -Force
    
    .\mcpgen.ps1 start $Profile
  4. Restore the previous mcpgen wheel files:
    # Restore wheel files from the previous distribution
    Copy-Item 'C:\path\to\previous-distribution\wheels\mcpgen-*.whl' `
        "$env:OEMCP_HOME\wheels\" -Force
    Note: If you removed the previous distribution, you can restore the mcpgen tooling by reinstalling from the archived distribution zip file.

Production bundle rollback

Follow these steps to restore production export artifacts and, when needed, the previous container image:
  1. Stop the production container:
    Set-Location 'exports\export_<profile>_<timestamp>'
    .\run.ps1 stop -Port <port> -Name <container-name>
  2. Restore the compose file:
    # Restore previous compose file
    Copy-Item 'docker-compose.mcp.yml.backup' 'docker-compose.mcp.yml'
  3. Reload previous image (if using latest):
    # If using :latest, reload previous image
    & 'C:\path\to\previous-distribution\load_images.ps1'
  4. Restart the production container:
    .\run.ps1 start -Port <port> -Name <container-name>