Skip to content

fix: share server list-change forwarding across AppBridge views - #818

Open
March-7 wants to merge 1 commit into
modelcontextprotocol:mainfrom
March-7:codex/round101-shared-client-notifications
Open

March-7 wants to merge 1 commit into
modelcontextprotocol:mainfrom
March-7:codex/round101-shared-client-notifications

Conversation

@March-7

@March-7 March-7 commented Oct 22, 2026

Copy link
Copy Markdown

When multiple AppBridge views share one MCP Client, each connection replaces the client's tools/resources/prompts list-change handlers. Earlier views stop receiving updates, and closing the newest view leaves forwarding pointed at a closed connection.

Share one dispatcher per client and notification method. Forward only to Apps-ready views, and remove each bridge's subscription on local or remote disconnect and failed connection setup. Reconnecting a bridge does not duplicate subscriptions or replace the user's onclose callback.

Automatic forwarding still owns the single-handler slots on first use and replaces any pre-existing handlers. If a caller later replaces a slot, bridge joins, closes and reconnects leave that handler in place; automatic forwarding for that method stays superseded. Empty dispatcher sets are retained to avoid removing or reinstalling a caller-owned handler. Hosts needing custom forwarding can continue to pass null as the client.

Validation:

  • Same 10 new transport-level regressions: 10 fail on base, 10 pass with this patch. Covers all three methods, shared/separate clients, close order, handshake readiness, connection failures, reconnects and later caller handlers.
  • All 255 SDK tests pass across all 9 SDK test files, including published-v1 interop. The unchanged independent observation script improves from 13/20 to 20/20 checks.
  • tsc --noEmit passes with the repository's full tsconfig, including the new regression tests, React sources and documentation examples. The unchanged build.bun.ts completes declaration emission and all six JavaScript bundle entry points.
  • Prettier 3.7.4 checks both changed files successfully. Bun 1.3.10, TypeScript 5.9.3 and the other checked tool/SDK/type packages (17 packages in total) match their corresponding upstream lockfile versions and integrity values; local Node is 24.19.0 on macOS arm64.
  • Example-server suites, browser E2E, cross-platform CI and the schema/snippet-generation steps of npm run build were not run.

AI assistance: OpenAI Codex generated the implementation, tests and this description. This disclosure does not claim independent human review.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant