Postgres MCP

open sourcestdio

Give AI agents read access to any PostgreSQL database via natural language

Updated 2026-02-15

DatabaseFree· Open source, self-hosted. Requires a running PostgreSQL instance.GitHubDocs

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/mydb

Runtime: node

Tools (1)

query

Run 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.

Take the quiz

Machine-Readable

This MCP is available as structured JSON via the API.

GET /api/v1/mcps/postgres