Skip to content
VS Code

PostgreSQL MCP Server for VS Code

io.github.musaddiq-dev/postgresql-mcp-server

Python MCP server for PostgreSQL database inspection and querying

client:VS Code transport:stdio runtime:pypi

Install PostgreSQL MCP Server in VS Code

.vscode/mcp.json

{
  "inputs": [
    {
      "type": "promptString",
      "id": "postgres-host",
      "description": "POSTGRES_HOST",
      "password": true
    },
    {
      "type": "promptString",
      "id": "postgres-port",
      "description": "POSTGRES_PORT",
      "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-db",
      "description": "POSTGRES_DB",
      "password": true
    },
    {
      "type": "promptString",
      "id": "postgres-read-query-limit",
      "description": "POSTGRES_READ_QUERY_LIMIT",
      "password": true
    }
  ],
  "servers": {
    "postgresql-mcp-server": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mdev-postgresql-mcp-server"
      ],
      "env": {
        "POSTGRES_HOST": "${input:postgres-host}",
        "POSTGRES_PORT": "${input:postgres-port}",
        "POSTGRES_USER": "${input:postgres-user}",
        "POSTGRES_PASSWORD": "${input:postgres-password}",
        "POSTGRES_DB": "${input:postgres-db}",
        "POSTGRES_READ_QUERY_LIMIT": "${input:postgres-read-query-limit}"
      }
    }
  }
}

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

PostgreSQL MCP Server in other clients