feat: implement MCP progress notifications in MCPClient#2290
Draft
joshwand wants to merge 3 commits into
Draft
Conversation
- Add `progress_callback: ProgressFnT | None` parameter to `MCPClient.__init__` - Thread callback through `call_tool_sync`, `call_tool_async`, and `_create_call_tool_coroutine` to `ClientSession.call_tool()` - Support per-call override: per-call callback takes precedence over instance callback - Export `ProgressFnT` from `strands.tools.mcp` package - Update existing tests to include `progress_callback` in call assertions - Add new tests for instance-level callback, per-call override, and default None behavior Agent-Logs-Url: https://github.com/joshwand/strands-sdk-python/sessions/7ab253b3-c748-48ed-9a8a-ae5c8508e938 Co-authored-by: joshwand <22531+joshwand@users.noreply.github.com>
Agent-Logs-Url: https://github.com/joshwand/strands-sdk-python/sessions/7ab253b3-c748-48ed-9a8a-ae5c8508e938 Co-authored-by: joshwand <22531+joshwand@users.noreply.github.com>
gautamsirdeshmukh
requested changes
May 29, 2026
| - Docs: https://www.anthropic.com/news/model-context-protocol | ||
| """ | ||
|
|
||
| from mcp.shared.session import ProgressFnT |
Contributor
There was a problem hiding this comment.
Let's remove this, we shouldn't re-export MCP SDK types from here. It also looks like mcp_client.py already imports this directly from MCP SDK (which is ideal) so no need for this anyway
|
|
||
| if use_task: | ||
| self._log_debug_with_thread("tool=<%s> | using task-augmented execution", name) | ||
|
|
Contributor
There was a problem hiding this comment.
Might be helpful to log a warning that progress callbacks are dropped for task-augmented execution
Something like:
if use_task:
...
if effective_callback is not None:
logger.warning("some message indicating the callout above")
Contributor
|
Thanks for taking this up! Just 2 small callouts, looks like you'll need to rebase as well, then this should be good to go! |
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.
Description
Adds basic support for MCP-Progress notifications in Strands MCPClient.
Related Issues
#1812
Documentation PR
Type of Change
New feature
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.