A Model Context Protocol (MCP) server that enables AI models, particularly Claude, to interact with PostgreSQL databases through standardized tools like query, execute, list_schemas, list_tables, and describe_table. Version 0.1.3 is the latest stable release, currently in early development with active updates. It supports both PostgreSQL-style ($1, $2) and MySQL-style (?) parameter placeholders for prepared statements, multi-schema operations, and TypeScript types. Unlike generic database MCP servers, it is purpose-built for PostgreSQL, offering secure connection handling via environment variables and automatic cleanup. It is designed for use with MCP-compatible hosts (e.g., Claude Desktop) and should not be confused with direct database client libraries.
npm install mcp-postgres-serverVerified import paths — ran on the pinned version, not inferred.
Runs the MCP PostgreSQL server via npx and shows the required environment variable configuration for MCP client integration.
Set PG_HOST, PG_PORT, PG_USER, PG_PASSWORD, PG_DATABASE in the environment or MCP client config.
Use connection pooling externally or consider alternative MCP servers for high-throughput scenarios.
Avoid using the connect_db tool unless you need to override connection parameters per request.
Run 'npm install mcp-postgres-server' globally or use 'npx -y mcp-postgres-server'.
Ensure PG_HOST is set to a valid PostgreSQL hostname or IP address in the environment.