MCP Tasks: 8 Parts for Long-Running Agent Jobs

Table of Contents

MCP Tasks are an extension to the Model Context Protocol that lets a server answer a tool call with a durable task handle rather than a finished result. The agent can disconnect, reconnect, poll that identifier for status, answer a request for input mid-flight, cancel the work, and read the final result once the job completes.

1. The MCP Tasks extension: a durable handle instead of a blocked call

MCP Tasks extension documentation on modelcontextprotocol.io

The Tasks extension, published as io.modelcontextprotocol/tasks, changes what a tools/call may return. Instead of a result, the server can hand back a task handle, and the client retrieves the eventual result later through tasks/get, tasks/update and tasks/cancel, with notifications/tasks for push updates. A task carries a status: working, input_required, completed, failed or cancelled, plus optional status messages.

The specification is explicit about why blocking is not good enough. Holding a connection open ties it up for the whole operation, and clients and transport intermediaries impose timeouts that make that impractical past a few seconds. A task ID is durable, so a client that crashes or restarts resumes polling with the same identifier. Status metadata gives progress visibility that a blocked call cannot. And a task that needs human input can ask for it mid-flight rather than failing.

Two details matter when you build against it. Clients should persist task IDs to durable storage, because an ID held only in memory is lost exactly when it is needed most. And cancellation is cooperative: tasks/cancel is a request, not a kill signal, so a task may still reach a different terminal status. The input_required state is also the natural place to put a human check, which is the same pattern described in our guide to approval gates for unattended agent runs.

2. SDK task support: mcpkit, TanStack AI and the official SDKs

mcpkit long-running tasks tutorial for the SEP-2663 tasks extension

You rarely implement the wire format yourself. mcpkit’s long-running tasks guide documents server-directed async execution under SEP-2663, alongside the stateless wire work in SEP-2575 and the multi-round-trip request pattern in SEP-2322, with reference fixtures and a conformance suite to test against.

Its description of the decision flow is the clearest statement of how Tasks actually behave. The client does not ask for a task; the server decides. Each tool definition carries Execution.TaskSupport, and when a tools/call arrives the server reads it: forbidden or absent means run synchronously and never create a task, optional means the server may create one, and required means it must — in both of the latter cases gated on whether the client negotiated the extension.

TanStack AI exposes the same idea with one field: set execution: 'task' on the tool definition, return the final value from the handler, and the host receives a handle immediately and polls until the result appears in structuredContent. Its documentation adds a deployment note worth copying — create the server once, outside the request handler — and has a separate path for running tasks on a Worker.

The official SDKs are moving too. The Python SDK ships an experimental run_task() with a server task context, and the C# SDK documents task stores where a tasks/get from a different process or node resolves immediately, warning that eventually consistent stores must wait for the write to become visible.

3. mcp-longjobs: a fallback for clients that cannot do Tasks yet

mcp-longjobs listing describing durable resumable MCP operations

There is a gap between a specification being final and every client supporting it, and mcp-longjobs exists to live in that gap. The package’s own framing is blunt: the spec added Tasks, but client support is thin, and a server is required to refuse tasks for a client that did not opt in. So a server doing real work still needs a path that functions on today’s clients.

It names three failure modes that any long tool call hits. Per-call timeouts, often in the ten-to-sixty-second range, kill the call, and the model’s instinctive retry restarts the whole operation from scratch. Failures come back as freeform error text, so the model cannot fix one parameter and resume — it either retries blindly or gives up. And large files have no transfer story: base64 inside JSON adds roughly a third in overhead and runs into message-size caps, while a bare URL brings no chunking, resume or integrity checking.

The library answers those with composable wrappers around a standard McpServer: withTasks for background execution with progress polling, mid-flight input and cancellation, withFileTransfer for resumable chunked transfers, and a session store — JsonFileSessionStore in the simple case — that keeps operation state on disk so it survives a restart. Treat it as a compatibility layer you can remove later, not a competitor to the extension.

4. SetupYourClaw: a host that is still running when the job ends

SetupYourClaw managed AI agent deployment homepage

Every part above assumes something unglamorous: that the machine holding the task is still up, and that the agent is reachable when the work finishes. A durable handle is worthless if the process that owns it died with a closed laptop lid, and a completion notification has nowhere to land if the agent only exists while a terminal window is open.

