CM

corporatepiyush/mcp-pg-rust

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

22 stars 4 forks 质量 68 趋势 14Apache-2.0

用 Rust 编写的 Postgresql MCP 服务器

概览

是一款高性能MCP服务器,将PostgreSQL引入Claude Desktop及任何兼容MCP的AI工具。133个PostgreSQL工具,无锁连接池,延迟低于10毫秒。 默认情况下,没有工具被暴露。你一次用 -enable- 标志(或 --enable-all)逐个启用它们。服务器启动时没有启用标志,会发布工具列表并拒绝所有工具/调用。参见工具暴露。 四台用Rust编写的高性能MCP服务器之一——mcp-postgres ·mcp-filesystem ·mcp-内存·mcp-web-search。所有这些都实现了MCP协议修订。 工具是自愿加入的——通过一个或多个——启用——标记(或——全部启用)。没有这些标志,服务器就不会暴露工具。 HTTP/2 传输可以通过 TLS 提供(rustls,ring provider —— 与 sslmode 门控的 PostgreSQL 连接相同,不支持 OpenSSL/aws-lc)。

概述(AI 翻译)

mcp-postgres 是一台高性能 MCP 服务器,将 PostgreSQL 带入 Claude Desktop 及任何兼容 MCP 的 AI 工具。133 个 PostgreSQL 工具,无锁连接池,延迟低于 10ms。

工具是自愿加入的(5.2.0+)。 默认不会暴露任何工具。你会启用 一次用--enable- 标志(或)逐一进行 --enable-all)。一个服务器启动时没有启用标志,会宣布一个空 工具列表并拒绝所有tools/call。参见 工具暴露。

MCP 套件。 四台用 Rust 编写的高性能 MCP 服务器之一—— mcp-postgres · mcp-filesystem · mcp-内存 · mcp-web-search。 所有实现MCP协议修订版**2025-11-25**。

快速启动

安装

跑

工具是选择加入的——通过一个或多个--enable- 标志(或 --enable-all)。没有它们,服务器不会暴露任何工具。

克劳德桌面

加到claude_desktop_config.json:

完整设置指南 →


为什么是mcp-postgres?

功能 MCP-postgres DIY / PSQL

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

mcp-postgres

mcp-postgres is a high-performance MCP server that brings PostgreSQL into Claude Desktop and any MCP-compatible AI tool. 133 PostgreSQL tools, lock-free connection pooling, sub-10ms latency.

Tools are opt-in (5.2.0+). No tools are exposed by default. You enable them one category at a time with --enable- flags (or --enable-all). A server started with no enable flags advertises an empty tool list and rejects every tools/call. See Tool Exposure.

MCP suite. One of four high-performance MCP servers written in Rust — mcp-postgres · mcp-filesystem · mcp-memory · mcp-web-search. All implement MCP protocol revision 2025-11-25.

Quick Start

Install

# From crates.io
cargo install mcp-postgres

# Or from Homebrew (macOS)
brew tap corporatepiyush/mcp-postgres
brew install mcp-postgres

Run

Tools are opt-in — pass one or more --enable- flags (or --enable-all). Without them the server exposes no tools.

# Stdio mode (for Claude Desktop) — expose read-only query + schema tools
mcp-postgres --database-url "postgres://user:pass@localhost:5432/mydb" --stdio \
  --enable-query --enable-schema

# TCP server (port 3000) — expose everything
mcp-postgres --database-url "postgres://user:pass@localhost:5432/mydb" --enable-all

# HTTP/2 server (port 3001) — query + monitoring only
mcp-postgres --database-url "postgres://user:pass@localhost:5432/mydb" --http-port 3001 \
  --enable-query --enable-monitoring

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "postgres": {
      "command": "mcp-postgres",
      "args": ["--database-url", "postgres://user:pass@localhost:5432/mydb", "--stdio", "--enable-all"]
    }
  }
}

Complete setup guide →


Why mcp-postgres?

Feature mcp-postgres DIY / psql
133 purpose-built tools Schema inspection, DDL, monitoring, replication, batch ops, security audit, text search, extensions, maintenance, and more You build every query from scratch
Lock-free connection pool Zero-mutex crossbeam::ArrayQueue — pure CAS loops, no kernel overhead Deadpool or manual Mutex
Dual-protocol TCP (3000) + HTTP/2 (3001) + stdio — one binary, three transports Multiple servers to wire up
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "postgres": { "command": "mcp-postgres", "args": ["--database-url", "postgres://user:pass@localhost:5432/mydb", "--stdio", "--enable-all"] } } }