Postgres Mcp

io.github.pgEdge由 GitHub 帳號 pgEdge 發布v1.0.0更新於 Oct 25, 2026

Enterprise PostgreSQL MCP server with NL queries, hybrid search (pgvector+BM25), and web UI

已驗證STDIO僅桌面資料庫知識與記憶

概覽

AI 產生的概覽

一個 MCP 伺服器,讓助理以 SQL 或自然語言查詢 PostgreSQL 資料庫,並提供結構分析與混合檢索。

可以做什麼
對 PostgreSQL 資料庫執行 SQL 查詢,預設在唯讀交易中執行,並可透過內建代理以自然語言產生查詢。分析資料庫結構,讀取 PostgreSQL 統計資訊及其他資源。執行結合 BM25 與 MMR 的混合檢索,並產生嵌入向量。使用引導式提示完成語意檢索設定、資料庫探索與查詢診斷。可選提供網頁聊天介面與具使用者及權杖驗證的 HTTP/HTTPS API。
適用情境
適用於內部開發流程與可信環境,讓助理探索並查詢 PostgreSQL 14 或更新版本的資料庫,包括自然語言查詢與資料語意檢索。
執行需求
以本機程序執行,透過 GitHub Container Registry 上的容器映像散布。需要 PostgreSQL 14 或更新版本的資料庫,並設定連線資訊(設定檔、環境變數或命令列參數)。可選的 HTTP 模式需要設定使用者與權杖驗證;嵌入功能需要設定提供者。
安裝前請注意
此伺服器讓 LLM 讀取整個資料庫結構與全部資料,README 明確指出不適用於對外公開的應用程式,只應在所有使用者皆可信的環境中使用。唯讀限制可依資料庫設定,因此可能被放寬。HTTP 模式涉及使用者與 API 權杖以及加密金鑰檔案,需要妥善保護。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Postgres Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

pgEdge Postgres MCP Server and Natural Language Agent

[CI - MCP Server] [CI - CLI Client] [CI - Web Client] [CI - Docker] [CI - Documentation]

The pgEdge Postgres Model Context Protocol (MCP) server enables SQL queries against PostgreSQL databases through MCP-compatible clients. The Natural Language Agent provides supporting functionality that allows you to use natural language to form SQL queries.

Supported Versions: PostgreSQL 14 and higher.

NOT FOR PUBLIC-FACING APPLICATIONS: This MCP server provides LLMs with read access to your entire database schema and data. It should only be used for internal tools, developer workflows, or environments where all users are trusted. For public-facing applications, consider the pgEdge RAG Server instead. See the Choosing the Right Solution guide for details.

Quick Start

The Quick Start guide covers installation and setup for all supported clients:

ClientTransportBest For
CLI (Stdio)StdioLocal single-user development
CLI (HTTP)HTTPMulti-user or remote access
Web UIHTTPBrowser-based chat interface
Claude CodeStdioAnthropic CLI agent
Claude DesktopStdioAnthropic desktop app
CursorStdioAI code editor
WindsurfStdioCodeium code editor
VS Code CopilotStdioGitHub Copilot agent

For a guided demo with sample data, see the Quickstart Demo with Northwind.

Key Features

  • Read-Only Protection - All queries run in read-only transactions by default
  • Resources - Access PostgreSQL statistics and more
  • Tools - Query execution, schema analysis, advanced hybrid search (BM25+MMR), embedding generation, resource reading, and more
  • Prompts - Guided workflows for semantic search setup, database exploration, query diagnostics, and more
  • Production Chat Client - Full-featured Go client with Anthropic prompt caching (90% cost reduction)
  • HTTP/HTTPS Mode - Direct API access with user and token authentication
  • Web Interface - Modern React-based UI with AI-powered chat for natural language database interaction
  • Docker Support - Pre-built images on GitHub Container Registry with Docker Compose deployment
  • Secure - TLS support, user and token auth, read-only enforcement
  • Hot Reload - Automatic reload of authentication files without server restart

Development

Prerequisites

  • Go 1.21 or higher
  • PostgreSQL 14 or higher (for testing)
  • golangci-lint v1.x (for linting)

Setup Linter

The project uses golangci-lint v1.x. Install it with:

bash
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

Note: The configuration file .golangci.yml is compatible with golangci-lint v1.x (not v2).

Building

bash
git clone https://github.com/pgEdge/pgedge-postgres-mcp.gitcd pgedge-postgres-mcpmake build

Testing

bash
# Run all testsmake test
# Run server tests with a databaseexport TEST_PGEDGE_POSTGRES_CONNECTION_STRING=\  "postgres://localhost/postgres?sslmode=disable"go test ./...
# Run with coveragego test -v -cover ./...
# Run lintingmake lint
Web UI Tests

The web UI has a comprehensive test suite. See web/TEST_SUMMARY.md for details.

bash
cd webnpm test                # Run all testsnpm run test:watch      # Watch modenpm run test:coverage   # With coverage

Security

  • Read-only transaction enforcement (configurable per database)
  • User and API token authentication with expiration
  • TLS/HTTPS support
  • SHA256 token hashing
  • File permission enforcement (0600)
  • Input validation and sanitization

See the Security Guide for comprehensive security documentation.

Troubleshooting

Tools not visible in Claude Desktop?

  • Use absolute paths in config
  • Restart Claude Desktop completely
  • Check JSON syntax

Database connection errors?

  • Ensure database connection is configured before starting the server (via config file, environment variables, or command-line flags)
  • Verify PostgreSQL is running: pg_isready
  • Check connection parameters are correct

See the Troubleshooting Guide for detailed solutions.

Support

To report an issue with the software, visit: GitHub Issues

For more information, visit docs.pgedge.com

This project is licensed under the PostgreSQL License.

來源:README.md,提交 d451081

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分