Skip to content

fix: resources/list pagination + replay tolerance for protocol drift (MCP 2.0 prep) - #254

Merged
steipete merged 2 commits into
mainfrom
steipete/mcp2-prep
Aug 2, 2026
Merged

fix: resources/list pagination + replay tolerance for protocol drift (MCP 2.0 prep)#254
steipete merged 2 commits into
mainfrom
steipete/mcp2-prep

Conversation

@steipete

@steipete steipete commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Preparation for the MCP 2026-07-28 ("MCP 2.0") migration. Two independent fixes on the current SDK v1 line:

  • resources/list pagination: the runtime now follows nextCursor and aggregates all pages (bounded at 100), matching what tools/list already did. Callers passing an explicit cursor still get single-page behavior.
  • Replay tolerance: replay recordings no longer break when the negotiated protocolVersion, client capabilities, or mcporter clientInfo drift from what was recorded. initialize frames are matched on structure, and the recorded initialize result is adapted to the version the live client requested (SDK v1.30 rejects unknown initialize-result versions). This keeps every existing recording usable across the upcoming SDK v2 bump.

Both covered by focused regression tests (pagination aggregate/explicit-cursor/cap; replay across a synthetic 2099-01-01 recording). Full suite: 908 passed. Autoreview clean.

Part 1 of the MCP 2.0 series; next: SDK v2 migration with dual-era negotiation.

🤖 Generated with Claude Code

@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix: resources/list pagination + replay tolerance for protocol drift (MCP 2.0 prep) This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit 89fde9d into main Aug 2, 2026
5 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99a483231c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/runtime.ts
Comment on lines +352 to +353
for (let page = 1; page < MAX_RESOURCE_LIST_PAGES && response.nextCursor; page += 1) {
response = await client.listResources({ ...requestParams, cursor: response.nextCursor });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve old replay recordings when auto-paging resources

When replaying a recording captured before this change, a resources/list response may include nextCursor even though the old runtime stopped after that first page and therefore recorded no second resources/list request. This loop now immediately sends the cursor request against ReplayTransport, which has no corresponding recorded send/recv and throws a replay mismatch instead of returning the recorded result; gate auto-pagination in replay mode or make replay tolerate missing follow-up pages so existing paginated resource recordings remain usable.

Useful? React with 👍 / 👎.

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.

1 participant