fix(mcp): pass onprogress so resetTimeoutOnProgress actually works#24964
Open
fahreddinozcan wants to merge 2 commits intoanomalyco:devfrom
Open
fix(mcp): pass onprogress so resetTimeoutOnProgress actually works#24964fahreddinozcan wants to merge 2 commits intoanomalyco:devfrom
fahreddinozcan wants to merge 2 commits intoanomalyco:devfrom
Conversation
The MCP SDK only injects a progressToken into outbound _meta when options.onprogress is set (see @modelcontextprotocol/sdk Protocol.request). Without it, the server can't address progress notifications back to the in-flight request, _onprogress early-returns on "unknown token" before the timer-reset block, and resetTimeoutOnProgress: true never fires. Long-running MCP tools therefore time out at the SDK default of 60s even when the server emits progress. Adding a no-op onprogress unblocks the existing intent of the call: the SDK now sends the progressToken, the server can ping it, and the per- request timer resets on each notification.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Collaborator
|
vouch |
oleksii-honchar
pushed a commit
to oleksii-honchar/better-opencode
that referenced
this pull request
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #24965
Type of change
What does this PR do?
Hey, I'm from Context7 team. We've been having some issues with the long running requests on OpenCode, simply because OpenCode does not comply to the MCP spec for notifications. Basically, the client can't receive any notifications from the server right now.
The MCP SDK only injects a progressToken into outbound _meta when options.onprogress is set (see related code snippet). Without it, the server can't address progress notifications back to the in-flight request, _onprogress early-returns on "unknown token" before the timer-reset block, and resetTimeoutOnProgress: true never fires. Long-running MCP tools therefore time out at the SDK default of 60s even when the server emits progress.
Adding a no-op onprogress unblocks the existing intent of the call: the SDK now sends the progressToken, the server can ping it, and the per-request timer resets on each notification.
How did you verify your code works?
Tested against an MCP server that emits a
notifications/progressevery 20s during a tool call whose total runtime exceeds 60s.Before this change, the request the client sent contained no
_meta.progressToken, so the server had nothing to address its progress notifications to. The MCP client never received a single progress notification, the per-request timer fired at the 60s default, and the call ended inMCP error -32001: Request timed out.After this change, the request includes
_meta.progressToken, the server emits progress notifications normally, opencode receives them and resets its per-request timer on each one. The tool call completes successfully even when its total runtime is several minutes. opencode's logs show oneprogress notificationlog line per server emission throughout the call.Screenshots / recordings
N/A (no UI change).
Checklist