fix: pass related_request_id in Context.report_progress()#2207
Open
OiPunk wants to merge 1 commit intomodelcontextprotocol:v1.xfrom
Open
fix: pass related_request_id in Context.report_progress()#2207OiPunk wants to merge 1 commit intomodelcontextprotocol:v1.xfrom
OiPunk wants to merge 1 commit intomodelcontextprotocol:v1.xfrom
Conversation
Progress notifications sent via Context.report_progress() were silently dropped in stateless HTTP / SSE transports because the call to send_progress_notification() was missing the related_request_id parameter. The SSE transport relies on this field to route notifications back to the correct client stream. Add related_request_id=self.request_id to the send_progress_notification() call, consistent with how send_log_message() already passes it. Reported-by: hubbard-zlee Github-Issue: modelcontextprotocol#2001
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.
Summary
Context.report_progress()notifications were silently dropped in stateless HTTP / SSE transports becausesend_progress_notification()was called without therelated_request_idparameter. The transport layer uses this field to route server-initiated notifications back to the correct client SSE stream; without it, progress notifications are discarded.This adds
related_request_id=self.request_idto thesend_progress_notification()call insideContext.report_progress(), making it consistent withsend_log_message()which already passes the field correctly.Changes
src/mcp/server/fastmcp/server.py-- addrelated_request_id=self.request_idto thesend_progress_notification()call inContext.report_progress()tests/issues/test_176_progress_token.py-- update existing assertions to expect the newrelated_request_idkwargtests/issues/test_2001_progress_related_request_id.py-- add regression test that verifiesrelated_request_idis forwardedCloses #2001