Skip to content

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

Open
chr-hertel wants to merge 2 commits into
modelcontextprotocol:mainfrom
chr-hertel:fix-list-changed-capability
Open

chr-hertel wants to merge 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 from a82116e to d63ac96 Compare October 13, 2026 23:43

This branch has not been deployed

No deployments
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