Back to Home
sgaunet icon

postgresql-mcp

Verified Safe

by sgaunet

Overview

Provides PostgreSQL integration tools as a Model Context Protocol (MCP) server for Claude Code.

Installation

Run Command
postgresql-mcp

Environment Variables

  • POSTGRES_URL
  • DATABASE_URL

Security Notes

The server enforces read-only operations for 'execute_query' and 'explain_query' tools (SELECT and WITH statements only), which significantly reduces risk. It uses parameterized queries and explicitly quotes identifiers in SQL queries where needed, mitigating common SQL injection vulnerabilities. Connection parameters are handled via environment variables or explicit tool calls, preventing hardcoded secrets. The server communicates over standard I/O (stdio), limiting direct network exposure to external clients. There is a minor, theoretical risk if the schema or table names themselves could somehow embed injection attempts *after* quoting in specific fallback queries within `ListTablesWithStats` or `GetTableStats`, but given MCP's structured tool invocation, this is highly unlikely to be exploitable without highly unusual input.

Similar Servers

Stats

Interest Score22
Security Score9
Cost ClassMedium
Avg Tokens250
Stars3
Forks0
Last Update2026-01-01

Tags

PostgreSQLMCP ServerDatabase ToolsGoClaude Code