Skip to content

Support the MCP 2026-07-28 tasks extension - #423

Open
jancurn wants to merge 2 commits into
mainfrom
claude/dazzling-fermi-dbdfqb
Open

jancurn wants to merge 2 commits into
mainfrom
claude/dazzling-fermi-dbdfqb

Conversation

@jancurn

@jancurn jancurn commented Sep 23, 2026

Copy link
Copy Markdown
Member

mcpc now speaks the MCP tasks extension (io.modelcontextprotocol/tasks) on 2026-07-28 servers, ahead of the official SDK — the way the skills extension landed in #401. Task creation is the server's call under this spec, so a plain tools-call that comes back as a task is followed to its result, --detach may return the tool result instead of a task, and tasks-list shows the tasks the session created (the extension has no listing). 2025-11-25 servers keep working unchanged.

  • Hand-written validators for the extension's results, plus a transport shim that gets tasks/get/tasks/cancel and resultType: "task" answers past SDK 2.0.0's era gates and adds the Mcp-Name routing header the spec requires
  • tasks/get polling at the server's pollIntervalMs; failed, cancelled and input_required outcomes reported in their own words (mcpc never answers inputRequests)
  • Per-session task record in the bridge for crash recovery and tasks-list; --detach --json prints the whole created Task
  • The modern e2e test server gains an HTTP-level tasks layer; sessions/async-tasks now runs in both eras and the new sessions/tasks-extension suite covers the extension-only behaviour
  • Help, README, agent skill, REFERENCE.md and CHANGELOG updated

Refs #401

🤖 Generated with Claude Code

https://claude.ai/code/session_01HXvpsSa4d6RkPP4FqhuDak

mcpc now speaks the 2026-07-28 tasks extension ahead of the official SDK,
the way the skills extension was done in #401: `tools-call --task/--detach`,
`tasks-get`, `tasks-result` and `tasks-cancel` work on servers that declare
the extension, mcpc declares it on every request, and a server that answers a
plain `tools-call` with a task handle is followed to its result. `tasks-list`
shows the tasks the session created, since the extension has no listing.
2025-11-25 servers keep working unchanged.

- Extension results are validated by hand-written Standard Schema validators
  (`src/core/tasks-schema.ts`); a transport shim gets the extension past SDK
  2.0.0's era gates, which refuse `tasks/get`/`tasks/cancel` on a modern
  connection and reject `resultType: "task"` before any result schema runs,
  and adds the `Mcp-Name: <taskId>` routing header the spec requires
- `McpClient` polls `tasks/get` at the server's `pollIntervalMs`, reports
  failed/cancelled/input_required outcomes in their own words (mcpc never
  answers `inputRequests`), and treats `tasks/cancel` as the cooperative
  acknowledgement it is
- The bridge keeps a per-session task record for crash recovery and, on
  2026-07-28 connections, for `tasks-list`; `--detach` returns the created
  Task or, when the server ran the call synchronously, the tool result
- The modern e2e test server gains an HTTP-level tasks layer (the v2 SDK
  server refuses the extension's methods too) plus a routing-header probe;
  sessions/async-tasks now runs in both eras and sessions/tasks-extension
  covers the extension-only behaviour
- Help, README, agent skill, REFERENCE.md and CHANGELOG updated

Refs #401

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXvpsSa4d6RkPP4FqhuDak

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Task persistence can lose records, transient errors can erase tasks, and detached x402 retries are broken.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 4 Medium severity · 3 Low severity

Open (7)
What changed in this PR

Adds MCP 2026-07-28 Tasks extension support while retaining legacy task behavior.

Changes:

  • Adds task schemas, transport shims, polling, cancellation, and persistence.
  • Updates CLI output, help, and documentation.
  • Expands unit, E2E, and conformance coverage.
File Description
src/​core/​tasks-schema.ts Validates extension task results.
src/​core/​tasks-transport-shim.ts Bridges unsupported SDK task behavior.
src/​core/​mcp-client.ts Implements modern task operations.
src/​core/​transports.ts Adds task routing headers.
src/​core/​protocol.ts Adds task-specific diagnostics.
src/​core/​extensions.ts Registers Tasks extension support.
src/​core/​capabilities.ts Declares client task capabilities.
src/​lib/​types.ts Adds cross-era task types.
src/​lib/​session-client.ts Updates task IPC contracts.
src/​bridge/​index.ts Tracks and serves session tasks.
src/​cli/​commands/​tools.ts Handles server-directed task creation.
src/​cli/​commands/​tasks.ts Supports modern task commands.
src/​cli/​output.ts Formats both task shapes.
src/​cli/​index.ts Updates command help and JSON shapes.
src/​cli/​help-text.ts Adds the Tasks specification URL.
test/​unit/​core/​transports.test.ts Tests wrapped fetch behavior.
test/​unit/​core/​tasks-transport-shim.test.ts Tests shim and routing headers.
test/​unit/​core/​tasks-schema.test.ts Tests task validation.
test/​unit/​core/​protocol.test.ts Tests task diagnostics.
test/​unit/​core/​mcp-client.test.ts Tests modern task lifecycle behavior.
test/​unit/​core/​extensions.test.ts Tests extension declarations.
test/​unit/​core/​capabilities.test.ts Tests advertised task support.
test/​unit/​cli/​output.test.ts Tests task formatting.
test/​e2e/​suites/​sessions/​tasks-unsupported.test.sh Tests unsupported-task failures.
test/​e2e/​suites/​sessions/​tasks-extension.test.sh Covers extension-specific behavior.
test/​e2e/​suites/​sessions/​async-tasks.test.sh Runs task flows across eras.
test/​e2e/​suites/​basic/​help.test.sh Hardens help validation.
test/​e2e/​suites/​basic/​extensions.test.sh Verifies task capability declarations.
test/​e2e/​server/​index-v2.ts Adds a modern task test server.
test/​e2e/​server/​fixtures.ts Updates shared task fixture documentation.
test/​conformance/​README.md Documents current conformance coverage.
skills/​mcpc/​SKILL.md Updates agent task guidance.
README.md Documents modern tasks.
docs/​REFERENCE.md Regenerates CLI reference output.
CLAUDE.md Records task architecture.
CHANGELOG.md Adds release notes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/bridge/index.ts
Comment thread src/bridge/index.ts
Comment thread src/core/mcp-client.ts
Comment thread src/lib/types.ts Outdated
Comment thread README.md Outdated
Comment thread skills/mcpc/SKILL.md Outdated
Comment thread src/cli/index.ts Outdated
- Unwrap a detached call's outcome for the x402 helpers: the payment-required
  check and the settlement receipt now see the tool result inside
  `{ result }`, so a challenge answered synchronously by a 2026-07-28 server
  is signed and retried instead of rendered
- `tasks-list` drops a tracked task only when the server answers `tasks/get`
  with -32602 (unknown task); a timeout or any other failure fails the
  listing instead of erasing the session's only record of the task
- Clamp the server's `pollIntervalMs` at five minutes as well as flooring it:
  Node coerces a timer over 2^31-1 ms to 1 ms, which would turn an oversized
  hint into a busy loop
- `isExtensionTask` decides on `ttlMs` alone; a modern task carrying a stray
  `ttl` passthrough field was misclassified as legacy
- Help, README and the agent skill say that `--detach` prints the task ID in
  human mode and the whole `Task` with `--json`

Refs #423

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXvpsSa4d6RkPP4FqhuDak

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants