Hermolaos.Client.PubSubNotificationHandler (Hermolaos v0.3.0)
View SourceNotification handler that broadcasts events via Phoenix.PubSub or Registry.
This handler allows multiple processes to subscribe to MCP notifications.
Usage with Phoenix.PubSub
{:ok, conn} = Hermolaos.Client.Connection.start_link(
transport: :stdio,
command: "my-server",
notification_handler: {
Hermolaos.Client.PubSubNotificationHandler,
%{pubsub: MyApp.PubSub, topic: "mcp:events"}
}
)
# Subscribe in another process
Phoenix.PubSub.subscribe(MyApp.PubSub, "mcp:events")
receive do
{:mcp_notification, method, params} -> ...
endUsage with Registry
{:ok, conn} = Hermolaos.Client.Connection.start_link(
transport: :stdio,
command: "my-server",
notification_handler: {
Hermolaos.Client.PubSubNotificationHandler,
%{registry: MyApp.MCPRegistry, key: "mcp_events"}
}
)