CodexSpot
P

PostgreSQL MCP Server

Provides read-only access to PostgreSQL databases through MCP, enabling AI assistants to query data, inspect schemas, and analyze database structures.

stdioLocalNo Authnpm

What This Server Exposes

Tools

querylist_tablesdescribe_table

Resources

  • table schemas
  • query results

Setup Instructions

  1. 1Ensure you have a running PostgreSQL database
  2. 2Add the PostgreSQL server config to your Claude Desktop configuration
  3. 3Set the DATABASE_URL environment variable with your connection string
  4. 4Restart Claude Desktop

Configuration

Claude Desktop Configuration

claude_desktop_config.json
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres"
      ],
      "env": {
        "DATABASE_URL": "postgresql://user:pass@localhost:5432/dbname"
      }
    }
  }
}

Environment Variables

DATABASE_URL
PostgreSQL connection string
Required🔒 Secret

Server Manifest

No official server.json manifest found. Generate one with our MCP server.json Generator →

Compatibility

Claude DesktopClaude Code

Safety Notes

This server connects to your PostgreSQL database. Use a read-only database user with minimal permissions. Never expose production databases with write access to AI assistants.

This listing is for informational purposes only. CodexSpot is not affiliated with PostgreSQL MCP Server.