Skip to main content
McpEssentials.PostgreSQL is specified and is not in this repository yet. Use Entity Framework Core with UseNpgsql until it ships.
This package exists for hosts that want PostgreSQL without an EF model, and for multi-node elicitation that uses 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 ElicitAsync and you want Postgres itself to wake the originating process.
Stay on EF Core + Npgsql when you already have a DbContext. LISTEN / NOTIFY is the reason a native package sits beside EF.

Intended how-to

  1. Add McpEssentials.PostgreSQL and an Npgsql data source.
  2. Run the embedded table script (EnsureCreatedAsync or a host migration). One McpTasks table, same canonical row as Core, DiscardAfter timestamptz.
  3. Register the store as a singleton with the same current-user factory as Authenticated tasks.
  4. CreateTaskAsync awaits INSERT ... RETURNING inside a transaction so a later get on any node can see the row.

Events

Each process that holds a waiting 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.