@modelcontextprotocol/server-postgres
Anthropic's official reference MCP server for PostgreSQL databases. Gives agents read-only SQL query access to a Postgres database with automatic schema inspection.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Read-only by design is the primary security control. Use a dedicated read-only Postgres user. Connection string in env var (not args) is recommended. No row-level security enforcement from the MCP layer.
⚡ Reliability
Best When
Your agent needs to query a PostgreSQL database. Read-only by design — safe to use with production databases. Schema introspection built in so agents know table structure.
Avoid When
You need write operations (INSERT/UPDATE/DELETE), or your database isn't PostgreSQL.
Use Cases
- • Agents querying production databases to answer business questions
- • Data analysis tasks where agents run SQL and interpret results
- • Schema-aware data retrieval — agent sees table structures before writing queries
- • Debugging and monitoring workflows that need to check database state
- • Generating reports from database data without building custom API endpoints
Not For
- • Write operations — this server is read-only by design
- • MySQL, SQLite, or other databases (PostgreSQL-specific)
- • Databases requiring row-level security or column-level access control (no RLS support)
Interface
Authentication
PostgreSQL connection string via POSTGRES_CONNECTION_STRING environment variable or passed as argument. Standard postgres:// URI format. Use read-only database user for safety.
Pricing
MIT licensed, free. Requires Node.js runtime and a PostgreSQL database.
Agent Metadata
Known Gotchas
- ⚠ Read-only — no INSERT, UPDATE, DELETE. Agents expecting write access will fail.
- ⚠ Long-running queries block the MCP server — no query timeout configured by default
- ⚠ Connection pool is small by default — concurrent agent calls may queue
- ⚠ Schema changes require restarting the server to refresh schema cache
- ⚠ No prepared statement support — all queries are raw SQL strings (SQL injection risk if user input flows through)
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for @modelcontextprotocol/server-postgres.
Scores are editorial opinions as of 2026-03-06.