Back to Home
sgaunet icon

postgresql-mcp

Verified Safe

by sgaunet

Overview

Provides a Model Context Protocol (MCP) server for Claude Code to interact with PostgreSQL databases through a set of read-only tools.

Installation

Run Command
postgresql-mcp

Environment Variables

  • POSTGRES_URL
  • DATABASE_URL

Security Notes

The server implements strong security practices by enforcing read-only operations (only SELECT and WITH statements are allowed for user-provided queries). It explicitly validates query types to prevent write/DDL operations. Database connection details are securely handled via environment variables, and parameterized queries are used for user-supplied query arguments, mitigating SQL injection risks. A minor note is that `GetTableStats` uses string concatenation for schema and table names in a fallback query, but these are quoted.

Similar Servers

Stats

Interest Score34
Security Score9
Cost ClassMedium
Avg Tokens1000
Stars3
Forks0
Last Update2025-12-03

Tags

PostgreSQLMCPClaude CodeDatabase ToolsGo Lang