
mukul975/postgres-mcp-server
Developer tools🔄 PostgreSQL MCP Server – AI-Powered PostgreSQL Management & Monitoring. A powerful, AI-integrated PostgreSQL Model Context Protocol (MCP) server for automated database operations, monitoring,...
Overview
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
🔄 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):
🔍 Tool Search & Complete Reference (238 Tools)
🔎 Tool Search Bar
Quick Tool Finder: Use Ctrl+F (or Cmd+F) to search for specific tools by name, category, or functionality.
📊 Tools by Category Overview
| Category | Count | Description |
|---|---|---|
| 🧱 Core Database | 26 | Basic database operations, schema management |
| 👥 User & Security | 18 | User management, roles, permissions |
| 📈 Performance | 45 | Monitoring, analysis, optimization |
| 🔒 Locks & Concurrency | 22 | Lock analysis, blocking queries, deadlocks |
| 🛠️ Maintenance | 28 | VACUUM, ANALYZE, table maintenance |
| 📊 Index Management | 15 | Index creation, analysis, optimization |
| 🔄 Replication & Backup | 20 | Replication monitoring, backup status |
| 📋 Table Operations | 25 | Table statistics, constraints, data |
| 📦 Extensions & Objects | 18 | Extensions, functions, triggers |
| ⚙️ Configuration | 12 | Settings, variables, system info |
| 🧪 Advanced Analysis | 29 | Deep diagnostics, predictions, recommendations |
📚 Complete Tool Reference
🧱 Core Database Operations (25 tools)
👥 User & Security Management (18 tools)
📈 Performance Monitoring & Analysis (45 tools)
🔒 Locks & Concurrency Management (22 tools)
🛠️ Maintenance & Optimization (28 tools)
📊 Index Management & Analysis (15 tools)
🔄 Replication & Backup Management (20 tools)
📋 Table Operations & Constraints (25 tools)
📦 Extensions & Database Objects (18 tools)
⚙️ Configuration & System Info (12 tools)
🧪 Advanced Analysis & Predictions (29 tools)
🧰 Quick Tool Categories
💬 Prompt Examples for AI Agents
👁️ Database Insight
“List all indexes in the public schema” “Show detailed structure of the
orderstable”
🚀 Performance
“What are the slowest queries?” “Analyze unused indexes”
⚙ Maintenance
“VACUUM ANALYZE the
productstable” “Find bloated tables in the database”
🔒 Security
“List all users and their roles” “Show active connections and privilege levels”
📚 Use Cases
✅ Health & Diagnostics
- Full PostgreSQL system health check
- Query and index optimization
⚙ Admin & Automation
- AI-based schema exploration
- SQL query building with NLP
🔐 Security & Auditing
- Role auditing, connection analysis
- Secure query validation and permission check
🗞️ License
This project is licensed under the MIT License – see the LICENSE file for details.
⭐ Contribute & Support
If you find this useful, please:
- ⭐ Star the repo
- 🍝 Fork it
- 🛠️ Submit issues or PRs
🧠 Let’s build smarter PostgreSQL automation – one prompt at a time.
🔍 GitHub Search Tags
#PostgreSQL #MCP #AI_Database_Tools #Claude #Query_Optimizer #Database_Health_Check #Python_PostgreSQL #DevOps_AI #Database_Monitoring #OpenSource
Install
This server does not publish a one-line install command.
Open the repository installation guide New to MCP? Start with the mcpskill.org guide →Configuration
{
"mcpServers": {
"postgres": {
"command": "python",
"args": ["postgres_server.py"],
"cwd": "C:\\path\\to\\postgres-mcp-server",
"env": {
"DATABASE_URL": "postgresql://username:password@localhost:5432/database"
}
}
}
}