fix: pass related_request_id in Context.report_progress() - #2207
fix: pass related_request_id in Context.report_progress()#2207weiguangli-io wants to merge 1 commit into
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
|
Hi team, friendly ping — I noticed this PR has the "needs confirmation" label. Could a maintainer confirm whether this fix is needed? Happy to adjust the approach or provide more context if that helps. Thanks! |
|
Friendly ping — this fix ensures |
|
This is the same one-line change that later landed on One note for anyone reaching this from a search: the fix is not in a published release yet. 1.28.1 predates the merge and is still the latest 1.x on PyPI. Details in #2001. |
|
Thanks for the PR, and sorry it sat without a review — the identical change ( |
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