Skip to content

[Server] Announce listChanged only where list changes are delivered - #593

Merged
chr-hertel merged 2 commits into
modelcontextprotocol:mainfrom
chr-hertel:fix-list-changed-capability
Oct 14, 2026
Merged

chr-hertel merged 2 commits into
modelcontextprotocol:mainfrom
chr-hertel:fix-list-changed-capability

Conversation

@chr-hertel

Copy link
Copy Markdown
Member

The server announced listChanged whenever an event dispatcher was set, but list changes only reach clients through subscriptions/listen. Handshake-era clients never got them, and neither did anyone without a notification bus.

  • initialize no longer carries listChanged (new ServerCapabilities::withoutListChanged())
  • Detected capabilities announce listChanged only with a notification bus and the built-in registry
  • Capabilities set with setCapabilities() still keep it on server/discover

Fixes chr-hertel#76

🤖 Generated with Claude Code

@chr-hertel
chr-hertel requested a review from Nyholm as a code owner October 13, 2026 22:38
@chr-hertel chr-hertel added this to the 0.9.0 milestone Oct 13, 2026
@chr-hertel chr-hertel added bug Something isn't working Server Issues & PRs related to the Server component labels Oct 13, 2026
@chr-hertel
chr-hertel requested a balanced review from Copilot October 13, 2026 22:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The key listChanged-only edge case lacks direct coverage, and the builder documentation ambiguously reverses the registry condition.

2 open findings
What changed in this PR

Corrects listChanged capability advertisement to match actual notification delivery paths.

Changes:

  • Removes listChanged from handshake initialization.
  • Limits automatic advertisement to notification buses using the built-in registry.
  • Adds regression tests and changelog documentation.
File Description
src/​Schema/​ServerCapabilities.php Adds capability transformation for handshake responses.
src/​Server/​Handler/​Request/​InitializeHandler.php Strips list-change flags during initialization.
src/​Server/​Builder.php Refines automatic capability detection.
tests/​Unit/​Server/​BuilderTest.php Tests builder detection conditions.
tests/​Unit/​Server/​Handler/​Request/​InitializeHandlerTest.php Tests handshake capability filtering.
tests/​Unit/​Server/​Stateless/​StatelessProtocolTest.php Tests modern discovery advertisement.
CHANGELOG.md Records the corrected behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Schema/ServerCapabilities.php
Comment thread src/Server/Builder.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation matches the reported delivery constraints and provides focused regression coverage.

0 open findings

2 resolved since last review

🧠 Review effort: Balanced

@chr-hertel
chr-hertel force-pushed the fix-list-changed-capability branch 2 times, most recently from d63ac96 to 39564a7 Compare October 14, 2026 22:56
@chr-hertel
chr-hertel force-pushed the fix-list-changed-capability branch from 39564a7 to 14a10e5 Compare October 14, 2026 23:06
@chr-hertel
chr-hertel merged commit 3e91489 into modelcontextprotocol:main Oct 14, 2026
28 checks passed
@chr-hertel
chr-hertel deleted the fix-list-changed-capability branch October 14, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Server Issues & PRs related to the Server component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Server] listChanged is announced to handshake-era clients that never get the notifications

2 participants