Supports PostgreSQL installation and configuration on Linux platforms with customized setup instructions tailored to Linux environments.
Provides platform-specific PostgreSQL installation and configuration guidance for macOS systems.
Requires Node.js runtime environment for server operation, with specific version requirements (≥ 18.0.0) for proper functionality.
Provides comprehensive PostgreSQL database management capabilities, including database analysis, schema management, data migration, and real-time monitoring. Enables analyzing configurations, debugging issues, creating and altering tables, exporting/importing data between databases, and monitoring performance metrics.
PostgreSQL MCP Server
A Model Context Protocol (MCP) server that provides comprehensive PostgreSQL database management capabilities for AI assistants.
🚀 What's New: This server has been completely redesigned from 46 individual tools to 17 intelligent tools through consolidation (34→8 meta-tools) and enhancement (+4 new tools), providing better AI discovery while adding powerful data manipulation and comment management capabilities.
Quick Start
Option 1: npm (Recommended)
Add to your MCP client configuration:
Option 2: Install via Smithery
Option 3: Manual Installation (Development)
Add to your MCP client configuration:
What's Included
17 powerful tools organized into three categories:
- 🔄 Consolidation: 34 original tools consolidated into 8 intelligent meta-tools
- 🔧 Specialized: 5 tools kept separate for complex operations
- 🆕 Enhancement: 4 brand new tools (not in original 46)
📊 Consolidated Meta-Tools (8 tools)
- Schema Management - Tables, columns, ENUMs, constraints
- User & Permissions - Create users, grant/revoke permissions
- Query Performance - EXPLAIN plans, slow queries, statistics
- Index Management - Create, analyze, optimize indexes
- Functions - Create, modify, manage stored functions
- Triggers - Database trigger management
- Constraints - Foreign keys, checks, unique constraints
- Row-Level Security - RLS policies and management
🚀 Enhancement Tools (4 NEW tools)
Brand new capabilities not available in the original 46 tools
- Execute Query - SELECT operations with count/exists support
- Execute Mutation - INSERT/UPDATE/DELETE/UPSERT operations
- Execute SQL - Arbitrary SQL execution with transaction support
- Comments Management - Comprehensive comment management for all database objects
🔧 Specialized Tools (5 tools)
- Database Analysis - Performance and configuration analysis
- Debug Database - Troubleshoot connection, performance, locks
- Data Export/Import - JSON/CSV data migration
- Copy Between Databases - Cross-database data transfer
- Real-time Monitoring - Live database metrics and alerts
Example Usage
📚 Documentation
📋 Complete Tool Schema Reference - All 18 tool parameters & examples in one place
For additional information, see the docs/
folder:
- 📖 Usage Guide - Comprehensive tool usage and examples
- 🛠️ Development Guide - Setup and contribution guide
- ⚙️ Technical Details - Architecture and implementation
- 👨💻 Developer Reference - API reference and advanced usage
- 📋 Documentation Index - Complete documentation overview
Features Highlights
🔄 Consolidation Achievements
✅ 34→8 meta-tools - Intelligent consolidation for better AI discovery
✅ Multiple operations per tool - Unified schemas with operation parameters
✅ Smart parameter validation - Clear error messages and type safety
🆕 Enhanced Data Capabilities
✅ Complete CRUD operations - INSERT/UPDATE/DELETE/UPSERT with parameterized queries
✅ Flexible querying - SELECT with count/exists support and safety limits
✅ Arbitrary SQL execution - Transaction support for complex operations
🔧 Production Ready
✅ Flexible connection - CLI args, env vars, or per-tool configuration
✅ Security focused - SQL injection prevention, parameterized queries
✅ Robust architecture - Connection pooling, comprehensive error handling
Prerequisites
- Node.js ≥ 18.0.0
- PostgreSQL server access
- Valid connection credentials
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Create a Pull Request
See Development Guide for detailed setup instructions.
License
AGPLv3 License - see LICENSE file for details.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
A Model Context Protocol server that enables powerful PostgreSQL database management capabilities including analysis, schema management, data migration, and monitoring through natural language interactions.
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server providing both read and write access to PostgreSQL databases, enabling LLMs to query data, modify records, and manage database schemas.Last updated -1447JavaScript
- -securityFlicense-qualityA Model Context Protocol server that enables performing PostgreSQL database operations (create, read, update, delete) on User and Post entities through MCP tools.Last updated -TypeScript
- -securityAlicense-qualityA Model Context Protocol server that enables interaction with PostgreSQL databases to list tables, retrieve schemas, and execute read-only SQL queries.Last updated -20JavaScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that enables interaction with PostgreSQL databases for analyzing setups, debugging issues, managing schemas, migrating data, and monitoring performance.Last updated -10TypeScriptMIT License