Skip to content

fix(server): debounce list changed notifications#1983

Open
Genmin wants to merge 5 commits intomodelcontextprotocol:mainfrom
Genmin:fix/debounce-list-changed-notifications
Open

fix(server): debounce list changed notifications#1983
Genmin wants to merge 5 commits intomodelcontextprotocol:mainfrom
Genmin:fix/debounce-list-changed-notifications

Conversation

@Genmin
Copy link
Copy Markdown

@Genmin Genmin commented Apr 29, 2026

Summary

Fixes #842.

McpServer now enables the existing protocol-level debouncer for the three simple list-changed notifications emitted by dynamic resources, tools, and prompts. Rapid synchronous registrations still send a refresh signal to clients, but coalesce into one notification per method per tick instead of queuing one transport write per registration.

This targets the backpressure/listener-warning path without adding a new bulk registration API or changing notifications that carry params or request/task routing metadata.

Validation

  • pnpm --filter @modelcontextprotocol/server test -- test/integration/test/server/mcp.test.ts -t "debounce synchronous tool list changed"
  • pnpm --filter @modelcontextprotocol/server typecheck
  • pnpm --filter @modelcontextprotocol/server lint
  • pre-push hook: typecheck:all, build:all, lint:all

@Genmin Genmin requested a review from a team as a code owner April 29, 2026 23:28
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 29, 2026

🦋 Changeset detected

Latest commit: a89aa4f

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

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/server Patch
@modelcontextprotocol/test-integration Patch
@modelcontextprotocol/express Patch
@modelcontextprotocol/fastify Patch
@modelcontextprotocol/hono Patch
@modelcontextprotocol/node 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
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 29, 2026

Open in StackBlitz

@modelcontextprotocol/client

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

@modelcontextprotocol/server

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

@modelcontextprotocol/express

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

@modelcontextprotocol/fastify

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

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: a89aa4f

@Genmin
Copy link
Copy Markdown
Author

Genmin commented Apr 30, 2026

Added the missing patch changeset for the touched server/integration packages. The previous red test was isolated to the unrelated Miniflare Cloudflare Worker Network connection lost failure, so this should at least clear the release-metadata blocker and trigger a fresh run.

@Genmin Genmin force-pushed the fix/debounce-list-changed-notifications branch from 88c8e5e to 30d4ff1 Compare April 30, 2026 16:20
@Genmin
Copy link
Copy Markdown
Author

Genmin commented Apr 30, 2026

Pushed one more empty retry after inspecting the latest red job. It is still isolated to test/server/cloudflareWorkers.test.ts on Node 22 with Miniflare Error: Network connection lost; the PR-specific checks and the adjacent integration tests are passing. No code changed in this retry.

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.

Bulk tool registration causes EventEmitter memory leak warnings

1 participant