Skip to content

fix(client): follow repeated opaque cursors - #2736

Open
mikemikimike wants to merge 3 commits into
modelcontextprotocol:mainfrom
mikemikimike:fix/follow-repeated-cursors
Open

fix(client): follow repeated opaque cursors#2736
mikemikimike wants to merge 3 commits into
modelcontextprotocol:mainfrom
mikemikimike:fix/follow-repeated-cursors

Conversation

@mikemikimike

Copy link
Copy Markdown

Fixes #2735

Background

The automatic list pagination path treated repeated cursor values as a reason to stop. MCP cursors are opaque, so a conforming server may return the same cursor for multiple pages. Stopping on repetition silently returned an incomplete list.

Changes

  • Remove cursor-value deduplication from Client._listAllPages.
  • Continue requesting pages until the server omits nextCursor.
  • Retain the existing listMaxPages hard cap so non-terminating pagination still fails with ListPaginationExceeded.
  • Add a regression test covering repeated cursors and a patch changeset for @modelcontextprotocol/client.

Compatibility

This preserves the public pagination API and follows opaque cursor semantics. Servers that do not terminate pagination remain bounded by listMaxPages; only the prior silent truncation behavior changes.

Verification

  • pnpm install --frozen-lockfile — blocked by Windows EPERM while copying files from the pnpm store into node_modules.
  • pnpm install --frozen-lockfile --force — same Windows EPERM during dependency installation.
  • pnpm test:all and pnpm lint:all could not run because the locked dependency installation did not complete.
  • git diff --check — passed.

The focused Vitest and typecheck commands remain to be run in CI or another environment where the locked workspace dependencies can be installed.

@mikemikimike
mikemikimike requested a review from a team as a code owner August 29, 2026 01:34
@changeset-bot

changeset-bot Bot commented Aug 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 16a3e17

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/client Patch
@modelcontextprotocol/core Patch
@modelcontextprotocol/server Patch
@modelcontextprotocol/server-legacy Patch
@modelcontextprotocol/codemod Patch
@modelcontextprotocol/core-internal Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Aug 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@2736

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@2736

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@2736

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@2736

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@2736

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@2736

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@2736

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@2736

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@2736

commit: 16a3e17

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.

Client.listTools() silently drops pages when a server repeats a cursor

1 participant