Run Claude Code programmatically changedheadless
Nearest release: v2.1.310, published 4 hours after upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 23 Oct 2026 16:44 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 23 Oct 2026 17:07 UTC.
Upstream edited
Recorded here
Lines+8added
Lines−1removed
From line
58
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits45to this page, all time
#### MCP work when a non-interactive run ends
The whole hunk
from line 58, old and new numbered
/
from line 58
5858
5959* **MCP servers**: only servers supplied on the command line connect, for example with `--mcp-config`. In an interactive session, Claude Code also skips the automatic IDE connection unless you pass `--ide`.
6060* **System reminders**: Claude gets your prompts and the tool results without the [system reminders](/docs/en/glossary.md#system-reminder) Claude Code would add alongside them. For example, Claude isn't told when a file it read earlier changes on disk, and it doesn't get the list of available skills, including skills from an `--add-dir` folder.
61* **Background tasks**: none run. A command that reaches its [timeout](/docs/en/tools-reference.md#timeout-and-output-limits) stops instead of [moving to the background](/docs/en/tools-reference.md#background-commands).
61* **Background tasks**: Claude can't run background commands or background subagents, and the other features that [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](/docs/en/env-vars) turns off are off too. A command that reaches its [timeout](/docs/en/tools-reference.md#timeout-and-output-limits) stops instead of [moving to the background](/docs/en/tools-reference.md#background-commands).
6262
6363Before v2.1.286, these limits held only partly: an interactive `--bare` session connected the MCP servers that a normal session would, every `--bare` session sent system reminders, and background tasks stayed available.
6464
from line 84
8484If the run reaches its [`--max-budget-usd`](/docs/en/cli-reference#cli-flags) cap, Claude Code stops the remaining background work instead of waiting.
8585
8686When background work starts another turn, the run prints each turn's result with the default `text` output and the last turn's result with `json` output. Before v2.1.295, the run printed only the last turn's result with `text` output too.
87
88#### MCP work when a non-interactive run ends
89
90A `claude -p` run doesn't wait for MCP work in the background:
91
92* **[MCP tasks](/docs/en/mcp.md#mcp-tasks-that-run-on-the-server)**: on a remote server the job goes on. To follow it again, [resume that session](/docs/en/mcp.md#exit-clear-or-resume-while-an-mcp-task-runs), not as a one-shot `claude -p "<prompt>"` run.
93* **MCP calls that [automatic backgrounding](/docs/en/mcp.md#automatic-backgrounding-of-long-tool-calls) moved**: the call's result is lost.
8794
8895### Stop a run with SIGTERM
8996
No line in this hunk matches that.