MCP_TIMEOUT env var is ineffective — inner @modelcontextprotocol/sdk requestTimeout (60s) overrides it
Resolved 💬 3 comments Opened Apr 3, 2026 by ozimakov-st Closed Apr 3, 2026
Summary
MCP_TIMEOUT env var does not actually control the MCP server connection timeout. The MCP Client from @modelcontextprotocol/sdk is instantiated without passing requestTimeout, so it defaults to 60 seconds. This inner timeout fires before the outer MCP_TIMEOUT wrapper, making the env var completely ineffective.
Reproduction
- Configure an MCP server that takes >60s to respond to
initialize(e.g.,korotovsky/slack-mcp-serveron a large Slack workspace — it caches users and channels before responding) - Set
MCP_TIMEOUT=300000(5 min) or evenMCP_TIMEOUT=1800000(30 min) - Run Claude Code with
--mcp-configpointing to that server - Observe: the server is marked as failed after ~60s regardless of
MCP_TIMEOUT
Root Cause
In the CLI source (cli.js v2.1.91), the MCP Client is created as:
new Client({
name: "claude-code",
version: "...",
...
}, { capabilities: {} }); // ← no requestTimeout
The @modelcontextprotocol/sdk Client defaults requestTimeout to 60000ms. The outer timeout wrapper using MCP_TIMEOUT is correct but never fires because the inner SDK timeout rejects the connect() promise first.
Expected Behavior
MCP_TIMEOUT should be passed as requestTimeout to the MCP Client constructor:
new Client({...}, {
capabilities: {},
timeout: parseInt(process.env.MCP_TIMEOUT || "", 10) || 30000
});
Environment
- Claude Code version: 2.1.91
@anthropic-ai/claude-agent-sdk: ^0.2.77- Running via
gor-st/claude-code-actionin GitHub Actions - MCP server:
korotovsky/slack-mcp-serverv1.2.3 (stdio transport) - Slack workspace: ~12.8k users, ~43k channels (caching takes 3-5 min)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