-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Create a distinct McpServer/Server instance per transport to avoid unintended backflow of data to the wrong client (see modelcontextprotocol/typescript-sdk#820). While the scenario of mapping request➡️response
to the proper client is patched in recent versions of the SDK, there still remains areas within the Protocol class that communicate exclusively with the last-connected transport (which may not be the proper transport).
To avoid sending notifications and more to the wrong client, create a distinct McpServer/Server instance per transport, and consider using the sendNotification method exposed to tool callbacks. While arguably less efficient than a single 1:n McpServer architecture, the 1:1 approach should guarantee that only the intended recipient is ever contacted.