In the MCP protocol version 2026-07-28 there are no sessions, so a client that wants to receive notifications opens a long lived subscriptions/listen request. The request lists which notifications the client is interested in: tools, prompts and resources list changes, and updates of specific resource URIs. The server acknowledges the subscription and keeps the stream open, sending every matching notification until the client cancels it or the server closes it.
The server handles subscriptions/listen automatically, you only have to send the notifications. Legacy clients (2025-11-25 and older) keep receiving notifications through their session as before.
subscriptions/listen method. By default True. When False, the server answers -32601.
The acknowledgement only contains the notification types the server can deliver. Resource subscriptions are honored only when the server has resources registered.
Use the same methods as in the legacy era. Every method sends the notification to the legacy sessions and also to every open subscription that asked for it, tagged with its subscription id:
notifications/tools/list_changed.notifications/prompts/list_changed.notifications/resources/list_changed.notifications/resources/updated to the subscriptions that include that URI.
// a new tool is registered at runtime: notify every listener
MCPServer.Tools.AddTool('get_forecast', 'Returns the weather forecast');
MCPServer.SendNotificationToolsListChanged;
// a resource content has changed
MCPServer.SendNotificationResourcesUpdated('file:///readme.txt');
Before stopping the server, call CloseSubscriptions. Every open subscriptions/listen stream receives its final response and is closed gracefully, so the clients know the stream ended on purpose and do not treat it as a network failure. The method waits up to 3 seconds for the streams to finish. The component destructor calls it too.
procedure TMainForm.btnStopClick(Sender: TObject);
begin
MCPServer.CloseSubscriptions;
MCPServer.Server.Active := False;
end;
Over HTTP/1.x each subscription keeps its HTTP connection open while it is active. The number of open subscriptions is available in the read only property ListenersCount, and NotifySubscriptions(aMethod, aUri) sends a notification to every subscription that watches it; aUri is only used by notifications/resources/updated.
MemoLog.Lines.Add('open subscriptions: ' + IntToStr(MCPServer.ListenersCount));
MCPServer.NotifySubscriptions('notifications/resources/updated',
'file:///readme.txt');