Labsco
MCP SERVER

MCP Postgres Query Server

by RathodDarshil

Ask questions of a Postgres database in plain English and have read-only SQL run against it.

Relational SQL Databases
Summary
A read-only window onto a live database.

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.

What it is

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.

What you get
  • 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
Requirements

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.