Labsco
MCP SERVER

MCP Postgres Secure

by pugltd

Explore a PostgreSQL database and run SELECT, WITH, EXPLAIN and SHOW — with writes absent from the tool surface rather than blocked by convention.

Relational SQL DatabasesVerified
Summary
Read-only enforced by omission is stronger than read-only enforced by a flag, because there is no configuration that turns it back on.

Plenty of database servers offer a read-only mode. A mode is a setting, and settings get changed by whoever is trying to make something work at the time. Here the write path does not exist in the tool list at all, and the query tool names the four statement types it accepts. That is a meaningful difference when the caller is a model that will, eventually, try to fix a problem by writing to the database. The three introspection tools are what make the read side actually usable — an agent that can read the schema writes a query that runs, and one that cannot writes a query about columns it imagined.

What it is

A read-only PostgreSQL client with five tools: connect, query, and three that describe the database — schemas, tables and a single table's structure.

What you get
  • query accepts SELECT, WITH, EXPLAIN and SHOW, and nothing else — there is no write tool to disable.
  • list_schemas, list_tables and describe_table give an agent the structure it needs to write a correct query instead of guessing at column names.
  • connect_db is documented as being for the case where no default connection exists, so the normal path is configured rather than passed per call.
Requirements

A PostgreSQL connection, normally configured as the default rather than supplied per call.

Setup effort

One command plus a key — npx mcp-postgres-secure --access-mode readonly, then supply credentials