New features / v2.1.319
Add flag to disable MCP task backgrounding
CHANGELOG · original
Added the CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND environment variable to make Claude Code wait for an MCP task inside its tool call instead of moving it to the background right away Open official changelog ↗ Documentation
Documentation excerpt
Make Claude wait for the result of an MCP task
To make Claude wait for a task's result in an interactive session, set one of two environment variables, for example in the env block of settings.json:
CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSset to0: Claude waits for every MCP tool call until the call endsCLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUNDset to1: Claude waits for a task's result. While automatic backgrounding is on, it moves the call after two minutes by default, so short tasks finish in place and long ones don't block you. The moved call is a plain background call rather than an MCP task. It doesn't survive exiting the session
While Claude waits, pressing Esc or reaching the wall-clock limit or idle timeout ends the call, and Claude Code asks the server to cancel the task.
If you set CLAUDE_CODE_DISABLE_BACKGROUND_TASKS to 1 or start in bare mode, that alone doesn't make Claude wait for MCP tasks. This example sets CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS to 0, so Claude waits for every MCP tool call:
{
"env": {
"CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS": "0"
}
}
Documentation snapshot · 2026-11-20