2.14.0
The MCP task protocol lets you request operations to run asynchronously. This returns a Task object immediately, letting you track progress, cancel operations, or await results.
See Server Background Tasks for how to enable this on the server side.
Requesting Background Execution
Passtask=True to run an operation as a background task. The call returns immediately with a Task object while the work executes on the server.
Working with Task Objects
All task types share a common interface for retrieving results, checking status, and receiving updates. To get the result, callawait task.result() or simply await task. This blocks until the task completes and returns the result. You can also check status without blocking using await task.status(), which returns the current state ("working", "completed", "failed", or "cancelled") along with any progress message from the server.
task.wait() with an optional timeout or target state:
await task.cancel().
Real-Time Status Updates
Register callbacks to receive status updates as the server reports progress. Both sync and async callbacks are supported.Graceful Degradation
You can always passtask=True regardless of whether the server supports background tasks. Per the MCP specification, servers without task support execute the operation immediately and return the result inline. The Task API provides a consistent interface either way.

