You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: support progress_callback propagation in ClientSession #1248
When creating a fastmcp.Client with a specified progress_handler, that handler is automatically injected into all tool calls made via client.call_tool(...). This enables consistent progress reporting at the high level.
However, if a downstream library (such as LangChain’s MCP adapter) accesses the underlying mcp.client.session.ClientSession from the Client instance, and makes direct calls using call_tool(..., progress_callback=...), the top-level progress_handler is not inherited. As a result, progress reporting is silently lost in these scenarios.
For example:
fromfastmcpimportClientfromlangchain_mcp_adapters.toolsimportload_mcp_toolsclient=Client(transport=mcp_url, progress_handler=progress_handler)
asyncwithclient:
tools=awaitload_mcp_tools(client.session)
# The tools loaded here are called via `client.session.call_tool(...)` without our top-level handler.
This leads to inconsistent developer experience and makes debugging or tracking progress difficult when third-party libraries use the lower-level session.
Proposed Solution
Enhance ClientSession to accept a default progress_handler in its constructor. This handler should be applied automatically for all call_tool(...) invocations unless explicitly overridden.
Proposed behaviour:
This change would:
Ensure consistent progress reporting across both high-level and low-level usage.
Allow third-party integrations (like LangChain) to benefit from centralized handler management without needing to manually propagate it.
Maintain backward compatibility for existing code that does not use or override progress callbacks.
This enhancement will significantly improve interoperability and user experience when integrating with libraries that interact directly with ClientSession.
Activity
feat: support progress_callback propagation in ClientSession (issue m…
felixweinberger commentedon Sep 30, 2025
Closing this for now with reasoning provided in the attached PR: #1249
Feel free to reopen if you disagree or if this turns out to be a major blocker for your use case.