Skip to content
VS Code

PostgreSQL (hardened, read-only) for VS Code

io.github.eszetael/postgres-mcp-hardened

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

client:VS Code transport:stdio runtime:npm

Install PostgreSQL (hardened, read-only) in VS Code

.vscode/mcp.json

{
  "inputs": [
    {
      "type": "promptString",
      "id": "database-url",
      "description": "DATABASE_URL",
      "password": true
    },
    {
      "type": "promptString",
      "id": "mcp-statement-timeout",
      "description": "MCP_STATEMENT_TIMEOUT",
      "password": true
    },
    {
      "type": "promptString",
      "id": "mcp-allow-tables",
      "description": "MCP_ALLOW_TABLES",
      "password": true
    },
    {
      "type": "promptString",
      "id": "mcp-audit-log",
      "description": "MCP_AUDIT_LOG",
      "password": true
    }
  ],
  "servers": {
    "postgres-mcp-hardened": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "postgres-mcp-hardened"
      ],
      "env": {
        "DATABASE_URL": "${input:database-url}",
        "MCP_STATEMENT_TIMEOUT": "${input:mcp-statement-timeout}",
        "MCP_ALLOW_TABLES": "${input:mcp-allow-tables}",
        "MCP_AUDIT_LOG": "${input:mcp-audit-log}"
      }
    }
  }
}

VS Code prompts for each input the first time the server starts, so no secret is written to the file. VS Code docs

PostgreSQL (hardened, read-only) in other clients