Read-only SQL access to Postgres — let your assistant inspect schemas and answer questions from real data.
The PostgreSQL MCP server does one thing with sensible restraint: it lets an AI assistant query a Postgres database read-only. Point it at a connection string and your assistant can list tables, inspect column types, and run SELECT statements — which turns "can you check how many users signed up last week?" from a Slack message to your data person into a ten-second answer.
The read-only design is the feature, not a limitation. Every query runs inside a transaction that gets rolled back, so even a hallucinated UPDATE can't do damage. That makes it one of the few database tools you can reasonably point at a production replica without sweating. (Point it at a replica, not the primary, all the same — a runaway analytical query can still hog resources.)
Where it shines is exploratory work. Schema archaeology on an inherited codebase — "which tables reference orders, and what's actually in order_metadata?" — becomes conversational. So does ad-hoc analytics: the assistant writes better SQL than most humans when it can first read the real schema instead of guessing at column names.
Like the other Anthropic reference servers, it now lives in the archived repository, so expect stability rather than new features. Community successors (like Crystal DBA's postgres-mcp, which adds index tuning and health checks) pick up where it stops. For straightforward read-only querying, the reference server remains the simplest thing that works — and simplicity is exactly what you want between a language model and your database.
CONNECT and SELECT grants instead of reusing an application user.LIMIT while it's still exploring.pg_stat_user_indexes and friends with no extra tooling.Ask questions in English; the assistant reads the schema and writes correct SQL against real column names.
Understand an unfamiliar database — relationships, types, conventions — without opening a GUI client.
Check what's actually stored for a user or order while diagnosing a bug, straight from your editor.
| Tool | What it does |
|---|---|
| query | Run a read-only SQL query; results return as JSON |
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://user:password@localhost:5432/mydb"
]
}
}
}The connection string is passed as an argument — use a read-only role and a replica where possible.
Node.js 18+ and a reachable Postgres instance. Strongly recommended: a dedicated read-only database role.
Manage your whole Supabase project in conversation — database, auth, storage, Edge Functions and branches.
Query, modify and analyse local SQLite databases in conversation — the fastest way to chat with a data file.
Metabase ships its own MCP endpoint — search your BI content, build and run queries, and save questions and dashboards without leaving the chat.
Official MongoDB server covering data, schemas and Atlas management — from find queries to spinning up clusters.
Serverless Postgres with database branching — point your assistant at Neon and let it work on disposable copies.
Official Redis server — search keys, inspect data structures and manage caches in natural language.