Install
Add to ~/Library/Application Support/Claude/claude_desktop_config.json
Windows / Linux path
%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json{
"mcpServers": {
"io-github-antonorlov-mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server"
],
"env": {
"DATABASE_URL": "<YOUR_VALUE>",
"PG_HOST": "<VALUE>",
"PG_PORT": "5432",
"PG_USER": "<VALUE>",
"PG_PASSWORD": "<YOUR_VALUE>",
"PG_DATABASE": "<VALUE>",
"PG_ALLOW_WRITE": "false",
"PG_SSLMODE": "<VALUE>",
"PG_SSL_CA": "<VALUE>",
"PG_ENABLE_RUNTIME_CONNECT": "false",
"PG_MAX_RESULT_BYTES": "32768",
"PG_STATEMENT_TIMEOUT": "30000",
"PG_CONNECT_TIMEOUT": "10000",
"PG_SSH_HOST": "<VALUE>",
"PG_SSH_PORT": "22",
"PG_SSH_USER": "<VALUE>",
"PG_SSH_PRIVATE_KEY": "<VALUE>",
"PG_SSH_PASSPHRASE": "<YOUR_VALUE>",
"PG_SSH_AGENT": "<VALUE>",
"PG_SSH_PASSWORD": "<YOUR_VALUE>",
"PG_SSH_FINGERPRINT": "SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"PG_SSH_KEEPALIVE_INTERVAL": "15000"
}
}
}
}
Restart Claude Desktop to activate the new server.
Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
Windows / Linux path
.cursor\mcp.json (project) or %USERPROFILE%\.cursor\mcp.json (global).cursor/mcp.json (project) or ~/.cursor/mcp.json (global){
"mcpServers": {
"io-github-antonorlov-mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server"
],
"env": {
"DATABASE_URL": "<YOUR_VALUE>",
"PG_HOST": "<VALUE>",
"PG_PORT": "5432",
"PG_USER": "<VALUE>",
"PG_PASSWORD": "<YOUR_VALUE>",
"PG_DATABASE": "<VALUE>",
"PG_ALLOW_WRITE": "false",
"PG_SSLMODE": "<VALUE>",
"PG_SSL_CA": "<VALUE>",
"PG_ENABLE_RUNTIME_CONNECT": "false",
"PG_MAX_RESULT_BYTES": "32768",
"PG_STATEMENT_TIMEOUT": "30000",
"PG_CONNECT_TIMEOUT": "10000",
"PG_SSH_HOST": "<VALUE>",
"PG_SSH_PORT": "22",
"PG_SSH_USER": "<VALUE>",
"PG_SSH_PRIVATE_KEY": "<VALUE>",
"PG_SSH_PASSPHRASE": "<YOUR_VALUE>",
"PG_SSH_AGENT": "<VALUE>",
"PG_SSH_PASSWORD": "<YOUR_VALUE>",
"PG_SSH_FINGERPRINT": "SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"PG_SSH_KEEPALIVE_INTERVAL": "15000"
}
}
}
}
Cursor usually picks up config changes automatically; if the server does not appear, reload the window.
Add to .mcp.json (project) or ~/.claude.json (global)
Windows / Linux path
.mcp.json (project) or %USERPROFILE%\.claude.json (global).mcp.json (project) or ~/.claude.json (global){
"mcpServers": {
"io-github-antonorlov-mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server"
],
"env": {
"DATABASE_URL": "<YOUR_VALUE>",
"PG_HOST": "<VALUE>",
"PG_PORT": "5432",
"PG_USER": "<VALUE>",
"PG_PASSWORD": "<YOUR_VALUE>",
"PG_DATABASE": "<VALUE>",
"PG_ALLOW_WRITE": "false",
"PG_SSLMODE": "<VALUE>",
"PG_SSL_CA": "<VALUE>",
"PG_ENABLE_RUNTIME_CONNECT": "false",
"PG_MAX_RESULT_BYTES": "32768",
"PG_STATEMENT_TIMEOUT": "30000",
"PG_CONNECT_TIMEOUT": "10000",
"PG_SSH_HOST": "<VALUE>",
"PG_SSH_PORT": "22",
"PG_SSH_USER": "<VALUE>",
"PG_SSH_PRIVATE_KEY": "<VALUE>",
"PG_SSH_PASSPHRASE": "<YOUR_VALUE>",
"PG_SSH_AGENT": "<VALUE>",
"PG_SSH_PASSWORD": "<YOUR_VALUE>",
"PG_SSH_FINGERPRINT": "SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"PG_SSH_KEEPALIVE_INTERVAL": "15000"
}
}
}
}
The server will be available in the next Claude Code session.
Add to .vscode/mcp.json
Windows / Linux path
.vscode\mcp.json.vscode/mcp.json{
"servers": {
"io-github-antonorlov-mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server"
],
"env": {
"DATABASE_URL": "<YOUR_VALUE>",
"PG_HOST": "<VALUE>",
"PG_PORT": "5432",
"PG_USER": "<VALUE>",
"PG_PASSWORD": "<YOUR_VALUE>",
"PG_DATABASE": "<VALUE>",
"PG_ALLOW_WRITE": "false",
"PG_SSLMODE": "<VALUE>",
"PG_SSL_CA": "<VALUE>",
"PG_ENABLE_RUNTIME_CONNECT": "false",
"PG_MAX_RESULT_BYTES": "32768",
"PG_STATEMENT_TIMEOUT": "30000",
"PG_CONNECT_TIMEOUT": "10000",
"PG_SSH_HOST": "<VALUE>",
"PG_SSH_PORT": "22",
"PG_SSH_USER": "<VALUE>",
"PG_SSH_PRIVATE_KEY": "<VALUE>",
"PG_SSH_PASSPHRASE": "<YOUR_VALUE>",
"PG_SSH_AGENT": "<VALUE>",
"PG_SSH_PASSWORD": "<YOUR_VALUE>",
"PG_SSH_FINGERPRINT": "SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"PG_SSH_KEEPALIVE_INTERVAL": "15000"
}
}
}
}
Reload the VS Code window to activate.
Add to ~/.codeium/windsurf/mcp_config.json
Windows / Linux path
%USERPROFILE%\.codeium\windsurf\mcp_config.json~/.codeium/windsurf/mcp_config.json{
"mcpServers": {
"io-github-antonorlov-mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server"
],
"env": {
"DATABASE_URL": "<YOUR_VALUE>",
"PG_HOST": "<VALUE>",
"PG_PORT": "5432",
"PG_USER": "<VALUE>",
"PG_PASSWORD": "<YOUR_VALUE>",
"PG_DATABASE": "<VALUE>",
"PG_ALLOW_WRITE": "false",
"PG_SSLMODE": "<VALUE>",
"PG_SSL_CA": "<VALUE>",
"PG_ENABLE_RUNTIME_CONNECT": "false",
"PG_MAX_RESULT_BYTES": "32768",
"PG_STATEMENT_TIMEOUT": "30000",
"PG_CONNECT_TIMEOUT": "10000",
"PG_SSH_HOST": "<VALUE>",
"PG_SSH_PORT": "22",
"PG_SSH_USER": "<VALUE>",
"PG_SSH_PRIVATE_KEY": "<VALUE>",
"PG_SSH_PASSPHRASE": "<YOUR_VALUE>",
"PG_SSH_AGENT": "<VALUE>",
"PG_SSH_PASSWORD": "<YOUR_VALUE>",
"PG_SSH_FINGERPRINT": "SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"PG_SSH_KEEPALIVE_INTERVAL": "15000"
}
}
}
}
Restart Windsurf (or refresh its MCP servers panel) to activate the new server.
Windsurf Next uses ~/.codeium/windsurf-next/mcp_config.json. Devin Desktop (the Windsurf rebrand) uses ~/.config/devin/mcp_config.json and imports the Windsurf file.
Add to ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Windows / Linux path
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json{
"mcpServers": {
"io-github-antonorlov-mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server"
],
"env": {
"DATABASE_URL": "<YOUR_VALUE>",
"PG_HOST": "<VALUE>",
"PG_PORT": "5432",
"PG_USER": "<VALUE>",
"PG_PASSWORD": "<YOUR_VALUE>",
"PG_DATABASE": "<VALUE>",
"PG_ALLOW_WRITE": "false",
"PG_SSLMODE": "<VALUE>",
"PG_SSL_CA": "<VALUE>",
"PG_ENABLE_RUNTIME_CONNECT": "false",
"PG_MAX_RESULT_BYTES": "32768",
"PG_STATEMENT_TIMEOUT": "30000",
"PG_CONNECT_TIMEOUT": "10000",
"PG_SSH_HOST": "<VALUE>",
"PG_SSH_PORT": "22",
"PG_SSH_USER": "<VALUE>",
"PG_SSH_PRIVATE_KEY": "<VALUE>",
"PG_SSH_PASSPHRASE": "<YOUR_VALUE>",
"PG_SSH_AGENT": "<VALUE>",
"PG_SSH_PASSWORD": "<YOUR_VALUE>",
"PG_SSH_FINGERPRINT": "SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"PG_SSH_KEEPALIVE_INTERVAL": "15000"
}
}
}
}
Cline reloads cline_mcp_settings.json automatically; if the server does not appear, reload the VS Code window.
Open it from Cline's MCP Servers panel → Configure. Roo Code uses a different file and format.
Configuration
Environment variables this server reads. Secrets stay on your machine.
| Name | Required | Description |
|---|---|---|
| DATABASE_URL secret | No | Full PostgreSQL connection string (preferred). Supports SSL mode via query parameter, e.g. postgres://user:password@localhost:5432/mydb?sslmode=require |
| PG_HOST | No | Database host (fallback when DATABASE_URL is not set) |
| PG_PORT | No | Database port. Defaults to 5432 Default: 5432 |
| PG_USER | No | Database user |
| PG_PASSWORD secret | No | Database password |
| PG_DATABASE | No | Database name |
| PG_ALLOW_WRITE | No | When true, execute performs writes and reads are sent directly. Off (default) is read-only: execute refuses writes and each read runs in a READ ONLY transaction Default: false |
| PG_SSLMODE | No | SSL mode: disable | allow | prefer | require | verify-ca | verify-full |
| PG_SSL_CA | No | Path to a CA certificate file. Setting it by itself implies verify-full |
| PG_ENABLE_RUNTIME_CONNECT | No | Register the connect_db tool for runtime credential switching Default: false |
| PG_MAX_RESULT_BYTES | No | Byte budget for a query result sent to the model Default: 32768 |
| PG_STATEMENT_TIMEOUT | No | Statement timeout in milliseconds, applied to every session Default: 30000 |
| PG_CONNECT_TIMEOUT | No | Timeout in milliseconds for a single connect attempt Default: 10000 |
| PG_SSH_HOST | No | SSH bastion host. Setting it enables tunneling. |
| PG_SSH_PORT | No | SSH bastion port Default: 22 |
| PG_SSH_USER | No | SSH username |
| PG_SSH_PRIVATE_KEY | No | Path to a private key file |
| PG_SSH_PASSPHRASE secret | No | Passphrase for the private key, if encrypted |
| PG_SSH_AGENT | No | true to use the ambient SSH agent, or an explicit socket path / Windows named pipe |
| PG_SSH_PASSWORD secret | No | SSH login password. Opt-in; a key or agent takes precedence |
| PG_SSH_FINGERPRINT | No | Pinned host-key fingerprint (SHA256:...). Required when PG_SSH_HOST is set. |
| PG_SSH_KEEPALIVE_INTERVAL | No | SSH keepalive interval in ms; the tunnel drops after 3 unanswered keepalives Default: 15000 |