LISTEN / NOTIFY instead of a separate bus.
When to use it
- The host already talks to Postgres with Npgsql or Dapper.
- Several MCP nodes wait on
ElicitAsyncand you want Postgres itself to wake the originating process.
DbContext. LISTEN / NOTIFY is the reason a native package sits beside EF.
Intended how-to
- Add
McpEssentials.PostgreSQLand an Npgsql data source. - Run the embedded table script (
EnsureCreatedAsyncor a host migration). OneMcpTaskstable, same canonical row as Core,DiscardAfter timestamptz. - Register the store as a singleton with the same current-user factory as Authenticated tasks.
CreateTaskAsyncawaitsINSERT ... RETURNINGinside a transaction so a later get on any node can see the row.
Events
ElicitAsync subscribes and raises InputResponseReceived locally. Payload is task id plus request id.
TTL
DELETE WHERE "DiscardAfter" < now(), from pg_cron or a hosted service that calls SweepExpiredAsync. DiscardAfter is CreatedAt + 2×TimeToLive, stamped at write.
See Stores.