PostgresBLOCK
MCP Server for Postgres
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
A Model Context Protocol server for PostgreSQL databases. Enables LLMs to query and analyze PostgreSQL databases through a controlled interface.
https://github.com/user-attachments/assets/6571c20c-91c9-4a6e-8332-13b587b79fbf
Installation
[](https://cursor.com/en/install-mcp?name=postgres&config=eyJjb21tYW5kIjoibnB4IC0teWVzIHBnLW1jcC1zZXJ2ZXIgLS10cmFuc3BvcnQgc3RkaW8iLCJlbnYiOnsiREFUQUJBU0VfVVJMIjoicG9zdGdyZXNxbDovL3Bvc3RncmVzOnBvc3RncmVzQGxvY2FsaG9zdDo1NDMyL3Bvc3RncmVzIn19)
Add to your MCP client settings:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["--yes", "pg-mcp-server", "--transport", "stdio"],
"env": {
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
}
}
}
}Configuration
DATABASE_URL- PostgreSQL connection string (required)DANGEROUSLY_ALLOW_WRITE_OPS- Enable writes (default:false)DEBUG- Enable debug logging (default:false)PG_SSL_ROOT_CERT- Optional path to a TLS CA bundle (e.g., AWS RDS global bundle)
Usage
Transports
- Default transport is stdio. Switch to HTTP with the
--transportflag. - HTTP mode serves the MCP Streamable HTTP endpoint at
/mcponPORT(default3000). - Clients that support Streamable HTTP should connect to
http://localhost:3000/mcp.
Start commands:
# stdio transport (default, via installed CLI) pg-mcp-server --transport=stdio # http transport pg-mcp-server --transport=http
Tools
- `query` - Execute SQL queries
{ "sql": "SELECT * FROM users WHERE active = true LIMIT 10" }Resources
- `postgres://tables` - List all tables
- `postgres://table/{schema}/{table}` - Get table schema and sample data
Example Prompts
Here's an example prompt to test if your MCP server is working:
Show me the first 5 users from the database
c58e39969dcaOBSERVED · 2026-10-06Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control.
claude mcp add pg-mcp-server -- npx -y [email protected]
{
"mcpServers": {
"pg-mcp-server": {
"command": "npx",
"args": [
"-y",
"[email protected]"
]
}
}
}Exposed tools (1)
1 read · 0 write · 0 destructive.
| Tool | Risk | Description |
|---|---|---|
query | read |
Trust audit
BLOCKgrade D · trust 69/100 Do not install this without reading the findings. The audit found something that could harm you or your machine.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | FAIL |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- none-observed
- Shell
- none-observed
- Dependencies
- not all pinned
- Secrets in source
- found
Findings (6)
"inspector:stdio": "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres npx @modelcontextprotocol/inspector bun run index.ts --transport=stdio",
"inspector:http": "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres npx @modelcontextprotocol/inspector bun run index.ts --transport=http",
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
@modelcontextprotocol/sdk, postgres, zod, @types/bun, @types/node, prettier
assets/demo.mp4
Gates applied: no_behavioural_pass.
c58e39969dcafull audit observations/trust-audit/mcp-server/ericzakariasson__postgres-13.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-06 | c58e39969dca | BLOCK | D | 69 | first audit |
Questions
What is the Postgres MCP server?
MCP Server for Postgres
What tools does Postgres expose?
1 in total: 1 read-only, 0 that write, and 0 that can delete or overwrite. Every one is listed on this page with its risk.
Is Postgres safe to connect to an agent?
No — not without reading the findings first. The audit graded it D (69/100) and found 2 critical or high issues in the source. Each one is listed on this page with the file and line it is on.
What credentials does Postgres need?
No credential environment variables were found in its source, so it appears to need none.
How does Postgres run?
It speaks stdio and streamable-http, so it runs as a local process your client starts. It is published on npm as pg-mcp-server at 0.3.0.
How current is this page?
The grade is for one exact copy of the source (c58e39969dca), read on 2026-10-06. The repository is watched and re-audited when it changes.