PostgreSQL MCP Server
PostgreSQL MCP server - query, schema introspection, explain, and health checks for AI assistants
not scanned yet
6 stars5.8k downloads/wk
Reviews
Write oneNobody has reviewed PostgreSQL MCP Server yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
PostgreSQL MCP Server tools
No tool declarations could be read from the package source. They show once the server is installed.
How PostgreSQL MCP Server compares
Against every graded Databases MCP server, from our own scans and uptime checks. Updated after each scan run.
- Safety score
- 83/100
- higher than 60% of 802 Databases servers
- GitHub stars
- 6
- more than 75% of 602 Databases servers
- Downloads a week
- 5,823
- more than 95% of 328 Databases servers with a package
Release history: 7 versions in the registry since 2026-09-14, latest 2026-10-31, typically one every 6 days.
Install PostgreSQL MCP Server in Claude Code, Cursor or VS Code
Runs npx -y @yawlabs/postgres-mcp on your machine. Read the scan report first; the gateway never runs local packages.
claude mcp add postgres-mcp -- npx -y @yawlabs/postgres-mcp
What the publisher says
From the PostgreSQL MCP Server repository's README, as published. We do not edit it. Read it on GitHub
@yawlabs/postgres-mcp
Query a PostgreSQL database from Claude Code, Cursor, and any MCP client. Read-only by default - writes opt in via a single env var - so an agent can't silently drop your tables.
Built and maintained by Yaw Labs.
One click adds this to your local Yaw MCP config so it's available in every Yaw Terminal session. Or install manually below.
What's new in 0.12
An index advisor, opt-in audit logging, structured tool output, and support for current-revision MCP clients. Full detail in the CHANGELOG.
- pgindexadvisor recommends indexes for a workload and keeps only the ones that measurably lower estimated cost. Candidates are costed with HypoPG hypothetical indexes, never created on disk, and the search knows that PostgreSQL 18's skip scan changes which multi-column indexes are useful.
- Opt-in audit logging of the SQL tools send: one JSON line per audited statement, to stderr or a file. Bound parameter values are never recorded. Off by default, and not a complete record -- see Audit logging.
- Structured tool output. Every tool declares an outputSchema and returns structuredContent alongside the unchanged text block, so anything reading the text today keeps working.
- Both MCP protocol eras. The server used to speak only the legacy (2025) protocol revisions, which a client on the current 2026-07-28 revision fails against. It now serves both.
On 0.12.0? Upgrade. 0.12.1 closes a stacked-query hole in pgindexadvisor: SQL passed in its statements argument ran on a protocol that accepts several commands in one string, so SELECT 1; COMMIT; DROP SCHEMA public CASCADE; escaped the read-only transaction. The tool is annotated read-only, so hosts often auto-allow it. The same release stops pginspectlocks attributing a lock held in another database to whichever local table shares its OID, fixes the advisor's greedy search, and makes audit lines carry the tool field they were missing.
Coming from 0.10.x? 0.11.0 has three breaking changes: pgseqscantables, pgunusedindexes and pgtopqueries return an envelope (read data.rows where you used to read data), pgexplain with analyze: true emits BUFFERS (pass buffers: false for the old output), and Node 22 is the floor. Details in the 0.11.0 changelog entry.
Backstory
Anthropic's reference Postgres MCP server, @modelcontextprotocol/server-postgres, was archived in May 2025 and marked deprecated on npm in July 2025. Anthropic has not shipped a replacement. Despite the deprecation, the last published version (v0.6.2) is still pulled ~20,000 times per week - a lot of agents are pointed at an unmaintained package.
That unmaintained package also has a known, publicly documented stacked-query SQL injection (Datadog Security Labs) that bypasses its BEGIN READ ONLY wrapper with input like COMMIT; DROP SCHEMA public CASCADE;. It has never been patched at npm.
A handful of community forks have appeared, but each fills a narrow slice:
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
PostgreSQL MCP Server: common questions
- Is PostgreSQL MCP Server safe?
- Mostly: it is graded B (83/100). Read the PostgreSQL MCP Server safety report
- How do I install PostgreSQL MCP Server?
- It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
- Does PostgreSQL MCP Server need an API key?
- Not as far as the registry entry and our scan can tell: no credentials are declared or required.
- Is PostgreSQL MCP Server maintained?
- The last commit was 35 days ago (2026-09-30). The latest release is v0.13.10.
- What can I use instead of PostgreSQL MCP Server?
- Servers from other publishers that do the same job: DB Explorer MCP server, Postgres MCP server and NeoSQL MCP server. Compare all PostgreSQL MCP Server alternatives.
- How does PostgreSQL MCP Server compare with other Databases MCP servers?
- safety score 83/100 (higher than 60% of 802 Databases servers); github stars 6 (more than 75% of 602 Databases servers); downloads a week 5,823 (more than 95% of 328 Databases servers with a package). Full comparison.
Alternatives to PostgreSQL MCP Server
Same job from other publishers: the closest match first, then the best rated.
- DB ExplorerRead-only SQL for PostgreSQL, MySQL and SQLite: schema, safe SELECTs, EXPLAIN, index advicenot reviewedGrowingB
- PostgresEnterprise PostgreSQL MCP server with NL queries, hybrid search (pgvector+BM25), and web UInot reviewedGrowingA
NeoSQL MCPSchemas, SQL, ERDs, and codegen for PostgreSQL, MySQL, Oracle, SQLite, and more via NeoSQL Desktop.not reviewedGrowingA- rowstileCheck, test, prove and review a rowstile policy: access rules for Postgres row-level securitynot reviewedGrowingA
- DBHubToken-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLitenot reviewedWidely usedA