The validation and the timeout are the whole design: an agent can explore real data and answer questions from it with no path to writing, and no runaway query holding a connection open.
An MCP server with one tool that runs SELECT queries against a PostgreSQL database. The connection string is passed on the command line when the client launches it, queries are validated so that only SELECT gets through, and anything still running after 10 seconds is cut off.
- A SELECT query executed against your database, with its rows returned
- Statements other than SELECT rejected before they reach the database
- A 10 second timeout on every query
Node.js v14 or later, and a PostgreSQL connection string passed as an argument in the client config - it sits in that file in plain text, so point it at a role that only has read access. Build once with npm run build; the client then launches dist/index.js.
