Connect Claude Code to tools via MCP changedmcp
Nearest release: v2.1.332, 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 24 Nov 2026 17:37 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 24 Nov 2026 18:07 UTC.
Upstream edited
Recorded here
Lines+74added
Lines−12removed
From line
481
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits124to this page, all time
#### MCP tasks in VS Code and the desktop app #### MCP tasks in cloud sessions and claude.ai chats #### Get an MCP task's result in the cloud
The whole hunk
from line 481, old and new numbered
/
from line 481
481481
482482To change or turn off automatic backgrounding:
483483
484* Set the [`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`](https://code.claude.com/docs/en/env-vars) environment variable in milliseconds to change the threshold, or set it to `0` to turn automatic backgrounding off. With `0`, Claude also [waits for MCP tasks](#make-claude-wait-for-the-result-of-an-mcp-task) in an interactive session
484* Set the [`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`](https://code.claude.com/docs/en/env-vars) environment variable in milliseconds to change the threshold, or set it to `0` to turn automatic backgrounding off. With `0`, Claude also [waits for MCP tasks](#make-claude-wait-for-the-result-of-an-mcp-task) in an interactive terminal session
485485* Set [`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`](https://code.claude.com/docs/en/env-vars) to `1` to turn off automatic backgrounding and [background commands](https://code.claude.com/docs/en/tools-reference.md#background-commands)
486486
487487Some calls never move to the background:
from line 500
500500
501501> [!NOTE]
502502>
503> MCP tasks are in public beta and require Claude Code v2.1.304 or later. [What a call needs to become an MCP task](#requirements-for-mcp-tasks) lists the sessions and servers that get them.
503> MCP tasks require Claude Code v2.1.304 or later. [What a call needs to become an MCP task](#requirements-for-mcp-tasks) lists the sessions and servers that get them.
504504
505505#### Stop an MCP task or get its result
506506
from line 520
520520
521521Unless you've set Claude to [wait for the result](#make-claude-wait-for-the-result-of-an-mcp-task), press `Esc` in the dialog to answer later. To reopen the question, run `/tasks`, open the task's details, and press `Enter`. Answering later requires Claude Code v2.1.324 or later.
522522
523In a [non-interactive](https://code.claude.com/docs/en/headless.md) session, Claude Code asks the server to cancel a task that requests input, without running your [`Elicitation` hooks](https://code.claude.com/docs/en/hooks#elicitation) or calling the Agent SDK's `onElicitation` callback.
523Use an interactive terminal session for tasks that ask questions, because no dialog opens in these other places:
524524
525* **[`claude -p`](https://code.claude.com/docs/en/headless) runs and Agent SDK sessions**: Claude Code asks the server to cancel the task, without running your [`Elicitation` hooks](https://code.claude.com/docs/en/hooks#elicitation) or calling the Agent SDK's `onElicitation` callback
526* **VS Code and local desktop app sessions**: see [MCP tasks in VS Code and the desktop app](#mcp-tasks-in-vs-code-and-desktop)
527* **Cloud sessions and claude.ai chats**: see [Get an MCP task's result in the cloud](#mcp-task-results-in-the-cloud)
528
525529#### Exit, clear, or resume while an MCP task runs
526530
527531A task on a remote server keeps running after you exit. A stdio server's process stops when Claude Code exits, even though `/tasks` says the server's tasks keep running. Unless that server's documentation says the work outlives the process, let those tasks finish or stop them in `/tasks` first.
from line 540
536540
537541#### What a call needs to become an MCP task
538542
539A tool call becomes an MCP task only when all of these conditions hold:
543For the cloud, see [MCP tasks in cloud sessions and claude.ai chats](#mcp-tasks-in-the-cloud). Elsewhere, a tool call becomes an MCP task only when it meets all of these conditions:
540544
541545* The server supports tasks
542546* The server is an HTTP, stdio, or claude.ai connector server connected on [protocol revision 2026-07-28](#mcp-client-runtimes). Setting [`MCP_SDK_GENERATION=v1` or `MCP_PROTOCOL_NEGOTIATION=legacy`](https://code.claude.com/docs/en/env-vars) rules that out
from line 547
543547* The session [fetches feature flags](https://code.claude.com/docs/en/env-vars.md#features-that-need-feature-flag-fetching), so not on a third-party provider such as Amazon Bedrock, and not with telemetry or flag fetching turned off
544548* Anthropic has turned MCP tasks on for your kind of session:
545549 * Terminal CLI sessions, [Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview.md) sessions, and [GitHub Actions](https://code.claude.com/docs/en/github-actions.md) runs have them on v2.1.304 or later
546 * [Cloud sessions](https://code.claude.com/docs/en/claude-code-on-the-web.md), including ones you open in the desktop app, have them only if Anthropic has turned them on for your account or organization. You can't turn them on or look up their state in a setting
547 * Some other Claude Code surfaces, such as the [VS Code extension](https://code.claude.com/docs/en/vs-code.md) and local sessions in the [desktop app](https://code.claude.com/docs/en/desktop.md), don't have them
550 * For the VS Code extension and local sessions in the desktop app, see [MCP tasks in VS Code and the desktop app](#mcp-tasks-in-vs-code-and-desktop)
548551* The call comes from the main conversation, not from a [subagent](https://code.claude.com/docs/en/sub-agents.md)
549552* Either the session is interactive, or an [Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview.md) session or a `claude -p` run reading `--input-format stream-json` has:
550553 * [`CLAUDE_AUTO_BACKGROUND_TASKS`](https://code.claude.com/docs/en/env-vars) at `1`
from line 558
555558
556559Keep an Agent SDK or stream-json session's input open, because the run [doesn't wait for MCP tasks](https://code.claude.com/docs/en/headless.md#mcp-work-when-a-non-interactive-run-ends) after input closes. A one-shot `claude -p "<prompt>"` run doesn't get MCP tasks.
557560
561#### MCP tasks in VS Code and the desktop app
562
563MCP tasks work in the [VS Code extension](https://code.claude.com/docs/en/vs-code.md) and local [desktop app](https://code.claude.com/docs/en/desktop.md) sessions only if Anthropic has turned them on for your account or organization. Update the extension or app to its latest version first.
564
565Use a terminal session in these cases:
566
567* **claude.ai connector in the desktop app**: it gets no tasks in local sessions
568* **Server from `claude_desktop_config.json`**: it gets no tasks either, so [add it to the CLI](#installing-mcp-servers) first
569* **Task that asks questions**: neither app shows a task's question, and Claude Code asks the server to cancel the task unless an [`Elicitation` hook](https://code.claude.com/docs/en/hooks#elicitation) accepts the request
570
571Once the server accepts the job, you can see or stop the task in VS Code's [`/tasks`](https://code.claude.com/docs/en/vs-code#monitor-background-processes) or the desktop app's [**Background tasks** pane](https://code.claude.com/docs/en/desktop.md#watch-background-tasks). If no row appears while Claude waits on the call, or the tool fails, check these causes:
572
573* **`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS` at `0` or `CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND` at `1`**: remove it, for example from `env` in [`settings.json`](https://code.claude.com/docs/en/settings), and start a new session
574* **Tasks not turned on for your account**: no setting shows this, so use a terminal session if nothing above applies
575
576#### MCP tasks in cloud sessions and claude.ai chats
577
578MCP tasks work in the cloud with [claude.ai connectors](#use-mcp-servers-from-claude-ai) that support them on [protocol revision 2026-07-28](#mcp-client-runtimes). Calls from the main conversation can become tasks in these places:
579
580* [Cloud sessions](https://code.claude.com/docs/en/claude-code-on-the-web.md) you start yourself in Anthropic-hosted environments
581* New chats in the [unified Claude experience](https://support.claude.com/en/articles/16761823-claude-cowork-and-chat-are-one-claude) on Pro, Max, Ultra, and Team plans
582
583Not every existing chat has tasks. If a tool that works only as a task fails in an existing chat on one of those plans, try a new chat.
584
585Only some accounts get MCP tasks in these other places:
586
587* New chats in the unified Claude experience on Free and Enterprise plans
588* The **Cowork** option, on accounts without the unified experience, where the message box offers a choice of **Chat** or **Cowork**
589* [Recurring work that you schedule](https://support.claude.com/en/articles/13854387-schedule-recurring-tasks-in-cowork) from a chat or from Cowork
590
591You can't turn MCP tasks on for your account in a setting. If a tool that works only as a task fails in one of those places, run it from a terminal session on a paid plan.
592
593In cloud sessions, servers from `.mcp.json` or a plugin get no tasks, so a tool that works only as a task returns the server's error. Add a remote server as a connector instead.
594
595Expect calls without tasks in cases such as these, and run a tool that needs tasks from a terminal session:
596
597* [Project](https://code.claude.com/docs/en/claude-projects.md) threads
598* Incognito chats
599* Claude Code's [cloud scheduled tasks](https://code.claude.com/docs/en/routines.md)
600
601#### Get an MCP task's result in the cloud
602
603If a task's result hasn't arrived in a cloud session or chat, send a message so Claude Code checks the task again. You can leave while a task runs. When it completes or fails, Claude usually picks up the result unprompted, even in a session that stopped for inactivity.
604
605If Claude reports one of these problems with the task, take the step that matches its report:
606
607* **The task was cancelled because it asked you a question**: cloud sessions and chats can't show a task's questions, so run that tool from an interactive terminal session
608* **Tracking stopped after failed status checks**: the job can still be running, so ask Claude to check it again. If no result follows, ask Claude to find the outcome with the server's other tools
609* **The server no longer knows the task**: the result may be lost, so ask Claude to find the outcome with the server's other tools before you run the job again
610* **The task reached the seven-day tracking limit**: the job can still be running. In a cloud session, ask Claude to check it again. In a chat, ask Claude to find the outcome with the server's other tools
611
558612#### Status messages on an MCP task
559613
560614These messages, in a task's `/tasks` entry or its closing transcript line, mean Claude Code can't reach the server or the task. While one shows in `/tasks`, the job may still be running: Claude Code leaves it alone and keeps checking. The `300s` and configuration messages stay on the entry even after contact returns.
from line 628
574628
575629#### Time limits on MCP tasks
576630
577By default, a task in the background has no Claude Code time limit. The [tool call time limits](#time-limits-on-mcp-tool-calls), including the wall-clock limit and the idle timeout, apply until the server answers the call with the task. If you [make Claude wait](#make-claude-wait-for-the-result-of-an-mcp-task), they apply for the whole task. Answered status checks count as activity for the idle timeout.
631Outside [cloud sessions and claude.ai chats](#mcp-task-results-in-the-cloud), a task in the background has no Claude Code time limit by default. The [tool call time limits](#time-limits-on-mcp-tool-calls), including the wall-clock limit and the idle timeout, apply until the server answers the call with the task. If you [make Claude wait](#make-claude-wait-for-the-result-of-an-mcp-task), they apply for the whole task. Answered status checks count as activity for the idle timeout.
578632
579633#### Make Claude wait for the result of an MCP task
580634
581To 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`](https://code.claude.com/docs/en/settings):
635To make Claude wait for a task's result in an interactive terminal session, set one of two environment variables, for example in the `env` block of [`settings.json`](https://code.claude.com/docs/en/settings):
582636
583637* **[`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`](https://code.claude.com/docs/en/env-vars) set to `0`**: Claude waits for every MCP tool call until the call ends
584638* **[`CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND`](https://code.claude.com/docs/en/env-vars) set to `1`**: Claude waits for a task's result. While [automatic backgrounding](#automatic-backgrounding-of-long-tool-calls) 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
from line 676
622676| `taskId` | Required. At most 128 printable ASCII characters with no spaces, or Claude gets a tool error beginning `MCP server "<name>" returned a malformed task handle for tool "<tool>"`. Keep the ID answerable across connections, because after a resume Claude Code asks about it on a new connection |
623677| `status` | Required. One of `working`, `input_required`, `completed`, `failed`, or `cancelled`. Another value gives the `Unsupported result type` error |
624678| `createdAt`, `lastUpdatedAt`, `ttlMs` | Required by the tasks extension, and `ttlMs` may be `null`. Claude Code doesn't drop a task because its `ttlMs` has passed |
625| `pollIntervalMs` | Optional. Milliseconds between `tasks/get` requests, clamped to between 250 and 30000. Claude Code uses 2000 when the field is absent or `null`, and reads the value again from each `tasks/get` response |
679| `pollIntervalMs` | Optional. Milliseconds between `tasks/get` requests, read again from each `tasks/get` response. Outside the cloud, Claude Code clamps the value to between 250 and 30000, and uses 2000 when the field is absent or `null`. For the cloud, see [Choose a time to live and a poll interval](#choose-a-time-to-live-and-a-poll-interval) |
626680| `statusMessage` | Optional. `/tasks` shows the value from your latest `tasks/get` response, not this first one, and a response that omits the field clears it. A [status message from Claude Code](#status-messages-on-an-mcp-task) can take its place |
627681
628682Claude Code accepts a task answer that omits `createdAt`, `lastUpdatedAt`, or `ttlMs`, or that sets `pollIntervalMs` to `null`. Before v2.1.317, the call failed with the `Unsupported result type` error instead. To work with those versions too, send the three fields that the tasks extension requires, and send `pollIntervalMs` as a number or not at all.
from line 685
631685
632686#### Report status, results, and questions
633687
634Right after the task answer, Claude Code sends `tasks/get` with `{ "taskId": ... }`, then repeats it once per poll interval. The tasks extension requires your response to carry `"resultType": "complete"` along with `taskId`, `status`, `createdAt`, `lastUpdatedAt`, and `ttlMs`. `ttlMs` may be `null`, and `statusMessage` and `pollIntervalMs` are optional. This example reports the build as done:
688Right after the task answer, Claude Code sends `tasks/get` with `{ "taskId": ... }`, then repeats it once per [poll interval](#choose-a-time-to-live-and-a-poll-interval). The tasks extension requires your response to carry `"resultType": "complete"` along with `taskId`, `status`, `createdAt`, `lastUpdatedAt`, and `ttlMs`. `ttlMs` may be `null`, and `statusMessage` and `pollIntervalMs` are optional.
635689
690This example reports the build as done:
691
636692```json theme={null}
637693{
638694 "resultType": "complete",
from line 710
654710| `failed` | Tells Claude the `message` of the top-level `error` object `{ code, message, data }`, which the tasks extension requires on a failed task. Without that `message`, Claude gets `statusMessage` instead, or else `Task failed` |
655711| `cancelled` | Tells Claude `statusMessage`, or else `Task was cancelled by the server` |
656712| `input_required` | Reads `inputRequests`, an object that maps a key you choose to `{ method, params }`. Claude Code answers each key once through `tasks/update` with `{ taskId, inputResponses }`, where `inputResponses` maps the same key to that request's result. Keys beyond 16 per task are ignored |
657| Methods in `inputRequests` | `elicitation/create` is served only in interactive terminal sessions, and `roots/list` everywhere. When Claude Code can't serve a request, it asks the server to cancel the task |
713| Methods in `inputRequests` | `elicitation/create` reaches a person only in interactive terminal sessions. `roots/list` is served outside the cloud. Don't depend on it in [cloud sessions and claude.ai chats](#mcp-tasks-in-the-cloud). When Claude Code can't serve a request, it asks the server to cancel the task |
658714| Another `status` value | Claude Code asks the server to cancel the task and reports it to Claude as failed |
659| JSON-RPC error `-32602` | Read as an unknown task ID. For a task in the background, Claude Code keeps asking for up to five minutes, then reports the outcome to Claude as unknown |
715| JSON-RPC error `-32602` | Read as an unknown task ID. For a task in the background outside the cloud, Claude Code keeps asking for up to five minutes, then reports the outcome to Claude as unknown. In cloud sessions and claude.ai chats, expect about five minutes of retries too, then a report that [the server no longer knows the task](#mcp-task-results-in-the-cloud) |
660716| `tasks/cancel` | Sent, for example, when Claude or the person stops the task while the server is connected. Not sent on exit |
661717| `tasks/result`, `tasks/list`, `notifications/tasks` | Not used, so put the outcome in your `tasks/get` responses |
662718
from line 724
668724
669725* **`ttlMs`**: report how long your server keeps the task, counted from the task's creation. Send your longest run time plus the time you keep the result, such as `5400000` for a 30-minute job and one hour. Send `null` if your server keeps tasks with no time limit
670726* **`pollIntervalMs`**: send 10000 to 30000 for a job that runs longer than a minute, so your server answers fewer status checks. For a shorter job, send 2000 so Claude gets the result sooner
727
728In [cloud sessions and claude.ai chats](#mcp-tasks-in-the-cloud), status checks can come less often than your `pollIntervalMs` asks, so plan for these intervals:
729
730* **A new task**: expect checks to follow a `pollIntervalMs` from 1000 to 30000. A lower value can be raised to 1000. If you omit the field, expect at most 10 seconds between checks
731* **An older task**: allow for checks that slow to every 10 seconds once the task is a minute old, and to every 30 seconds after 10 minutes
732* **A value above 30000**: checks can follow it as sent and delay the result, so stay at 30000 or below
671733
672734### Plugin-provided MCP servers
673735
No line in this hunk matches that.