The Challenge of Long-Running AI Tasks
Most AI agent interactions are request-response, which fails when tasks take time to complete (e.g., waiting for human approval or external ERP validation). The Model Context Protocol (MCP) tasks specification aims to solve this by introducing durability: the ability for a task to survive client/server crashes, network disconnects, and long delays.
In V1, the protocol was stateful and relied on long-lived sessions to handle human-in-the-loop interactions. This created significant complexity for client implementers, as they had to manage connection state and handle re-synchronization manually. Furthermore, the V1 task_list endpoint lacked filtering, making it impossible to scale to large numbers of concurrent tasks.
Moving to a Stateless V2 Architecture
To address these issues, the MCP V2 specification shifts toward a stateless architecture. Key improvements include:
- Stateless Core: The protocol removes the need for long-lived sessions to manage task state.
- Direct Signaling: Instead of tunneling input requests through a session, clients can now send updates directly to a specific task endpoint. This mirrors the "signal" pattern found in robust distributed systems like Temporal.
- Extension-Based Design: Tasks are now defined as an extension of the core MCP, allowing for a cleaner separation of concerns.
- Removal of
task_list: By removing the global list endpoint, the protocol avoids the scaling bottleneck of querying millions of tasks to find a specific one.
Implementation and Future Scaling
Implementing durable tasks remains a non-trivial engineering effort. Developers must map the MCP task lifecycle (Working, Input Required, Completed, Failed) to their internal domain state machines. While V2 is significantly cleaner, the burden of persisting task IDs remains on the client.
Looking forward, the next hurdle for scaling is moving away from client-side polling. The speaker suggests that the future of MCP tasks lies in a notification-based protocol, where the server pushes updates to clients only when state changes occur, preventing the need for millions of clients to constantly poll for status updates.