Skip to content
MCP-Bridge
DatabasesDatabase CredentialsOfficial MCP

PostgreSQL (MCP) MCP Server

Query and manage PostgreSQL databases directly from your AI agent. Read schemas, run queries, and manage data.

Quick Setup

Transport: STDIO

Command: npx -y @modelcontextprotocol/server-postgres

Environment Variables

DATABASE_URL

Example: postgresql://user:pass@host:5432/db

MCP Server Configuration

Add this to your claude_desktop_config.json or Cursor MCP settings.

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y","@modelcontextprotocol/server-postgres"],
      "env": {
      "DATABASE_URL": "postgresql://user:pass@host:5432/db"
}
    }
  }
}

Endpoints

POST/query

Execute SQL query

GET/schema

Get database schema