Search DevTools

Jump to any tool or page

PostgreSQL MCP Server

Trending

Allows AI assistants to inspect database schemas, run safe read queries, analyze indexes, and explain query performance on PostgreSQL.

Anthropic / MCP Spec12,400 stars1,600 forksData & Databases
View source

Install

Terminal

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

mcp_config.json

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

Tools exposed2

query
Execute SQL queries against target database.
inspect_schema
Returns list of tables, columns, indexes, and primary keys.

Documentation

PostgreSQL MCP Server

Overview

Connect AI models directly to PostgreSQL to read schemas, execute optimized SQL queries, and generate data insights safely.

Installation

Add to mcp_config.json:

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

Sourced from the repository README.

More in Data & Databases