MP

mukul975/postgres-mcp-server

开发工具

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

12 stars 10 forks 质量 71 趋势 19MIT

🔄 PostgreSQL MCP Server – AI-Powered PostgreSQL Management & Monitoring. A powerful, AI-integrated PostgreSQL Model Context Protocol (MCP) server for automated database operations, monitoring,...

概览

A powerful, AI-integrated PostgreSQL Model Context Protocol (MCP) server for . Seamlessly manage PostgreSQL with tools and prompts designed for . : https://github.com/mukul975/postgres-mcp-server.git * 🔍 Explore, diagnose & optimize PostgreSQL databases with . * 💬 Interact naturally using for SQL generation, health checks, and performance reviews. * 🛡️ Built-in security, permission validation, and error handling. * ⚙️ Developer-ready integration for , , and custom agents. * ✅ Create/list databases & schemas * ✅ Describe tables, analyze indexes * ✅ Safe SELECT, UPDATE, DELETE execution * 📈 Query performance & execution plan insights * 🔒 Lock analysis, replication lag checks * 🚀 Index, query, and buffer pool optimization * 👥 User creation, role auditing * 🔐 Privilege granting & connection monitoring * 🧪 Table bloat check, autovacuum insights * 💽 WAL logs, checkpoints, long transaction alerts To help you navigate, tools are grouped under the following main categories:

README

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

🔄 PostgreSQL MCP Server – AI-Powered PostgreSQL Management & Monitoring

A powerful, AI-integrated PostgreSQL Model Context Protocol (MCP) server for automated database operations, monitoring, security, diagnostics, and optimization. Seamlessly manage PostgreSQL with tools and prompts designed for AI assistants like Claude and ChatGPT.

GitHub Repository: https://github.com/mukul975/postgres-mcp-server.git


📌 Why Use This?

  • 🔍 Explore, diagnose & optimize PostgreSQL databases with over 200 specialized tools.
  • 💬 Interact naturally using AI prompts for SQL generation, health checks, and performance reviews.
  • 🛡️ Built-in security, permission validation, and error handling.
  • ⚙️ Developer-ready integration for Claude, ChatGPT, and custom agents.

🔑 Features at a Glance

🔧 Core Database Operations

  • ✅ Create/list databases & schemas
  • ✅ Describe tables, analyze indexes
  • ✅ Safe SELECT, UPDATE, DELETE execution

📊 Monitoring & Performance

  • 📈 Query performance & execution plan insights
  • 🔒 Lock analysis, replication lag checks
  • 🚀 Index, query, and buffer pool optimization

🛡️ Security & Access Control

  • 👥 User creation, role auditing
  • 🔐 Privilege granting & connection monitoring

⚙️ Diagnostic Utilities

  • 🧪 Table bloat check, autovacuum insights
  • 💽 WAL logs, checkpoints, long transaction alerts

📚 Tool Categories

To help you navigate, tools are grouped under the following main categories:

  • 🔧 General Database Operations
  • 👥 User & Role Management
  • 📈 Performance Monitoring & Tuning
  • 🔁 Replication & Backup
  • 🔒 Lock & Concurrency Management
  • ✅ Constraint & Integrity Management
  • 📊 Resource and Activity Monitoring
  • 🧰 Index and Table Maintenance
  • 🔬 Advanced Analysis & Diagnostics

🚀 Quick Start

1. Installation

python -m venv venv
source venv/bin/activate   # or venv\Scripts\activate on Windows
pip install -r requirements.txt

2. Configuration

cp .env.example .env  # or use copy on Windows
# Update with:
DATABASE_URL=postgresql://username:password@localhost:5432/db

3. Run the Server

python postgres_server.py

✅ For MCP CLI users:

mcp dev postgres_server.py

🧠 Integrate with Claude Desktop

Example config (claude_desktop_config.json):

{
  "mcpServers": {
    "postgres": {
      "command": "python",
      "args": ["postgres_server.py"],
在 GitHub 查看完整 README

安装

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

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

配置

{ "mcpServers": { "postgres": { "command": "python", "args": ["postgres_server.py"], "cwd": "C:\\path\\to\\postgres-mcp-server", "env": { "DATABASE_URL": "postgresql://username:password@localhost:5432/database" } } } }