postgresql-mcp
Verified Safeby sgaunet
Overview
Provides PostgreSQL integration tools as a Model Context Protocol (MCP) server for Claude Code.
Installation
postgresql-mcpEnvironment 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
consult-llm-mcp
An MCP server that allows AI agents like Claude Code to consult stronger, more capable AI models (e.g., GPT-5.2, Gemini 3.0 Pro) for complex code analysis, debugging, and architectural advice.
postgres-mysql-mcp-server
A Model Context Protocol (MCP) server that enables AI assistants to query PostgreSQL and MySQL databases for schema introspection and data retrieval.
mcp-devtools-server
This MCP server standardizes development tool patterns and provides AI-powered integrations to enable Claude Code to generate code more efficiently, reduce errors, and improve autocorrection for various programming languages and workflows.
dx-mcp-server
Empowers AI applications to interact with and query a user-provided Postgres database via the Model Context Protocol (MCP).