Skip to content

fetch: hardcoded 30s timeout with no CLI/env/per-request override #4448

Closed

Description

@chirag127

Bug: fetch MCP server has hardcoded 30s timeout with no CLI/env/per-request override

Problem

The fetch MCP server has a hardcoded 30-second request timeout. This is:

  1. Too short for large file downloads (GitHub raw content > 10MB, PDF documentation sites, slow API endpoints)
  2. Too long for health checks and fast lookups where a 5s timeout would surface problems faster
  3. Not overridable — there is no CLI flag, environment variable, or per-request option to change the timeout

Agents that use fetch for slow operations (downloading a large WASM binary for inspection, fetching a paginated API with slow backend) hit the 30s wall and get a timeout error with no way to extend it for that specific call.

Expected behavior

Make the timeout configurable at three levels (most-specific wins):

  1. Per-request: include timeout_ms in the tool call arguments
    { "url": "https://example.com/large-file.pdf", "timeout_ms": 120000 }
  2. Environment variable for server-wide default: FETCH_TIMEOUT_MS=60000
  3. CLI flag: --timeout 60000 when starting the server

The current 30s hardcoded value becomes the default if none of the above are set.

Why

Different use cases need different timeouts. Documentation lookups: 5-10s. File downloads: 60-300s. Streaming responses: potentially unlimited with streaming support. Hardcoding one value for all cases means either slow failures on legitimate long operations or slow detection of actually-down endpoints.

Environment

  • MCP servers: @modelcontextprotocol/server-fetch (latest)
  • Runtime: Node.js v24.18.0, Windows 11 Enterprise
  • Hit when: fetching large GitHub raw files and slow public API endpoints via fetch MCP tool

Activity

  1. magai2002 commented on Aug 25, 2026

    @magai2002
  2. added
    enhancementNew feature or request
    server-fetchReference implementation for the Fetch MCP server - src/fetch
    on Oct 19, 2026
  3. cliffhall commented on Oct 19, 2026

    @cliffhall
    Member

    Triage: Priority Low (total 4)

    • Severity 2: The fetch request timeout is still hard-coded at 30 seconds; making it configurable is a reasonable usability improvement.
    • Urgency 2: wanted eventually
    • Bonuses: none

    Board: Servers V2 (#43), Status Incoming, awaiting maintainer review (no milestone yet). Part of the backlog triage in #4875.

  4. cliffhall commented on Oct 20, 2026

    @cliffhall
    Member

    Prior work, from the PR backlog triage (#4877). These outside pull requests addressed this issue against the pre-refactor code:

    They are being closed as part of the backlog triage in #4875, since the repository now takes issues rather than outside PRs and their diffs predate the v2 refactor. They stay readable and serve as prototypes for the fix here. Thank you to their authors.

  5. added this to the v2.3.0 milestone on Oct 25, 2026
  6. self-assigned this
    on Oct 28, 2026
  7. cliffhall commented on Oct 29, 2026

    @cliffhall
    Member

    Shipped in #5372 (merged into v2/main), after the #5271 rollup proved the six fetch v2.3.0 PRs combine with no conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestserver-fetchReference implementation for the Fetch MCP server - src/fetchv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions