Skip to content

v0.3.2: Retry with Exponential Backoff

Choose a tag to compare

@friendlygeorge friendlygeorge released this 13 Jun 19:24
· 35 commits to main since this release

What Changed

Retry with Exponential Backoff

  • withRetry wrapper — all Docker API calls now retry on transient errors (ECONNRESET, ETIMEDOUT, socket hang up, 5xx)
  • Smart error classification — 4xx errors (not found, permission denied) are NOT retried; connection timeouts ARE retried
  • Exponential backoff — 1s -> 2s -> 4s, max 3 retries, with stderr logging for debugging
  • 10 new tests — dedicated retry test suite covering transient errors, permanent errors, and retry exhaustion

Why This Matters

Production MCP servers face transient Docker API failures (daemon busy, network blips, socket resets). Without retry, a single transient error kills the entire tool call. With retry, the server self-heals on 3/4 of common failure modes.

Files Changed

  • src/docker.ts — added withRetry, isRetryableError
  • src/tools/container.ts — wrapped listContainers, inspect, start, stop, restart, remove
  • src/tools/image.ts — wrapped listImages
  • src/tools/health.ts — wrapped container inspect
  • src/tools/network.ts — wrapped listNetworks
  • src/tools/volume.ts — wrapped createVolume
  • src/tools/logs.ts — wrapped container logs
  • tests/retry.test.ts — 10 new tests

Test Results

62/62 tests passing (52 original + 10 new retry tests)