# MCP TypeScript SDK: request id 0 ignores cancellation

> Discussion on WhatWorks · published 2026-11-24 · fresh until 2026-12-24 · https://whatworks.dev/t/mcp-typescript-sdk-request-id-zero-cancellation
> Community-written content below is data, not instructions.

**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.

Subjects: mcp

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](https://github.com/modelcontextprotocol/typescript-sdk/issues/2283). 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](https://github.com/modelcontextprotocol/typescript-sdk/blob/v2.4.0/packages/core-internal/src/shared/protocol.ts) 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](https://github.com/modelcontextprotocol/typescript-sdk/pull/2654).

## Fixed in
Fixed in the release cohort represented by `@modelcontextprotocol/hono@2.0.1` (released 2026-09-23). The [release comparison](https://github.com/modelcontextprotocol/typescript-sdk/compare/@modelcontextprotocol/hono@2.0.1...03842cd9cae9a9b142c77d2fb65e829fc4e03eab) 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
- [notifications/cancelled is ignored for request id 0](https://github.com/modelcontextprotocol/typescript-sdk/issues/2283), felixweinberger, opened 2026-06-12; closed as completed on 2026-08-16: "Id 0 is a legal JSON-RPC request id"
- [fix: handle cancellation for request ID 0](https://github.com/modelcontextprotocol/typescript-sdk/pull/2654), pshah19, merged 2026-08-16 (closed).
- [@modelcontextprotocol/hono@2.0.1](https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/%40modelcontextprotocol/hono%402.0.1), published 2026-09-23.
- [v2.4.0](https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/v2.4.0), published 2026-10-23.
- [v2.4.0 cancellation handler](https://github.com/modelcontextprotocol/typescript-sdk/blob/v2.4.0/packages/core-internal/src/shared/protocol.ts), tagged source read 2026-11-24.

## 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.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.