PostgreSQL SSH MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PORT | No | HTTP server port | 3000 |
| MAX_ROWS | No | Maximum rows returned per query | 1000 |
| MCP_HOST | No | HTTP server bind address | 0.0.0.0 |
| SSH_HOST | No | SSH server hostname | |
| SSH_PORT | No | SSH server port | 22 |
| SSH_USER | No | SSH username | |
| READ_ONLY | No | Block data modifications. Set false to allow writes. | true |
| SSH_ENABLED | No | Set true to enable SSH tunneling | false |
| AUTH0_DOMAIN | No | Auth0 tenant domain (e.g., tenant.us.auth0.com) | |
| DATABASE_SSL | No | true or false. Auto-enabled for non-localhost. | auto |
| DATABASE_URI | No | Full connection string (e.g., postgresql://user:pass@host:5432/db) | |
| SSH_PASSWORD | No | SSH password (alternative to key) | |
| DATABASE_HOST | No | Database hostname | |
| DATABASE_NAME | No | Database name | |
| DATABASE_PORT | No | Database port | 5432 |
| DATABASE_USER | No | Database username | |
| MCP_AUTH_MODE | No | Authentication mode: none or oauth | none |
| MCP_STATELESS | No | Stateless mode (each request re-initializes) | true |
| QUERY_TIMEOUT | No | Query timeout in milliseconds | 30000 |
| AUTH0_AUDIENCE | No | Auth0 API identifier / audience | |
| DATABASE_SSL_CA | No | Path to CA certificate bundle | |
| DATABASE_PASSWORD | No | Database password | |
| MCP_ALLOWED_HOSTS | No | Comma-separated allowed Host headers | |
| MCP_ALLOWED_ORIGINS | No | Comma-separated allowed CORS origins (* for any) | |
| SSH_STRICT_HOST_KEY | No | Verify host key against known_hosts | true |
| MCP_SERVER_POOL_SIZE | No | Server instances for stateless mode | 4 |
| SSH_KNOWN_HOSTS_PATH | No | Custom known_hosts file | ~/.ssh/known_hosts |
| SSH_PRIVATE_KEY_PATH | No | Path to private key file | |
| POOL_DRAIN_TIMEOUT_MS | No | Timeout for draining pool during reconnect | 5000 |
| MAX_CONCURRENT_QUERIES | No | Maximum concurrent queries | 10 |
| SSH_KEEPALIVE_INTERVAL | No | Keepalive interval in milliseconds | 10000 |
| SSH_TRUST_ON_FIRST_USE | No | Auto-add unknown hosts (when strict is enabled) | true |
| MCP_SESSION_TTL_MINUTES | No | Session TTL for stateful mode | 30 |
| MCP_RESOURCE_DOCUMENTATION | No | URL to API documentation (RFC 9728) | |
| SSH_MAX_RECONNECT_ATTEMPTS | No | Max reconnect attempts (-1 for unlimited) | 5 |
| SSH_PRIVATE_KEY_PASSPHRASE | No | Passphrase for encrypted keys | |
| MCP_SESSION_CLEANUP_INTERVAL_MS | No | Session cleanup interval | 300000 |
| DATABASE_SSL_REJECT_UNAUTHORIZED | No | Set false to allow self-signed certificates | true |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| execute_queryB | Execute SQL with optional parameters. Results are capped by MAX_ROWS and include a truncated flag. |
| explain_queryB | Return an EXPLAIN plan for a query. ANALYZE executes the query. |
| list_schemasA | List schemas (excludes system schemas by default). |
| list_tablesA | List tables in a schema with estimated row counts and sizes. |
| describe_tableA | Describe a table (columns, constraints, indexes). |
| list_databasesA | List databases with owner, encoding, and size. |
| get_connection_statusA | Get connection status, pool stats, and tunnel state. |
| list_active_connectionsB | List active connections from pg_stat_activity. |
| list_long_running_queriesC | List queries running longer than a threshold. |
| get_database_versionA | Get PostgreSQL server version. |
| get_database_sizeB | Get database size and largest tables. |
| get_table_statsA | Get table statistics (rows, vacuum/analyze, scan counts). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Zlash65/postgresql-ssh-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server