modelcontextprotocol / modelcontextprotocol/servers
fetch: hardcoded 30s timeout with no CLI/env/per-request override
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:
- Too short for large file downloads (GitHub raw content > 10MB, PDF documentation sites, slow API endpoints)
- Too long for health checks and fast lookups where a 5s timeout would surface problems faster
- 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):
- Per-request: include
timeout_msin the tool call arguments{ "url": "https://example.com/large-file.pdf", "timeout_ms": 120000 } - Environment variable for server-wide default:
FETCH_TIMEOUT_MS=60000 - CLI flag:
--timeout 60000when 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
fetchMCP tool
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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