Skip to content
VS Code

database mcp postgres for VS Code

io.github.arifulislamat/database-mcp-postgres

MCP server for PostgreSQL. Read-only by default, row caps, timeouts, secrets never logged.

client:VS Code transport:stdio runtime:npm

Install database mcp postgres in VS Code

.vscode/mcp.json

{
  "inputs": [
    {
      "type": "promptString",
      "id": "postgres-host",
      "description": "POSTGRES_HOST",
      "password": true
    },
    {
      "type": "promptString",
      "id": "postgres-user",
      "description": "POSTGRES_USER",
      "password": true
    },
    {
      "type": "promptString",
      "id": "postgres-password",
      "description": "POSTGRES_PASSWORD",
      "password": true
    },
    {
      "type": "promptString",
      "id": "postgres-database",
      "description": "POSTGRES_DATABASE",
      "password": true
    }
  ],
  "servers": {
    "database-mcp-postgres": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@database-mcp/postgres"
      ],
      "env": {
        "POSTGRES_HOST": "${input:postgres-host}",
        "POSTGRES_USER": "${input:postgres-user}",
        "POSTGRES_PASSWORD": "${input:postgres-password}",
        "POSTGRES_DATABASE": "${input:postgres-database}"
      }
    }
  }
}

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

database mcp postgres in other clients