modelcontextprotocol / modelcontextprotocol/typescript-sdk

Add MCP_TOOL_TIMEOUT_MSEC default value only for tool calls.

Open
#1,863 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs decision P3
Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I've submitted a PR for updating the request timeout, and reviewed it a bit, so we can set the default request timeout for all requests. Now, I'd like to pull out the function for retrieving the ENV into a helper function and reuse it for only client tool calls.

Here's the PR I want to build on:

https://github.com/modelcontextprotocol/typescript-sdk/pull/1854

Describe the solution you'd like
A clear and concise description of what you want to happen.

Add an env for default tool call milliseconds in client.ts.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Only having it for all requests.

Additional context
Add any other context or screenshots about the feature request here.

Here is how I envision the precedence:

All requests have a 60-second default timeout. The timeout for a given request is resolved in the following order of precedence (highest first):
Per-request timeout option — passed directly in the request options.
MCP_TOOL_TIMEOUT_MSEC — environment variable that applies only to tools/call requests.
MCP_REQUEST_TIMEOUT_MSEC — environment variable that applies to all requests.
60,000 ms — hardcoded fallback.

By the way, I was also thinking about defaulting to MCP_TOOL_TIMEOUT - to align with claude, which uses typescript SDK? However, this seems less idiomatic because this code base seems to append MSEC.

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 in client.ts and review PR #1854 to understand the existing request-timeout environment lookup. Trace how tools/call requests resolve their timeout, then verify that the documented precedence is applied and that other request types retain the general timeout behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
66/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.