outlook-mcp/utils
setonc 4d8ea1b3a7 feat(outlook-mcp): harden Graph client with retry/backoff on 429 and 503
The Graph client previously failed the call on the first 429/503. The
request loop now retries these transient statuses before giving up.

Behavior:
- 429 and 503 are retried up to OUTLOOK_MAX_RETRIES times.
- Retry-After header is honored when Graph sends it, clamped to
  MAX_RETRY_DELAY_MS.
- Otherwise exponential backoff with full jitter, same clamp.
- 401 still throws UNAUTHORIZED immediately (no retry, no point).
- Other 4xx (400/403/404, etc.) are NOT retried -- these are caller
  errors, retrying just burns the rate-limit budget.

New config knobs, all env-overridable:
- OUTLOOK_MAX_RETRIES         (default 3)
- OUTLOOK_BASE_RETRY_DELAY_MS (default 1000)
- OUTLOOK_MAX_RETRY_DELAY_MS  (default 30000)

Implementation:
- Refactored the request into makeSingleRequest + optionsForRequest
  helpers so the retry loop sits above them without duplicating the
  response parsing.
- Empty-body success (202/204, e.g. sendMail, DELETE) is preserved.
- sleep and getRetryDelay are exported for the test.

Tests:
- tests/backoff.test.js: spins up a local HTTPS server, asserts
  getRetryDelay honors Retry-After and clamps to MAX_RETRY_DELAY_MS,
  and that callGraphAPI retries on 429 and fails after maxAttempts.
2026-07-31 09:12:14 -04:00
..
bodyParser.js fix(outlook-mcp): P0 audit follow-up - folder hierarchy, recursive rule folder names, timezone date filters, search fallback, thread/read body parsing 2026-06-21 22:02:24 -04:00
graph-api.js feat(outlook-mcp): harden Graph client with retry/backoff on 429 and 503 2026-07-31 09:12:14 -04:00
mock-data.js Initial commit: Outlook MCP Server v1.0.0 2026-06-21 19:39:31 -04:00
odata-helpers.js fix(outlook-mcp): P0 audit follow-up - folder hierarchy, recursive rule folder names, timezone date filters, search fallback, thread/read body parsing 2026-06-21 22:02:24 -04:00
threadBuilder.js fix(outlook-mcp): P0 audit follow-up - folder hierarchy, recursive rule folder names, timezone date filters, search fallback, thread/read body parsing 2026-06-21 22:02:24 -04:00
time-formatter.js fix(outlook-mcp): calendar list uses configured timezone and merge duplicate select fields 2026-06-21 20:53:30 -04:00
timezone-mapper.js fix(outlook-mcp): P0 audit follow-up - folder hierarchy, recursive rule folder names, timezone date filters, search fallback, thread/read body parsing 2026-06-21 22:02:24 -04:00