Skip to content

[Server][Capability] SEP-2663 Tasks: Tool handlers can return task handles; long-running execution model #348

@chr-hertel

Description

@chr-hertel

Implements the long-running execution path for SEP-2663 for the MCP Spec 2026-07-28 release.

Tracked by umbrella #335. Largest design decision in this milestone.

Spec summary

Tools can opt into task-eligible execution. The runtime returns a task handle early; the tool body continues running asynchronously and writes progress/results to the task store. Subsequent tasks/get/tasks/update calls read from the store.

PHP SDK changes

  • Extend #[McpTool] (or add a sibling marker) to signal task-eligibility.
  • src/Capability/Registry/Handler/ReferenceHandler.php: today the Fiber either returns a result or suspends for sampling/elicitation. Add a path where the handler returns early with a task handle and continues running.
  • Open design question: how does a PHP server keep a task progressing between HTTP requests? Options to evaluate:
    • Push the tool body onto a queue worker (Symfony Messenger / queue interface).
    • Spawn a detached process / use fastcgi_finish_request.
    • Require user-supplied background executor (lightweight strategy interface).
  • Extend tools/call handler in src/Server/Handler/Request/ to honor the negotiated tasks extension and emit a task handle when the runtime defers.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    2026-07-28All issues and PRs related to the spec release 2026-07-28P0Broken core functionality, security issues, critical missing featureServerIssues & PRs related to the Server componentenhancementRequest for a new feature that's not currently supportedimproves spec complianceImproves consistency with other SDKs such as TyepScriptneeds designValid issue but needs maintainer alignment on design or approach

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions