PostgreSQL MCP Server

Popular
Databases
stdio
Featured

Enable your AI agent to inspect PostgreSQL database schemas, query tables, list indexes, and explore relationships — all with read-only access by default. The official PostgreSQL MCP server exposes database metadata as MCP resources and provides a safe query execution tool.

Quick Install

$ npx -y @modelcontextprotocol/server-postgres postgresql://user:pass@/mydb

Configuration by Client

{
  "mcpServers": {
    "server": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://user:pass@/mydb"
      ]
    }
  }
}

Need a different client? Use the Config Generator for Windsurf, Cline, Antigravity, and more.

Available Tools (1)

query

Exposed Resources

postgres://schemaspostgres://tables