claude-code - 💡(How to fix) Fix [BUG] Routines struggle with MCP tools: excessive API calls, token waste, and stream timeout errors [1 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#54596Fetched 2026-04-30 06:41:19
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×5cross-referenced ×1

Error Message

API Error: Stream idle timeout - partial response received

Code Example

API Error: Stream idle timeout - partial response received
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When using Claude Code routines that involve MCP servers (tested with Notion and Webflow), Claude Code fails to complete tasks efficiently. It makes multiple redundant API calls, fails to retrieve the expected data, wastes a large number of tokens, and ultimately hits: API Error: Stream idle timeout - partial response received error — leaving the task incomplete.

In contrast, the same prompt executed directly in Claude.ai (with the same MCP connections) completes the task in under 1 minute with only 2–3 tool calls.

What Should Happen?

Claude Code should handle MCP tool calls within routines with the same efficiency as Claude.ai, resolving the task in a minimal number of calls without timeout errors.

Error Messages/Logs

API Error: Stream idle timeout - partial response received

Steps to Reproduce

  1. Connect any MCP servers in Claude Code (mine were Notion, Webflow)
  2. Create a routine that involves reading/writing data via these MCPs (e.g. fetch a Notion page, create a Webflow CMS item)
  3. Run the routine manually via Claude Code
  4. Observe: multiple failed or redundant MCP calls, high token usage, and eventual stream idle timeout error
  5. Run the exact same prompt in Claude.ai with the same MCP connections → task completes successfully in <1 min

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.1.114

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

<img width="918" height="532" alt="Image" src="https://github.com/user-attachments/assets/7cdca292-8462-4ece-a9aa-41fbb9f0b49b" />

extent analysis

TL;DR

The issue can be mitigated by optimizing the routine to reduce redundant API calls and token usage, potentially by implementing a more efficient data retrieval strategy.

Guidance

  • Review the routine's logic to identify opportunities for reducing the number of MCP calls, such as batching requests or using more efficient APIs.
  • Investigate the Claude Code configuration to ensure that it is properly set up to handle stream idle timeouts, and consider adjusting the timeout settings if necessary.
  • Compare the API call patterns and parameters used by Claude Code with those used by Claude.ai to identify potential differences that could be contributing to the inefficiency.
  • Consider adding logging or debugging statements to the routine to gain more insight into the API call sequence and response handling.

Example

No specific code example can be provided without more information about the routine's implementation, but a general approach might involve using a loop to batch API requests and handle responses more efficiently.

Notes

The root cause of the issue is unclear, but it appears to be related to the interaction between Claude Code and the MCP servers. Further investigation is needed to determine the exact cause and develop a comprehensive solution.

Recommendation

Apply a workaround by optimizing the routine and adjusting the configuration settings, as the issue does not appear to be related to a specific version of Claude Code.

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 [BUG] Routines struggle with MCP tools: excessive API calls, token waste, and stream timeout errors [1 participants]