PostgreSQL

Runs read-only SQL against a Postgres database and returns the schema alongside results, which is what makes it usable without pasting table definitions into the prompt.

Official Archived — not recommended for new projects TypeScript stdio

Archived upstream. This server still works, but it receives no fixes. Use it to understand an existing setup, not to start a new one.

What it does

Runs read-only SQL against a Postgres database and returns the schema alongside results, which is what makes it usable without pasting table definitions into the prompt. Point it at a replica or a read-only role; the server assumes you have already handled access control.

Install

Terminal
npx -y @modelcontextprotocol/server-postgres postgresql://localhost/mydb

Client configuration

Paste this into your MCP client config (Claude Desktop, Cursor, or any client that reads mcpServers), then restart the client.

mcp.json
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://localhost/mydb"
      ]
    }
  }
}

When to use it

Reach for this when the task needs database inside the agent loop. Skip it if a plain shell command or a one-off script is enough — every server you add costs context and adds a failure mode.

Other TypeScript servers

  • Filesystem — Gives an agent scoped read, write, and search access to directories you explicitly allow
  • Memory — A persistent knowledge graph stored in a local JSON file, exposed through entities, relations, and observations
  • Sequential Thinking — Gives the model a scratchpad for structured, revisable reasoning: numbered thoughts that can branch, revise, and conclude