PostgreSQL
Summary
Read-only PostgreSQL access with automatic schema inspection — the reference MCP server for Postgres.
Features
- Read-only SQL access to any PostgreSQL database
- Automatic schema inspection for every table
- Single-argument setup with a connection string
Installation
Set up this MCP server in your favorite AI agent — copy a ready-made configuration below.
Description
The reference PostgreSQL MCP server gives an assistant read-only access to a database, along with the schema information it needs to write correct queries.
What it does
- Read-only query execution. Every statement runs inside a read-only transaction, so an assistant cannot modify data even if it decides to try.
- Schema resources. Each table is exposed as a resource with its column names and types, so the model works from the actual schema rather than inferring one from table names.
Why the read-only constraint is the point
Giving a language model write access to a production database is a decision that deserves more thought than a config file entry. This server removes the question entirely, which makes it a sensible default for analysis, debugging, and answering questions about data.
Setup
One argument — the connection string — and you are running: npx -y @modelcontextprotocol/server-postgres postgresql://host/db. For write access or broader database support, DBHub and vendor-specific servers are better choices.
Part of the MCP reference server collection, now maintained in the archived servers repository.
Related MCP Servers
DBHub
by Bytebase
A universal database MCP server — one integration for PostgreSQL, MySQL, SQL Server, SQLite, and MariaDB.
MongoDB
by MongoDB
MongoDB's official MCP server — query databases, explore schemas, and manage Atlas clusters from an AI client.
Upstash Redis
by Upstash
Run Redis commands against Upstash's serverless Redis over HTTP, with documentation search built in.
dbt
by dbt Labs
dbt Labs' official MCP server — explore project metadata, run dbt commands, and query the Semantic Layer.