Skip to content

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions