Skip to content

fix: pass related_request_id in Context.report_progress() - #2207

Closed
weiguangli-io wants to merge 1 commit into
modelcontextprotocol:v1.xfrom
weiguangli-io:codex/mcp-sdk-2001-progress-request-id
Closed

fix: pass related_request_id in Context.report_progress()#2207
weiguangli-io wants to merge 1 commit into
modelcontextprotocol:v1.xfrom
weiguangli-io:codex/mcp-sdk-2001-progress-request-id

Conversation

@weiguangli-io

Copy link
Copy Markdown

Summary

Context.report_progress() notifications were silently dropped in stateless HTTP / SSE transports because send_progress_notification() was called without the related_request_id parameter. 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_id to the send_progress_notification() call inside Context.report_progress(), making it consistent with send_log_message() which already passes the field correctly.

Changes

  • src/mcp/server/fastmcp/server.py -- add related_request_id=self.request_id to the send_progress_notification() call in Context.report_progress()
  • tests/issues/test_176_progress_token.py -- update existing assertions to expect the new related_request_id kwarg
  • tests/issues/test_2001_progress_related_request_id.py -- add regression test that verifies related_request_id is forwarded

Closes #2001

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
@maxisbey maxisbey added bug Something isn't working needs confirmation Needs confirmation that the PR is actually required or needed. labels Mar 5, 2026
@weiguangli-io

Copy link
Copy Markdown
Author

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!

@weiguangli-io

Copy link
Copy Markdown
Author

Friendly ping — this fix ensures related_request_id is correctly passed in Context.report_progress() per the MCP spec. CI is green. Would appreciate a review when you get a chance. Thanks!

@kuotunyu

Copy link
Copy Markdown

This is the same one-line change that later landed on v1.x as #2994 (commit 9678a3b3, merged 2026-06-26), which also updated tests/issues/test_176_progress_token.py to assert related_request_id. v1.x carries the fix now, so this looks superseded and can probably be closed.

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.

@maxisbey

Copy link
Copy Markdown
Contributor

Thanks for the PR, and sorry it sat without a review — the identical change (related_request_id in Context.report_progress()) went in on the v1.x line via #2994, so there's nothing left to merge here. On main progress is routed request-scoped by design. Closing this as part of a wider backlog cleanup following the v2 launch. If it's still relevant, feel free to reopen.

AI Disclaimer

@maxisbey maxisbey closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working needs confirmation Needs confirmation that the PR is actually required or needed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants