Back to Home
neverinfamous icon

postgresql-mcp

Verified Safe

by neverinfamous

Overview

Enables AI assistants to interact with PostgreSQL databases, providing specialized tools for database operations, performance monitoring, schema management, and extension control through the Model Context Protocol.

Installation

Run Command
node dist/cli.js --transport stdio --postgres postgres://user:password@localhost:5432/database

Environment Variables

  • POSTGRES_HOST
  • POSTGRES_PORT
  • POSTGRES_USER
  • POSTGRES_PASSWORD
  • POSTGRES_DATABASE
  • POSTGRES_TOOL_FILTER
  • MCP_TOOL_FILTER
  • TOOL_FILTER
  • PGHOST
  • PGPORT
  • PGUSER
  • PGPASSWORD
  • PGDATABASE

Security Notes

The server uses parameterized queries via the 'pg' library to prevent SQL injection for direct query execution. It explicitly defines OAuth 2.0 for authentication and handles database connection details securely, including SSL options. Tools generating SQL return the SQL string for client-side use, not for direct, unsafe execution within the server. No 'eval' or other dangerous dynamic code execution patterns were found.

Stats

Interest Score55
Security Score9
Cost ClassLow
Avg Tokens500
Stars1
Forks0
Last Update2025-12-14

Tags

PostgreSQLDatabaseAI ToolsData ManagementSQLMonitoring