SetupYourClaw is a managed deployment for that side of the problem. The work it removes is the provisioning sequence it lists on its own site — buying a virtual machine, creating and storing SSH keys, connecting over SSH, installing Node.js and the agent runtime, configuring it, connecting a model provider and pairing a messaging channel — which it replaces with picking a model, connecting a channel and deploying. The servers and runtime environment are prepared in advance and assigned to you.

It is worth being precise about what this is and is not. It is not a task queue, a scheduler or an implementation of the Tasks extension; it is the always-on host those things need underneath them. If your long jobs run on an agent you maintain yourself, the server, process supervision and upgrade path are yours to keep healthy, and that is exactly the work this removes. Pair it with the practices in our guide to monitoring unattended agent runs, because an always-on host still needs someone watching it.

5. Promptise Foundry MCPQueue: queue semantics inside the server

Promptise Foundry article on long-running MCP tools without client timeouts

Promptise Foundry’s write-up on long-running MCP tools diagnoses the problem at protocol level: MCP is JSON-RPC over a live transport, so a tool call is bound to the open connection for its entire lifetime. Somewhere around the thirty-, sixty- or hundred-and-twenty-second mark — whatever the transport, proxy or client library decided — the request is abandoned. The handler may still be running server-side and may still finish the PDF, but nobody is listening. As the post puts it, the work happened and the result evaporated.

Its answer is MCPQueue, which turns a slow tool into a durable job behind a small set of tools: queue_submit, queue_status, queue_result, queue_cancel and queue_list. Around those it adds priority scheduling, exponential-backoff retry and live progress reporting.

The useful distinction it draws is between progress and durability. The protocol already lets a server push notifications/progress while it runs, which is genuinely helpful — but only for as long as the connection survives. Retry policy, priority and a result you can collect later are queue concerns, and they do not come free with a progress stream. If you are choosing between implementing the Tasks extension and bolting a queue onto your existing tools, read this as the argument for why you probably want both: the extension for how the agent asks, the queue for what happens to the job after the connection drops.

6. Awaitless: durable execution on compute you already own

Awaitless repository on GitHub, durable MCP tasks over local, SSH and Slurm

Awaitless is an MIT-licensed Python project, distributed on PyPI as awaitless-runner, that describes itself as an adaptive durable execution layer between coding agents and the compute they use. The framing is that agents submit work and Awaitless owns the execution: quick work returns inline, while longer or queued work becomes a durable job.

What distinguishes it from a hosted queue is where the work lands. It runs jobs across a local machine, SSH hosts and Slurm clusters behind one stable job contract, so the workload stays on infrastructure you already have rather than moving to someone else’s. For teams whose long jobs are builds, simulations or batch processing on existing hardware, that is the difference between adopting a tool and migrating a pipeline.

Three capabilities are worth noting. Jobs have stable IDs with state, cancellation, bounded logs and artifacts that survive a client disconnect, which is the durability the Tasks extension expects a server to be able to provide. Named scarce-resource queues use durable FIFO admission so too many jobs cannot enter the same named resource at once — the kind of control that matters when several agent sessions share one GPU or one licence. And completion and recovery are treated as first-class rather than left to the caller. It is a young repository with a single maintainer, so weigh it accordingly: promising design, early-stage project.

7. Wakeshift: wake the agent instead of polling it

Wakeshift page about telling an agent when a long MCP job is done

Polling has a cost that is easy to miss until the bill arrives. Wakeshift’s page lays out the three things that happen today. You block until the job is done, which works until a timeout — it cites Cloudflare’s edge closing a request after a hundred seconds, with MCP clients imposing limits of their own. Or you return a job ID and a status tool, and the agent checks, reports “still running” and ends its turn, leaving the user to do the waiting; if it keeps checking instead, every check is a model turn that rereads the conversation. Or you hope the user comes back.

The numbers it quotes for that middle option are the argument. Developers have reported roughly 400 million tokens in one night of a Claude Code loop, and 474 timer wakes in Cursor of which 99% found nothing. One developer’s overnight job did finish, but the follow-up the agent had promised never ran, because nothing woke the main session.

Wakeshift inverts the flow: the tool that starts a job also subscribes the conversation it was called from, and when the job finishes the server calls emit, and that conversation picks up where it left off — in Claude Code, Codex, Cursor, Copilot CLI or whichever agent the user runs. No status tool to poll and no timeout to tune. It is the same event-driven shape described in our guide to webhook triggers for agent runs, applied to job completion rather than inbound events.

8. bunqueue: drive the queue from inside the agent session

bunqueue MCP server documentation for agent-driven queue management

