HomeBlogContactSupport
Currency
Language
Context Protocol

Caching and retry guidance

Reduce latency and stay within rate limits by caching immutable data and retrying gracefully when the MCP server throttles requests.

Cache immutable responses

SKU metadata rarely changes. Cache `inventory.search` responses for 15 minutes and include `traceId` in the cache key so you can replay requests if audits arise.

  • Use per-user cache namespaces to prevent cross-tenant leakage.
  • Invalidate cache entries when `ratelimit.resetAt` is more than five minutes away.

Retry with backoff

When you receive a 429 status, inspect `ratelimit.retryAfterMs` and schedule a retry. The SDK exposes helpers in `@sourceparts/mcp-sdk/retry`.

Wrap the MCP client with a rate limiter
const throttledClient = createRateLimitedClient(client, {
  maxRequests: 30,
  intervalMs: 60_000
});
Caching Source Parts MCP responses