AccuroAI
Book a demo

Resources / MCP Server Risk Directory / PostgreSQL MCP Server (reference)

Is the PostgreSQL MCP Server (reference) safe? Risks, permissions and safe setup

Developers who want an assistant to read schemas and run ad hoc SELECT queries against a local or staging Postgres. Here is what an AI agent can do through it, its published vulnerabilities and how to set it up safely.

Baseline risk

25Medium
  • Capabilities: 15 of 40
  • Read-plus-exfiltrate: no
  • Hidden instructions (publicly verified): none known
  • Third-party publisher: +10

Before your own factors: version pinning, number of users and policy coverage. How we score

Maker
Model Context Protocol project (Anthropic)
Publisher
Archived reference server
Runs
Local (runs on the device)
Transport
stdio
Authentication
PostgreSQL connection URL passed on the command line (credentials can be embedded in the URL); runs with local process permissions
Tools
1
Built-in limits
No flags; every query is wrapped in a READ ONLY transaction (the only guard)
License
MIT
Source
github.com/modelcontextprotocol/servers-archived/tree/main/src/postgres
Last verified
2026-11-23

What an agent can do through it

Reads and writes databases · 15
ToolTypeWhat it does
queryReadRuns the supplied SQL inside a READ ONLY transaction

Known vulnerabilities

No CVE or security advisory published for this server as of 2026-11-23. Most MCP risk comes from what the tools allow an injected agent to do, so the risks below still apply.

Main risks

Read-only guard depends on a transaction wrapper, not database permissions

ASI02 Tool Misuse and Exploitation

The only protection is that the query runs inside a READ ONLY transaction; if the connecting role can write, any way of ending that transaction lets writes through. A least-privilege database role is the real control, and the archived code will not receive fixes.

Unmaintained code with no security fixes

ASI04 Agentic Supply Chain Vulnerabilities

The archive README states no security guarantees are provided and no security updates or bug fixes will be shipped. The npx and Docker examples are unpinned, so teams run whatever was last published.

Prompt injection from table contents steering further queries

LLM01:2025 Prompt Injection

Rows returned by query go straight into the model context, so text stored in a table can instruct the agent to read other tables. The schema resources also expose every table the role can see.

Credentials in plain-text config

LLM02:2025 Sensitive Information Disclosure

The documented setup puts user and password inside the postgresql:// URL in the client config file. Anyone or anything that can read that file gets direct database access.

How to set it up safely

  1. Prefer a maintained server; the reference server is archived with no security updates
  2. Connect with a dedicated PostgreSQL role that has only SELECT on the needed schemas (never a superuser or owner role)
  3. Point it at a read replica or a sanitized copy, not the primary production database
  4. Pin the package or image version you have reviewed instead of the unpinned npx/docker examples
  5. Keep credentials out of the config file where the client allows environment variables or a secrets store
  6. Keep per-tool-call approval on so each SQL statement is reviewed
  7. Set statement_timeout and row limits on the role to cap bulk reads

How we score

Baseline scores use the method from our guide to scoring every MCP server on employee laptops. Score the servers in your own environment with the free MCP Server Risk Checklist.

1. What the server can do (capped at 40)

  • Sends messages externally: 15
  • Fetches arbitrary URLs: 15
  • Writes to code repositories: 15
  • Reads and writes databases: 15
  • Writes or deletes local files: 10
  • Automates a browser: 10
  • Reads and writes SaaS data: 10
  • Reads local files: 5
  • Runs code or commands: 15 (added for this directory)
  • Changes cloud infrastructure: 15 (added for this directory)
  • Moves money or changes payments: 15 (added for this directory)

2. What we found

  • Read-plus-exfiltrate: reads sensitive data and can also send data out: 20
  • Hidden instructions in a tool description (publicly verified): 30, and always Critical
  • Third-party: not published by the maker of the system it connects to: 10

3. Band

0–24 Low · 25–49 Medium · 50–74 High · 75–100 Critical.

This is a baseline. The full method also adds points for unpinned package versions, how many employees use the server and whether a policy covers it; those depend on your setup, so check them in your own environment.

How AccuroAI helps

The AccuroAI Endpoint Agent finds the MCP servers configured in AI clients on managed devices and lists the tools each local server exposes. Each server gets a risk level with its capabilities, and you can block a server once in the console to enforce the block on every device: Claude Code and Cursor refuse calls to it, and for other clients the agent stops the server process. Tool calls from coding agents can be graded by risk, then allowed, confirmed with the employee or blocked.

MCP security · MCP server inventory · How to red team an MCP server

Questions about the PostgreSQL MCP Server (reference)

Is the PostgreSQL MCP Server (reference) safe to use?

It can be, with the right setup. At baseline it scores 25 (Medium) in the AccuroAI method because an agent using it can reads and writes databases. Limit its scopes or tools, keep a person in the loop for write actions and pin the version you reviewed.

Does the PostgreSQL MCP Server (reference) have known vulnerabilities?

We found no published CVE or security advisory for it as of 2026-11-23. That does not make it risk-free: most MCP risk comes from what the tools allow an injected agent to do, not from bugs in the server.

How do I restrict the PostgreSQL MCP Server (reference)?

Use the controls the maker provides: No flags; every query is wrapped in a READ ONLY transaction (the only guard). Then grant the narrowest token or account, approve the server centrally and block other copies of it.

Related servers

MongoDB MCP Server · Supabase MCP Server · All servers

Sources

Facts were verified on 2026-11-23 against the server’s own repository and documentation and public vulnerability records. Servers change often: check the maker’s latest release notes before approving a new version. This page is general security guidance, not a guarantee about any product.

MCP Security
Find every copy of PostgreSQL MCP Server (reference) on your fleet

AccuroAI finds the MCP servers configured in AI clients on managed devices, gives each a risk level and blocks a server across the fleet.

Book a demoStart a free pilot

Finds MCP servers on managed devices · Risk level per server · Block a server across the fleet