@apexradius/apex-data-mcp
v3.0.0
Published
PostgreSQL MCP server with SSH tunnel support — query, inspect, and audit Postgres databases from Claude
Downloads
59
Maintainers
Readme
@apexradius/apex-data-mcp
PostgreSQL and SSH MCP server for database inspection, remote operations, and VPS maintenance from MCP-capable clients.
Install
npx @apexradius/apex-data-mcp --pg-url "$APEX_PG_URL" --read-onlyFor local development:
npm ci
npm run build
npm start -- --pg-url "$APEX_PG_URL"Configuration
Postgres can be configured with a connection URL or individual fields:
APEX_PG_URL=postgres://user:pass@host:5432/db
APEX_PG_PASSWORD=...CLI flags:
--pg-url <url>
--pg-host <host>
--pg-port <port>
--pg-db <database>
--pg-user <user>
--pg-password <password>
--ssl
--read-only
--max-rows <n>
--timeout <ms>
--ssh-host <host>
--ssh-port <port>
--ssh-user <user>
--ssh-key <path>
--ssh-password <password>Additional SSH servers can be provided with environment variables:
APEX_SSH_VPS_HOST=100.68.57.21
APEX_SSH_VPS_USER=adam
APEX_SSH_VPS_PORT=22
APEX_SSH_VPS_KEY=/path/to/keyThe alias is the middle segment, lowercased. In the example above, use server_id: "vps".
MCP Client Example
{
"mcpServers": {
"apex-data-mcp": {
"command": "npx",
"args": [
"@apexradius/apex-data-mcp",
"--pg-url",
"${APEX_PG_URL}",
"--read-only"
],
"env": {
"APEX_PG_URL": "postgres://user:pass@localhost:5432/app"
}
}
}
}Tool Reference
Postgres tools:
pg_querypg_explainpg_list_schemaspg_list_tablespg_describe_tablepg_table_statspg_db_health
SSH execution and sessions:
ssh_executessh_execute_sudossh_execute_groupssh_command_aliasssh_session_startssh_session_sendssh_session_listssh_session_closessh_history
SSH network and files:
ssh_tunnel_createssh_tunnel_closessh_tunnel_listssh_uploadssh_downloadssh_sync
ssh_sync runs rsync locally. With server_id, mark the remote side with remote:/path, for example:
source: ./dist/
destination: remote:/var/www/app/dist/
server_id: vpsServer management and monitoring:
ssh_list_serversssh_connection_statusssh_health_checkssh_service_statusssh_aliasssh_key_managessh_group_managessh_profilessh_process_managerssh_monitorssh_tailssh_alert_setupssh_deploy
Database and backup operations over SSH:
ssh_db_listssh_db_queryssh_db_dumpssh_db_importssh_backup_createssh_backup_listssh_backup_restoressh_backup_schedule
Apex-specific:
keystone_vps_push
The removed ssh_hooks tool is intentionally absent. The previous implementation advertised session-scoped hooks without actually executing them.
Security Model
--read-onlyapplies to the direct Postgres client.- SSH database queries reject multi-statement SQL and mutating keywords.
- SSH file and backup tools reject
..path traversal segments. ssh_backup_scheduleaccepts only five-field numeric cron expressions.ssh_deployvalidates branch names before shell execution.ssh_deploypre_deployandrestart_commandrun remote shell commands; only pass trusted operator input.- SSH key files with group or world permissions emit a warning.
- Extra
APEX_SSH_*servers withoutUSERare skipped with a startup warning. - The system health check runs a real SSH
echo okprobe when SSH is configured.
No secrets should be committed in MCP client config. Use environment variables or the local secret manager.
