modelcontextprotocol / modelcontextprotocol/servers

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

Open
#4,448 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the fetch MCP server's timeout handling and the entry points for tool-call arguments, environment configuration, and CLI parsing. Trace how the current 30-second default is applied, then verify that per-request, environment, and CLI values follow the stated precedence while retaining the default when unset.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.