The parts above are about getting one job to survive. bunqueue addresses the day after: operating the queue once jobs are routine. It ships an MCP server, bunqueue-mcp, with 79 primary tools covering jobs, queues, crons, retries, limits, flows, workers, webhooks and monitoring, so an agent can add jobs, schedule crons, retry failures and inspect queues in plain language.

Setup is a single client registration — the documented example is claude mcp add bunqueue -e BUNQUEUE_MCP_PROFILE=agent -- bunx --package=bunqueue bunqueue-mcp — and the package includes a preflight check, bunqueue-mcp --doctor --json, which reports configuration and filesystem readiness plus a read-only TCP probe on exit 0, and invalid settings or an unavailable broker on exit 1. The doctor starts no transport, worker or database connection, so it is safe to run before connecting. Once running, bunqueue_get_capabilities returns the server’s effective configuration.

One choice deserves a second look. The agent profile defaults absent toolset and confirmation settings to dynamic and destructive, which means a session can reach tools that delete and retry work unless you set those explicitly. That is reasonable for a developer at a keyboard and risky for an unattended run, and it is the same scoping problem you face whenever an MCP server is shared across clients or environments.

MCP Tasks parts at a glance

Part What it provides Where it sits Consider it when
MCP Tasks extension Task handles, statuses, mid-flight input, cancellation The protocol itself You want the standard behaviour, not a custom convention
mcpkit / TanStack AI / official SDKs Server-side task support in code Your MCP server You are implementing tasks in TypeScript, Python or C#
mcp-longjobs Background execution and chunked file transfer on clients without Tasks Wrapper around your server Your users run clients that have not adopted the extension
SetupYourClaw Managed, always-on agent host Under everything else You do not want to provision and maintain the server
Promptise Foundry MCPQueue Submit, status, result, cancel, retry, priority Inside the server Jobs need retry policy and priority, not just a handle
Awaitless Durable jobs across local, SSH and Slurm Between agent and your compute The work must stay on hardware you already own
Wakeshift Completion events that resume the conversation Beside the server Polling costs too much or the user walks away
bunqueue Queue, cron, worker and retry administration as tools Operations layer Long jobs are routine and need day-to-day management

How to choose

Start with the failure you actually have. If calls die at a timeout, implement the Tasks extension through your SDK and add mcp-longjobs only if your users’ clients have not adopted it. If jobs need retries, priority or a result collected hours later, add queue semantics inside the server rather than inventing status conventions per tool. If polling is burning tokens or users miss completions, an event that wakes the session is the cheaper fix. If the work belongs on your own hardware, keep execution there. And before any of it, make sure the host stays up, because every durable handle assumes a process that is still alive to answer for it.

Frequently asked questions

What problem do MCP Tasks solve?

A standard tool call is bound to an open connection, so a job that runs for minutes hits a client, proxy or transport timeout and the result is lost even though the server finished the work. Tasks replace the blocked call with a durable handle the client can poll, so the result survives disconnects and restarts.

Does the client or the server decide to create a task?

The server decides. Each tool definition carries task-support metadata: absent or forbidden means the call always runs synchronously, optional means the server may create a task, and required means it must. Both of the latter depend on the client having negotiated the Tasks extension during initialisation, otherwise the server refuses.

Can I use Tasks if my agent client does not support the extension?

Not directly, because a server must refuse to create tasks for a client that did not opt in. The practical route is a fallback layer such as mcp-longjobs, which gives background execution, progress polling, mid-flight input and cancellation through ordinary tool calls, then removing it once your clients support the extension natively.

Is polling a task the same as waiting for it?

No, and the difference is expensive. Each poll is a model turn that rereads the conversation, which is why developers report hundreds of timer wakes finding nothing and very large token counts from overnight loops. Completion events that resume the session avoid both the cost and the missed follow-ups.

Do long-running agent jobs need a dedicated server?

They need a host that stays running. Task IDs are durable only if the process holding them survives, and a completion event has nowhere to arrive if the agent exists only while a laptop is open. That can be your own machine, a VPS you maintain, or a managed deployment.

Conclusion

MCP Tasks turn a slow tool call into something an agent can start, leave and come back to. The extension defines the contract, SDKs implement it, queues add retries and priority, and completion events spare you the polling bill. What none of them provide is the machine underneath — and a durable handle on a host that went to sleep is not durable at all. If you would rather spend your time on the jobs than on provisioning, SSH keys and keeping a process alive, SetupYourClaw runs the agent host for you so the work is still there when the job finishes.