PostgreSQL MCP Server

Inspect PostgreSQL schemas and run read-only queries with the archived MCP reference server. Review its maintenance status before choosing it.

Local serverstdioTypeScriptMIT★ 63.0k

What is the PostgreSQL MCP Server?

This PostgreSQL MCP listing covers the archived Model Context Protocol reference implementation. It exposes table schemas as resources and a query tool that runs SQL in a read-only transaction. It is a reference example rather than a currently maintained PostgreSQL vendor integration.

Explore the schema and keep the query

A useful evaluation task is to identify the tables involved in a question, then run a small SELECT query. Keep the SQL, filters and row limit with the result. Connect with a database role whose permissions match the data you intend to expose.

Account for the archived status

The documented package is @modelcontextprotocol/server-postgres and accepts a database connection URL as an argument. The source now lives in the archived servers repository. Review a maintained alternative if you need ongoing fixes or deployment support; the presence of a published package alone does not establish current maintenance.

Setup and tool documentation. Explore related MCP servers.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
queryRun SQL in the reference server’s read-only transaction.

How to install the PostgreSQL MCP Server

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://READ_ONLY_USER:PASSWORD@HOST:5432/DATABASE"
      ]
    }
  }
}

Replace the connection URL with your own database credentials. Review the archived maintenance status before use.

Configuration

Node.js with npx and a PostgreSQL connection URL. This reference implementation is archived.

Example prompts to try

  • “Inspect this database schema and run a bounded SELECT query for the latest ten records.”

Frequently asked questions

Its source is in the archived Model Context Protocol servers repository.