Skip to content
← Back to release · 2.1.319
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:

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

Change details