PostgreSQL MCP server with SSH tunneling for Claude Desktop and ChatGPT
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"postgres": {
"env": {
"DATABASE_URI": "postgresql://user:password@localhost:5432/mydb"
},
"args": [
"-y",
"@zlash65/postgresql-ssh-mcp"
],
"command": "npx"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
A secure PostgreSQL MCP server with built-in SSH tunneling. Connect to databases through bastion hosts automatically — no manual ssh -L required.
This server supports HTTP transport. Be the first to test it — help the community know if it works.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
Checked @zlash65/postgresql-ssh-mcp-http against OSV.dev.
Click any tool to inspect its schema.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in data
Zero-dependency, token-efficient database MCP server for Postgres, MySQL, SQL Server, MariaDB, SQLite.
🔥 Official Firecrawl MCP Server - Adds powerful web scraping and search to Cursor, Claude and any other LLM clients.
Manage Supabase projects — databases, auth, storage, and edge functions
A Model Context Protocol server that provides read-only access to MySQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.
MCP Security Weekly
Get CVE alerts and security updates for Postgresql Ssh Mcp and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
[![npm version][npm-version-badge]][npm-package] [![npm downloads][npm-downloads-badge]][npm-package] [![license][license-badge]][license-link]
A secure PostgreSQL MCP server with built-in SSH tunneling. Connect to databases through bastion hosts automatically — no manual ssh -L required.

Add to your Claude Desktop config:
| Platform | Config Location |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%/Claude/claude_desktop_config.json |
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@zlash65/postgresql-ssh-mcp"],
"env": {
"DATABASE_URI": "postgresql://user:password@localhost:5432/mydb"
}
}
}
}
DATABASE_URI="postgresql://user:pass@localhost:5432/mydb" npx @zlash65/postgresql-ssh-mcp-http
Then configure ChatGPT to connect to https://your-subdomain.example.com/mcp.
Note: ChatGPT requires HTTPS. Use a tunnel (ngrok, Cloudflare Tunnel) for local testing.
| Tool | Description |
|---|---|
execute_query | Execute SQL with parameterized queries. Results capped by MAX_ROWS. |
explain_query | Get EXPLAIN plans in text, JSON, YAML, or XML format. Supports ANALYZE. |
| Tool | Description |
|---|---|
list_schemas | List database schemas. Excludes system schemas by default. |
list_tables | List tables with row counts and sizes. Optionally include views. |
describe_table | Get columns, constraints, and indexes for a table. |
list_databases | List all databases with owner, encoding, and size. |
| Tool | Description |
|---|---|
get_connection_status | Get pool stats, tunnel state, and connection info. |
list_active_connections | Show active connections from pg_stat_activity. |
list_long_running_queries | Find queries running longer than a threshold. |
get_database_version | Get PostgreSQL server version. |
get_database_size | Get database size and largest tables. |
get_table_stats | Get vacuum/analyze stats and scan counts for a table. |
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URI | Yes* | — | Full connection string (e.g., postgresql://user:pass@host:5432/db) |
DATABASE_HOST | Yes* | — | Database hostname |
DATABASE_PORT | No | 5432 | Database port |
DATABASE_NAME | Yes* | — | Database name |
DATABASE_USER | Yes* | — | Database username |
DATABASE_PASSWORD | Yes* | — | Database password |
*Either DATABASE_URI or all individual connection variables are required.
| Variable | Default | Description |
|---|---|---|
DATABASE_SSL | Auto | true or false. Auto-enabled for non-localhost. |
DATABASE_SSL_CA | — | Path to CA certificate bundle |
DATABASE_SSL_REJECT_UNAUTHORIZED | true | Set false to allow self-signed certificates |
| Variable | Required | Default | Description |
|---|---|---|---|
SSH_ENABLED | No | false | Set true to enable SSH tunneling |
SSH_HOST | Yes* | — | SSH server hostname |
SSH_PORT | No | 22 | SSH server port |
SSH_USER | Ye |