PostgreSQL MCP Server
Enable your AI agent to inspect PostgreSQL database schemas, query tables, list indexes, and explore relationships 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@/mydbIn-Depth Setup Guide
Complete setup walkthrough & security best practices
Configuration by Client
{
"mcpServers": {
"postgres": {
"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)
Exposed Resources
PostgreSQL FAQ
What is the PostgreSQL MCP server?
Enable your AI agent to inspect PostgreSQL database schemas, query tables, list indexes, and explore relationships with read-only access by default. The official PostgreSQL MCP server exposes database metadata as MCP resources and provides a safe query execution tool.
How do I install the PostgreSQL MCP server?
Run: npx -y @modelcontextprotocol/server-postgres postgresql://user:pass@/mydb
Which AI clients support the PostgreSQL MCP server?
The PostgreSQL MCP server works with Claude Desktop, Cursor, Codex CLI, Antigravity, Windsurf, and any MCP-compatible client using stdio transport.
What tools does the PostgreSQL MCP server provide?
The server provides 1 tools: query.