Provides tools for PostgreSQL database interactions including listing tables, retrieving database information, and executing read-only SQL queries with security-first validation
Enterprise PostgreSQL MCP Server v2
A production-ready Model Context Protocol (MCP) server for PostgreSQL database interactions.
Features
- ✅ Working MCP Server: Simple and reliable PostgreSQL MCP implementation
- ✅ Read-only by Default: Security-first approach with query validation
- ✅ Multiple Tools: Database listing, table inspection, and SQL queries
- ✅ Cursor Integration: Ready for Cursor IDE integration
- ✅ FastMCP Support: Both simple and FastMCP implementations included
Quick Start
1. Setup Environment
2. Configure Database
Set your PostgreSQL connection string:
3. Test the Server
Cursor Integration
Add to your Cursor MCP configuration (~/.cursor/mcp.json
):
Available Tools
list_tables
: List all tables in the databasedatabase_info
: Get database connection informationsql_query
: Execute read-only SQL queries (SELECT, WITH, EXPLAIN, SHOW)
Security
- Read-only queries only (INSERT, UPDATE, DELETE blocked)
- Query validation and sanitization
- Connection string masking in responses
- Transaction-based execution with rollback
Development
Built with:
- Python 3.13+
- asyncpg for PostgreSQL connectivity
- FastMCP for enhanced MCP features
- JSON-RPC 2.0 protocol compliance
License
MIT License - see LICENSE file for details.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables secure read-only interactions with PostgreSQL databases through natural language. Provides database inspection, table listing, and SQL query execution with built-in security validation.