MCP Catalogs
首页postgresql-ssh-mcp screenshot

postgresql-ssh-mcp

by Zlash65·6·综合分 39

PostgreSQL MCP 服务器,具有 SSH 隧道功能,可通过堡垒主机安全访问数据库。

databasedeveloper-toolssecurity
2
Forks
3
活跃 Issue
5 个月前
最近提交
2 天前
收录于

概述

这是一个功能齐全的 PostgreSQL MCP 服务器,具有内置的 SSH 隧道功能。它提供双传输模式 - Claude Desktop 的 STDIO 和 ChatGPT 的 HTTP - 使其能够在不同的 AI 环境中灵活使用。服务器实现了强大的安全功能,包括只读默认设置、OAuth 支持以及具有 TOFU(首次使用信任)身份验证的自动 SSH 隧道管理。

试试问 AI

装完之后,这里有 5 个你可以让 AI 做的事:

:安全地让 AI 助手连接到位于堡垒主机后面的 PostgreSQL 数据库
:无需手动 SSH 隧道设置即可让 Claude Desktop 查询数据库
:通过安全的 HTTP 端点为 ChatGPT 提供数据库访问
:SSH 隧道功能如何工作?
:我可以使用此服务器修改数据库表吗?

什么时候选它

当您需要通过SSH隧道安全访问PostgreSQL数据库,特别是用于ChatGPT集成或在受限环境中使用Claude Desktop时,请选择此服务器。

什么时候不要选它

如果您默认需要写入权限(除非明确配置,否则它是只读的)或者您不使用PostgreSQL,请不要选择此服务器。

此 server 暴露的工具

从 README 抽取出 12 个工具
  • 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.

  • 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.

  • 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.

可对比工具

supabase-mcpneon-mcppostgres-mcpmysql-mcpshell-mcp

安装

Claude Desktop (STDIO)

添加到您的 Claude Desktop 配置中:

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@zlash65/postgresql-ssh-mcp"],
      "env": {
        "DATABASE_URI": "postgresql://user:password@localhost:5432/mydb"
      }
    }
  }
}

ChatGPT (HTTP 服务器)

DATABASE_URI="postgresql://user:pass@localhost:5432/mydb" npx @zlash65/postgresql-ssh-mcp-http

然后配置 ChatGPT 连接到 HTTP 端点。

FAQ

SSH 隧道功能如何工作?
服务器会自动创建到您堡垒主机的 SSH 隧道,并通过它安全地转发数据库连接。无需手动执行 `ssh -L` 命令。
我可以使用此服务器修改数据库表吗?
默认情况下,服务器设置为只读模式以确保生产环境的安全使用。您可以通过将 READ_ONLY 环境变量设置为 'false' 来启用写入功能。

postgresql-ssh-mcp 对比

GitHub →

最后更新于 · 由 README + GitHub 公开数据自动生成。