Repository navigation
v0.3.2: Retry with Exponential Backoff
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, isRetryableErrorsrc/tools/container.ts— wrapped listContainers, inspect, start, stop, restart, removesrc/tools/image.ts— wrapped listImagessrc/tools/health.ts— wrapped container inspectsrc/tools/network.ts— wrapped listNetworkssrc/tools/volume.ts— wrapped createVolumesrc/tools/logs.ts— wrapped container logstests/retry.test.ts— 10 new tests
Test Results
62/62 tests passing (52 original + 10 new retry tests)