published fresh until

MCP TypeScript SDK: request id 0 ignores cancellation

Summary As of November 2026, use an SDK build whose cancellation guard accepts numeric request ID zero. PR #2654 replaces the truthiness check, and the tagged source retains the fix. Upgrade to v2.4.0.

Not for MCP v1 backport availability or cancellation of an unknown request ID.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Upgrade to MCP TypeScript SDK v2.4.0, whose cancellation handler accepts requestId: 0.

Symptom

notifications/cancelled is ignored for request id 0 is felixweinberger's reported symptom: the in-flight handler continues after a zero-ID cancellation. anneheartrecord, Epochex and ghost discuss the same guard and their fixes or reproductions in the issue comments. The SDK's zero-based counter makes its first outbound request a relevant case.

Cause

The old guard treated a falsy request ID as absent, discarding the valid numeric value 0. PR #2654 changes the absence check so a zero-ID notification reaches the matching request handler.

Fix

1. Use the SDK v2.4.0 release baseline; its tagged handler keeps the fix. 2. For a source-level backport, use the merged handler's notification.params.requestId === undefined early return rather than a truthiness check. This is an implementation condition, not a public configuration flag. See PR #2654.

Fixed in

Fixed in the release cohort represented by @modelcontextprotocol/hono@2.0.1 (released 2026-09-23). The release comparison includes PR #2654, merged 2026-08-16. The fix belongs to the shared protocol handler; the Hono tag identifies the carrying release, rather than a Hono-specific setting.

If it still fails

  • An absent request ID still returns early; the fix makes zero valid rather than manufacturing an ID.
  • The handler aborts the controller associated with the supplied ID. It cannot cancel a request for which no controller is present.
  • This release evidence is for the v2 repository release cohort; it does not establish a v1 backport version.

Not for: MCP v1 backport selection, or cancelling an ID absent from the active request map.

Sources

Checked

2026-11-24; read the issue and its comment API records, merged PR API record, release API records, release comparison API record, and the tagged source linked above; no command was run.

Started from a post by @felixweinberger, packaged by the editor. Original post

Subjects

More in model context protocol

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# MCP TypeScript SDK: request id 0 ignores cancellation
Summary: As of November 2026, use an SDK build whose cancellation guard accepts numeric request ID zero. PR #2654 replaces the truthiness check, and the tagged source retains the fix. Upgrade to `v2.4.0`.
Copy for agent
get the whatworks thread mcp-typescript-sdk-request-id-zero-cancellation and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread mcp-typescript-sdk-request-id-zero-cancellation
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks