PluginBench
MCP Server
Active
MIT

PostgreSQL (hardened, read-only) MCP Server

io.github.Eszetael/postgres-mcp-hardened

What is the PostgreSQL (hardened, read-only) MCP server?

Read-only PostgreSQL over MCP. Writes refused at the parsed SQL, plus a READ ONLY transaction.

How to install PostgreSQL (hardened, read-only)

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
Environment / auth
  • DATABASE_URL
    required
    secret

    Connection string for the role the server connects as. Use a role that cannot write — the server refuses writes twice, but a read-only role is the layer that does not depend on us being correct. `--print-setup-sql` prints the SQL that creates one.

  • MCP_STATEMENT_TIMEOUT

    Server-side statement timeout, e.g. `5s`. A question that would pin the database is cancelled by PostgreSQL, not by hope.

  • MCP_ALLOW_TABLES

    Comma-separated allowlist. A table off the list is refused by name, and hiding it inside a CTE, a view or a join does not help.

  • MCP_AUDIT_LOG

    Path to the tamper-evident audit log. Entries are chained by hash and survive a restart; `--verify-audit` checks the chain against an off-host anchor.

  • MCP_ADDR

    Address to bind, default 127.0.0.1:8080.

Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "postgres-mcp-hardened": {
      "command": "npx",
      "args": [
        "-y",
        "postgres-mcp-hardened",
        "--stdio"
      ],
      "env": {
        "DATABASE_URL": "<YOUR_DATABASE_URL>",
        "MCP_STATEMENT_TIMEOUT": "<YOUR_MCP_STATEMENT_TIMEOUT>",
        "MCP_ALLOW_TABLES": "<YOUR_MCP_ALLOW_TABLES>",
        "MCP_AUDIT_LOG": "<YOUR_MCP_AUDIT_LOG>",
        "MCP_ADDR": "<YOUR_MCP_ADDR>"
      }
    }
  }
}
Cursor
~/.cursor/mcp.json
{
  "mcpServers": {
    "postgres-mcp-hardened": {
      "command": "npx",
      "args": [
        "-y",
        "postgres-mcp-hardened",
        "--stdio"
      ],
      "env": {
        "DATABASE_URL": "<YOUR_DATABASE_URL>",
        "MCP_STATEMENT_TIMEOUT": "<YOUR_MCP_STATEMENT_TIMEOUT>",
        "MCP_ALLOW_TABLES": "<YOUR_MCP_ALLOW_TABLES>",
        "MCP_AUDIT_LOG": "<YOUR_MCP_AUDIT_LOG>",
        "MCP_ADDR": "<YOUR_MCP_ADDR>"
      }
    }
  }
}
Windsurf
~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "postgres-mcp-hardened": {
      "command": "npx",
      "args": [
        "-y",
        "postgres-mcp-hardened",
        "--stdio"
      ],
      "env": {
        "DATABASE_URL": "<YOUR_DATABASE_URL>",
        "MCP_STATEMENT_TIMEOUT": "<YOUR_MCP_STATEMENT_TIMEOUT>",
        "MCP_ALLOW_TABLES": "<YOUR_MCP_ALLOW_TABLES>",
        "MCP_AUDIT_LOG": "<YOUR_MCP_AUDIT_LOG>",
        "MCP_ADDR": "<YOUR_MCP_ADDR>"
      }
    }
  }
}
VS Code
.vscode/mcp.json
{
  "servers": {
    "postgres-mcp-hardened": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "postgres-mcp-hardened",
        "--stdio"
      ],
      "env": {
        "DATABASE_URL": "<YOUR_DATABASE_URL>",
        "MCP_STATEMENT_TIMEOUT": "<YOUR_MCP_STATEMENT_TIMEOUT>",
        "MCP_ALLOW_TABLES": "<YOUR_MCP_ALLOW_TABLES>",
        "MCP_AUDIT_LOG": "<YOUR_MCP_AUDIT_LOG>",
        "MCP_ADDR": "<YOUR_MCP_ADDR>"
      }
    }
  }
}
Claude Code
claude mcp add postgres-mcp-hardened --env DATABASE_URL=<YOUR_DATABASE_URL> --env MCP_STATEMENT_TIMEOUT=<YOUR_MCP_STATEMENT_TIMEOUT> --env MCP_ALLOW_TABLES=<YOUR_MCP_ALLOW_TABLES> --env MCP_AUDIT_LOG=<YOUR_MCP_AUDIT_LOG> --env MCP_ADDR=<YOUR_MCP_ADDR> -- npx -y postgres-mcp-hardened --stdio

Related MCP servers

Control a real Chrome browser to complete any task: fill forms, extract data, book flights.

110k
Python
MIT
View repository →

Live global intelligence: real-time markets, conflicts, country risk, chokepoints, energy. 39 tools.

83k
TypeScript
AGPL-3.0
View repository →

Netdata

Active

Real-time infrastructure monitoring with metrics, logs, alerts, and ML-based anomaly detection.

80k
Go
GPL-3.0
View repository →

Trending hip-hop artist momentum scores across four cultural dimensions.

79k
TypeScript
MIT
View repository →

AI orchestration with hive-mind swarms, neural networks, and 87 MCP tools for enterprise dev.

68k
TypeScript
MIT
View repository →

Give your AI agent stealth web scraping with Cloudflare bypass and CSS selection, powered by Scrapling.

67k
Python
BSD-3-Clause
View repository →