← Claude MCP Servers Directory

🐘

PostgreSQL MCP Server

Community

About

The PostgreSQL MCP server allows AI assistants to query and manage PostgreSQL databases. Execute SQL queries, analyze database schemas, and perform database operations directly through natural language commands.

Features

  • Execute SQL queries
  • Inspect database schemas
  • List tables and columns
  • Create and modify tables
  • Insert, update, and delete data
  • Database performance analysis

Installation

Prerequisites

You'll need PostgreSQL connection details (host, database, username, password).

Using Claude Desktop

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

Using Cursor

{
  "postgres": {
    "command": "npx",
    "args": [
      "-y",
      "@modelcontextprotocol/server-postgres",
      "postgresql://user:password@localhost/dbname"
    ]
  }
}

How to Use

Once installed, you can ask your AI assistant to:

  • "Show me all tables in the database"
  • "Query users where age > 25"
  • "What's the schema for the orders table?"
  • "Count the number of active users"
  • "Create a new table for products"