Postgres MCP
open sourcestdioGive AI agents read access to any PostgreSQL database via natural language
Updated 2026-02-15
An official MCP server that connects AI agents directly to a PostgreSQL database. Agents can list tables, inspect schemas, and run read-only SQL queries, enabling agents to answer data questions without a separate data pipeline.
Install
npx -y @modelcontextprotocol/server-postgres postgresql://localhost/mydbRuntime: node
Tools (1)
queryRun a read-only SQL query against the PostgreSQL database
sql
Use Cases
- ·Let agents query your database to answer business questions
- ·Enable agents to inspect schema when writing migration scripts
- ·Build data-driven agents that pull live records for decision-making
- ·Allow agents to audit data quality without write access risk
Key Points
- •Read-only by design, agents cannot mutate data
- •Exposes schema and table info as resources for agent inspection
- •Works with any PostgreSQL connection string
- •Official Anthropic-maintained server
Do-Nothing Score
Find out how close you are to Ghost CEO.