Project story

AWS Labs: keeping a PostgreSQL pool on the serving loop

Startup validation succeeded, but the first query could still fail.

What broke

The PostgreSQL MCP server initialized its wire-protocol pool and lock during a temporary event loop. Startup then closed that loop. The first tool call ran on a different loop and could fail while trying to reuse the pool.

How I tested it

I exercised startup, lifespan validation and the first query with a fake wire pool. Separate tests covered shutdown when closing a connection failed or stalled. The PR records 2,501 passing tests in the server package.

What the maintainer merged

On November 9, 2026, kennthhz merged the change that moves wire-protocol validation into the server lifespan. Pool creation, queries and cleanup now share the serving loop.