Skip to content

fetch: no retry/backoff on transient 429/5xx or network errors #4449

Closed as not planned

Description

@chirag127

Bug: fetch MCP server has no retry or backoff on transient 429/5xx errors

Problem

The fetch MCP server (src/fetch/) proxies HTTP requests on behalf of agents. When the target URL returns a transient error — 429 Too Many Requests, 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable, 504 Gateway Timeout — the server returns the error immediately to the agent with no retry.

Agents (Claude Code, Kilo Code, OpenCode) that call fetch for documentation lookups, API calls, or web scraping then receive an error result and either halt or waste a full LLM turn handling the error, when a 1-2 second retry would have succeeded.

Expected behavior

For idempotent fetches (GET, HEAD), the fetch server should retry transient errors with exponential backoff:

  • Retryable: 429, 500, 502, 503, 504, and network errors (ECONNRESET, ETIMEDOUT, ENOTFOUND with a short TTL)
  • Non-retryable: 400, 401, 403, 404, 405, 409, 410, 422
  • Default retry policy: 3 attempts, initial delay 1s, backoff factor 2x, max delay 10s
  • Configurable via env: FETCH_MAX_RETRIES, FETCH_RETRY_DELAY_MS
  • Respect Retry-After header when present on 429 responses

POST/PUT/DELETE should NOT be retried by default (not idempotent); opt-in via config.

Why

Transient errors are the norm for public APIs and documentation sites under load. A retry layer in the MCP server is more efficient than having every agent implement its own retry logic, and it keeps agent prompts clean (agents describe what they need, not how to handle HTTP transience).

Environment

  • MCP servers: @modelcontextprotocol/server-fetch (latest)
  • Runtime: Node.js v24.18.0, Windows 11 Enterprise
  • Use case: agents fetching npm docs, GitHub raw content, and public APIs through fetch MCP tool

Activity

  1. cliffhall commented on Oct 19, 2026

    @cliffhall
    Member

    Closing: out of scope for the reference servers.

    Thank you for the suggestion, and apologies for the long wait for a response.

    These servers are reference implementations: they exist to show how each part of MCP is used, not to be general-purpose products, so new features are taken selectively (CONTRIBUTING.md). Automatic HTTP retry and backoff is general client hardening rather than an MCP protocol feature, and does not fit the fetch reference server's purpose. This is not a judgment on the idea or on you; a server in the MCP Registry may well offer it, and anyone is welcome to build on these servers to do so. This is happening as part of the backlog triage in #4875.

  2. added
    closed-out-of-scopeClosed: out of scope here; listings and new servers go to the MCP Registry (#4875)
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-out-of-scopeClosed: out of scope here; listings and new servers go to the MCP Registry (#4875)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions