IT

MCP Tasks architecture limits and running long tasks in production

How to run long tasks in production using MCP Tasks. Practical analysis of the July 2026 specification limits across 5 programming languages.

·2 min read
MCP Tasks architecture limits and running long tasks in production

This article explores practical approaches to deploying the Model Context Protocol (MCP) in production with a focus on executing long-running tasks. Instead of relying on theory, the author conducted hands-on tests by sending 13 test requests to a server built on the new specification, running 45 latency measurements, crashing the process six times mid-task, and setting up client-server integrations across five programming languages. The result is a pragmatic hybrid architecture that runs smoothly for clients today, prevents task loss during failures, and aligns with future native Tasks without requiring architectural redesigns.

Key highlights of the test suite: - Running 13 requests and latency benchmarks on a TypeScript server. - Testing client-server pairs across Go, C#, Rust, Java, and Python. - Analyzing stateless constraints, routing headers, and security implications.

Stateless architecture and the July 2026 specification revision The primary architectural shift in the revision is that the protocol has become fully stateless. The mandatory initialization step and Mcp-Session-Id sessions are gone. Every request transmits its protocol version and client capabilities via the _meta field, allowing any server behind a load balancer to handle requests without sticky sessions. However, this introduces a strict constraint for long operations: since the server retains no connection memory, operation states and access rights must reside in external storage. Additionally, the HTTP transport now duplicates tool names and methods in the Mcp-Method and Mcp-Name headers, enabling gateways to route traffic efficiently. If the header and body do not match, the server must reject the request with error code -32020, ensuring route integrity.

Tasks extension mechanics and security considerations The new specification differs radically from the experimental Tasks from November 2025. Background execution is now initiated by the server under the condition that the client has declared the io.modelcontextprotocol/tasks extension in _meta. The tasks/list method has been completely removed, and blocking calls are replaced by retrieving results directly inside tasks/get requests based on the server-provided pollIntervalMs interval. Because tasks/list no longer exists, the taskId itself acts as an access token to the result. It must be cryptographically unpredictable (such as 128 bits of entropy) with ownership verified on every request. For unknown or expired task IDs, the server must return identical error codes to prevent unauthorized enumeration of active tasks.

Production implications for developers and enterprise solutions Practical benchmarks revealed a mixed state of ecosystem readiness. While C# and Rust successfully implemented the extension and completed polling flows, mainstream stacks like TypeScript and Python lack a ready-to-use runtime environment for the new Tasks specification. Engineers dealing with batch document processing or repository scanning must build robust hybrid routing frameworks and external state stores to handle long background processes reliably in production environments without data loss.

Source: Все публикации подряд на Хабре

Related articles