Skip to main content
New in version 2.3.5 Use this when you need to track progress of long-running operations. MCP servers can report progress during operations. The client receives these updates through a progress handler.

Progress Handler

Set a handler when creating the client:
from fastmcp import Client

async def progress_handler(
    progress: float,
    total: float | None,
    message: str | None
) -> None:
    if total is not None:
        percentage = (progress / total) * 100
        print(f"Progress: {percentage:.1f}% - {message or ''}")
    else:
        print(f"Progress: {progress} - {message or ''}")

client = Client(
    "my_mcp_server.py",
    progress_handler=progress_handler
)
The handler receives three parameters:

Handler Parameters

progress
float
Current progress value
total
float | None
Expected total value (may be None if unknown)
message
str | None
Optional status message

Per-Call Handler

Override the client-level handler for specific tool calls:
async with client:
    result = await client.call_tool(
        "long_running_task",
        {"param": "value"},
        progress_handler=my_progress_handler
    )
\n\n\n
\n \n\n","contacts":" \n\n\n Prefab\n \n \n \n \n\n\n
\n \n\n","dashboard":" \n\n\n Prefab\n \n \n \n \n\n\n
\n \n\n","data-table":" \n\n\n Prefab\n \n \n \n \n\n\n
\n \n\n","hitchhikers":" \n\n\n Prefab Showcase\n \n \n \n \n\n\n
\n \n\n","pie-chart":" \n\n\n Prefab\n \n \n \n \n\n\n
\n \n\n","reactive":" \n\n\n Prefab\n \n \n \n \n\n\n
\n \n\n","team-directory-reactive":" \n\n\n Prefab\n \n \n \n \n\n\n
\n \n\n","team-directory":" \n\n\n Prefab\n \n \n \n \n\n\n
\n \n\n"};