PostgreSQL for VS Code
io.github.antonorlov/mcp-postgres-server
MCP server for PostgreSQL: local, Docker, RDS, Neon, Supabase, or behind an SSH bastion.
client:VS Code
transport:stdio
runtime:npm
Install PostgreSQL in VS Code
.vscode/mcp.json
{
"inputs": [
{
"type": "promptString",
"id": "database-url",
"description": "DATABASE_URL",
"password": true
},
{
"type": "promptString",
"id": "pg-host",
"description": "PG_HOST",
"password": true
},
{
"type": "promptString",
"id": "pg-port",
"description": "PG_PORT",
"password": true
},
{
"type": "promptString",
"id": "pg-user",
"description": "PG_USER",
"password": true
},
{
"type": "promptString",
"id": "pg-password",
"description": "PG_PASSWORD",
"password": true
},
{
"type": "promptString",
"id": "pg-database",
"description": "PG_DATABASE",
"password": true
},
{
"type": "promptString",
"id": "pg-allow-write",
"description": "PG_ALLOW_WRITE",
"password": true
},
{
"type": "promptString",
"id": "pg-sslmode",
"description": "PG_SSLMODE",
"password": true
},
{
"type": "promptString",
"id": "pg-ssl-ca",
"description": "PG_SSL_CA",
"password": true
},
{
"type": "promptString",
"id": "pg-enable-runtime-connect",
"description": "PG_ENABLE_RUNTIME_CONNECT",
"password": true
},
{
"type": "promptString",
"id": "pg-max-result-bytes",
"description": "PG_MAX_RESULT_BYTES",
"password": true
},
{
"type": "promptString",
"id": "pg-statement-timeout",
"description": "PG_STATEMENT_TIMEOUT",
"password": true
},
{
"type": "promptString",
"id": "pg-connect-timeout",
"description": "PG_CONNECT_TIMEOUT",
"password": true
},
{
"type": "promptString",
"id": "pg-ssh-host",
"description": "PG_SSH_HOST",
"password": true
},
{
"type": "promptString",
"id": "pg-ssh-port",
"description": "PG_SSH_PORT",
"password": true
},
{
"type": "promptString",
"id": "pg-ssh-user",
"description": "PG_SSH_USER",
"password": true
},
{
"type": "promptString",
"id": "pg-ssh-private-key",
"description": "PG_SSH_PRIVATE_KEY",
"password": true
},
{
"type": "promptString",
"id": "pg-ssh-passphrase",
"description": "PG_SSH_PASSPHRASE",
"password": true
},
{
"type": "promptString",
"id": "pg-ssh-agent",
"description": "PG_SSH_AGENT",
"password": true
},
{
"type": "promptString",
"id": "pg-ssh-password",
"description": "PG_SSH_PASSWORD",
"password": true
},
{
"type": "promptString",
"id": "pg-ssh-fingerprint",
"description": "PG_SSH_FINGERPRINT",
"password": true
},
{
"type": "promptString",
"id": "pg-ssh-keepalive-interval",
"description": "PG_SSH_KEEPALIVE_INTERVAL",
"password": true
}
],
"servers": {
"mcp-postgres-server": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mcp-postgres-server"
],
"env": {
"DATABASE_URL": "${input:database-url}",
"PG_HOST": "${input:pg-host}",
"PG_PORT": "${input:pg-port}",
"PG_USER": "${input:pg-user}",
"PG_PASSWORD": "${input:pg-password}",
"PG_DATABASE": "${input:pg-database}",
"PG_ALLOW_WRITE": "${input:pg-allow-write}",
"PG_SSLMODE": "${input:pg-sslmode}",
"PG_SSL_CA": "${input:pg-ssl-ca}",
"PG_ENABLE_RUNTIME_CONNECT": "${input:pg-enable-runtime-connect}",
"PG_MAX_RESULT_BYTES": "${input:pg-max-result-bytes}",
"PG_STATEMENT_TIMEOUT": "${input:pg-statement-timeout}",
"PG_CONNECT_TIMEOUT": "${input:pg-connect-timeout}",
"PG_SSH_HOST": "${input:pg-ssh-host}",
"PG_SSH_PORT": "${input:pg-ssh-port}",
"PG_SSH_USER": "${input:pg-ssh-user}",
"PG_SSH_PRIVATE_KEY": "${input:pg-ssh-private-key}",
"PG_SSH_PASSPHRASE": "${input:pg-ssh-passphrase}",
"PG_SSH_AGENT": "${input:pg-ssh-agent}",
"PG_SSH_PASSWORD": "${input:pg-ssh-password}",
"PG_SSH_FINGERPRINT": "${input:pg-ssh-fingerprint}",
"PG_SSH_KEEPALIVE_INTERVAL": "${input:pg-ssh-keepalive-interval}"
}
}
}
}
VS Code prompts for each input the first time the server starts, so no secret is written to the file. VS Code docs