← Back to MCPs
Database

PostgreSQL

Official PostgreSQL MCP server for read/write SQL queries, schema exploration, and table inspection.

by Model Context ProtocolRepository →Source →
Installnpx -y @modelcontextprotocol/server-postgres
The PostgreSQL MCP server is part of the official Model Context Protocol servers monorepo. It connects LLMs to PostgreSQL databases for read/write SQL queries, schema exploration, and table inspection. ## Capabilities - Execute read and write SQL queries - Explore database schema and table structures - Inspect indexes, constraints, and relationships - Support for parameterized queries - Connection pooling for concurrent access ## Usage ```json { "mcpServers": { "postgres": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-postgres"], "env": { "POSTGRES_CONNECTION_STRING": "postgresql://user:password@localhost:5432/dbname" } } } } ``` ## Security Notes - Use read-only connections when possible - Restrict database user permissions - Use environment variables for credentials, never hardcode