[FEATURE] Make MCP tool call timeout configurable (MCP_TOOL_TIMEOUT)

Resolved 💬 3 comments Opened Apr 12, 2026 by Aboudjem Closed Apr 16, 2026

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)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