claude-code - 💡(How to fix) Fix [FEATURE] Make MCP tool call timeout configurable (MCP_TOOL_TIMEOUT) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47076Fetched 2026-04-13 05:42:08
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1subscribed ×1

Error Message

  1. After ~30-60s: Error: Network error: socket hang up

Fix Action

Fix / Workaround

Current Workaround

The only working workaround is using a proxy server that implements polling-based recovery when the connection drops (e.g., obinnaokechukwu/stitch-mcp for Google Stitch specifically). This shouldn't be necessary — the timeout should be configurable in Claude Code itself.

Code Example

mcp__stitch__generate_screen_from_text → socket hang up (every time, 8+ attempts)
mcp__stitch__list_projects → works fine (fast operation)
mcp__stitch__list_screens → works fine (fast operation)

---

# Example: set 10-minute timeout for tool calls
MCP_TOOL_TIMEOUT=600000 claude

---

{
  "mcpServers": {
    "stitch": {
      "command": "stitch-mcp",
      "timeout": 600000
    }
  }
}
RAW_BUFFERClick to expand / collapse

Problem

MCP tool calls that take longer than ~30-60 seconds fail with socket hang up errors. This affects any MCP server with long-running operations, most notably Google Stitch (generate_screen_from_text takes 2-10 minutes) but also any AI generation, build, or processing tool.

The MCP_TIMEOUT env var only controls startup timeout, not tool call execution timeout. There is currently no way to configure the tool call socket timeout.

Evidence

  • #22058[BUG] mcp-cli only partially respects MCP_TOOL_TIMEOUT (closed as stale, not fixed)
  • #17662MCP_TOOL_TIMEOUT not respected for long-running HTTP tool calls
  • #16837Claude code does not obey values of MCP_TIMEOUT longer than 60 seconds
  • #20335MCP Server Timeout Configuration Ignored in Streamable SSE HTTP Connections
  • #44032Claude Desktop MCP tool calls silently timeout after 4min on Windows
  • #5221[Feature Request] Make MCP tool timeouts configurable

This has been reported 6+ times across different issues and platforms. Each time it's closed as stale without a fix.

Reproduction

  1. Configure any MCP server with a tool that takes >60 seconds
  2. Call the tool from Claude Code
  3. After ~30-60s: Error: Network error: socket hang up

Specific example with Google Stitch MCP:

mcp__stitch__generate_screen_from_text → socket hang up (every time, 8+ attempts)
mcp__stitch__list_projects → works fine (fast operation)
mcp__stitch__list_screens → works fine (fast operation)

Proposed Solution

Add a configurable MCP_TOOL_TIMEOUT environment variable that controls the socket timeout for MCP tool call execution (not just startup).

# Example: set 10-minute timeout for tool calls
MCP_TOOL_TIMEOUT=600000 claude

Or per-server in settings:

{
  "mcpServers": {
    "stitch": {
      "command": "stitch-mcp",
      "timeout": 600000
    }
  }
}

Current Workaround

The only working workaround is using a proxy server that implements polling-based recovery when the connection drops (e.g., obinnaokechukwu/stitch-mcp for Google Stitch specifically). This shouldn't be necessary — the timeout should be configurable in Claude Code itself.

Impact

This blocks usage of any MCP server with long-running operations, including:

  • Google Stitch (UI generation)
  • Build/CI tools
  • AI image/video generation servers
  • Database migration tools
  • Any tool doing network-intensive work

Environment

  • Claude Code latest (April 2026)
  • macOS Darwin 25.3.0
  • Affects all transports (stdio, SSE, HTTP)

extent analysis

TL;DR

  • Implementing a configurable MCP_TOOL_TIMEOUT environment variable or per-server timeout setting can likely resolve the socket hang up errors for long-running MCP tool calls.

Guidance

  • Review the proposed solution to add a configurable MCP_TOOL_TIMEOUT environment variable to control the socket timeout for MCP tool call execution.
  • Consider implementing per-server timeout settings in the settings file, as shown in the proposed solution JSON example.
  • Evaluate the current workaround using a proxy server, such as obinnaokechukwu/stitch-mcp, for temporary relief.
  • Test the MCP_TOOL_TIMEOUT environment variable with different timeout values to determine the optimal setting for specific use cases.
  • Verify that the implemented solution or workaround resolves the socket hang up errors for long-running MCP tool calls.

Example

# Example: set 10-minute timeout for tool calls
MCP_TOOL_TIMEOUT=600000 claude

Notes

  • The lack of a configurable timeout for MCP tool calls has been reported multiple times across different issues and platforms.
  • The proposed solution aims to address this limitation by introducing a configurable MCP_TOOL_TIMEOUT environment variable.

Recommendation

  • Apply the proposed solution to implement a configurable MCP_TOOL_TIMEOUT environment variable or per-server timeout setting, as it directly addresses the root cause of the issue and provides a flexible solution for different use cases.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [FEATURE] Make MCP tool call timeout configurable (MCP_TOOL_TIMEOUT) [1 comments, 2 participants]