Skip to content

Feature: async/background mode for MCP tool calls #31427

Description

@thekej

Problem

When Claude Code calls MCP tools, the call blocks the entire conversation until it returns. For long-running MCP operations (minutes to hours), this makes the session unusable — the user can't ask questions, check on other work, or issue new commands while waiting.

The Bash tool already has run_in_background which solves this for shell commands. But there's no equivalent for MCP tool calls.

Proposed Solution

Add an async or run_in_background parameter to MCP tool calls (or to tool calls generally). When set:

  1. The tool call returns immediately with a task ID
  2. Claude can continue the conversation normally
  3. When the MCP call completes, the result is delivered (same as background Bash tasks)
  4. Claude (or the user) can check status via TaskOutput or similar

Use Cases

  • Long-running MCP agent spawns: Code analysis, verification pipelines, etc. (5-30 min) block the session
  • Any slow MCP tool: Database queries, API calls to external services, CI/CD triggers
  • Parallel workflows: User wants to discuss results from Task A while Task B runs via MCP

Current Workaround

Write a Python/shell script that does the equivalent work, then run it via Bash with run_in_background=true. This works but defeats the purpose of having MCP integrations — you lose the structured input/output contract and have to re-implement the MCP tool's logic in a script.

Suggested API

Either as a universal parameter on any tool call:

{
  "name": "mcp__some_server__some_tool",
  "parameters": {
    "prompt": "...",
  },
  "run_in_background": true
}

Or at the Claude Code orchestration level, wrapping any MCP call:

{
  "async": true,
  "tool": "mcp__some_server__some_tool",
  "parameters": { ... }
}

Returns: { "task_id": "abc123", "status": "running" }

This would bring MCP tool calls to parity with Bash background execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions