How to stop Claude Code MCP tasks in /tasks and make Claude wait for their results
Since v2.1.304, Claude Code supports MCP tasks in public beta: an MCP server runs a long job, such as a report export or a build, on its own. The tool call returns once the server accepts the job and Claude moves on. Meanwhile the footer shows a count such as 1 MCP task, and when the job ends a line like this appears in the transcript.
MCP task <server task id> (<server>/<tool>) completed.
The result goes to Claude rather than the transcript, so ask Claude for it. If Claude is idle when it arrives, Claude picks it up on its own.
-
Stop a task. Select it in
/tasksand pressx, or ask Claude to stop it. Esc doesn't stop it. If the server disconnected, reconnect it from/mcpfirst, or no cancel request reaches the server. The server may still have done some of the work. -
Make Claude wait. Add this to the
envblock ofsettings.jsonand Claude waits for every MCP tool call to end.
{
"env": {
"CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS": "0"
}
}
To wait only for task results, set CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND to "1" instead. Calls running past two minutes still move to a plain background call, which doesn't survive exiting the session. Setting CLAUDE_CODE_DISABLE_BACKGROUND_TASKS to 1 alone doesn't make Claude wait for MCP tasks.
- Get the result later. A task on a remote server keeps running after you exit. Resume the session that started it with
claude --resume, and Claude Code follows the task again and gets the result if it finished meanwhile. A new session or one opened with--fork-sessiondoesn't follow it. A stdio server's process stops when Claude Code exits, so let its tasks finish or stop them in/tasksfirst.
MCP tasks only appear in terminal CLI, Agent SDK and GitHub Actions sessions. The VS Code extension, the desktop app, third-party providers such as Amazon Bedrock, calls from subagents and one-shot claude -p runs don't get them. The server must support tasks and connect on protocol revision 2026-07-28.
Sources
Get notified when a new tip lands
Tip alerts only go out in the app. Install it and turn notifications on.