Skip to content

[MCP] Adopt MCP Tasks so long run_agent can outlive the host session #102

Open

Description

@Birfy

Why

#83 (merged) keeps a long run_agent inside the current host request: progress notifications, a bounded lock wait, cancellation, and documented host timeout settings. That still assumes the tool call is one open request the host waits on.

In late October 2026 hosts moved past that model. Claude Code v2.1.304+ (public beta, protocol revision 2026-07-28) can turn a long MCP tool into a server-side task: the tools/call returns as soon as the server accepts the job, the job keeps running on the server, and the client polls status (including across /resume). Coverage and the six host-side config decisions: MCP tasks landed in Claude Code (2026-10-26). Related industry notes on progress resetting client timeouts (still useful alongside tasks): MCP “Request timed out” (-32001) on long tools (tested 2026-10-09).

run_agent is exactly the long call (Allrecipes budgets 300 s; the README chat-model Allrecipes run was 138.7 s). Today s1a-mcp is pinned to mcp>=1.26,<2 because openjiuwen / fastmcp still need mcp 1.x (#74). MCP Tasks need the 2026-07-28 revision and a server that answers with a task when the client declares io.modelcontextprotocol/tasks.

Proposed scope (one PR, opt-in)

  1. Spike whether Tasks can land while staying on mcp 1.x, or whether the mcp 2 / fastmcp 4 move from [Deps] Bound mcp below 2 and record what blocks the move to the 2026-07-28 SDK #74 is a hard prerequisite; record the blocker in the issue if so.
  2. If feasible: make run_agent (and only that tool) return an MCP task when the client advertises task support; keep today's synchronous path when it does not.
  3. Progress / status updates on the task; cancel maps to the existing cancellation path from [MCP] Keep long run_agent calls inside host tool timeouts: progress, bounded lock wait, cancellation, documented settings #83.
  4. Document Claude Code / Codex settings for Tasks vs plain tool timeouts in docs/skills.md (link the host docs; do not invent host flags).
  5. Contract tests with a fake client capability blob: task path vs sync path; no live browser required.

Acceptance criteria

Out of scope

References

Activity

  1. Birfy commented on Oct 30, 2026

    @Birfy
    CollaboratorAuthor

    Spike result (scope item 1), recorded from the installed SDK: mcp 1.30.0 has tasks only as the 2025-11-25 experimental API (SEP-1686), which it marks deprecated because tasks left the core spec and are expected back as an extension. It does not implement the 2026-07-28 extension form. So tasks can land on 1.x in the 2025-11-25 shape without the #74 move; a host that only speaks the extension form keeps the plain call. Draft #106 implements that path for run_agent with contract tests; no host has been verified against it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions