pg-mcp
by loadept
Overview
Serves as a Model Context Protocol (MCP) server providing read-only PostgreSQL database access and introspection tools.
Installation
docker run --rm -i loadept/pg-mcp:latest -u "postgres://usuario:contraseƱa@host:puerto/basedatos?sslmode=disable"Security Notes
The `execute_query` tool directly passes user-provided SQL queries to the database without any form of sanitization or strict validation to enforce 'SELECT only' or other safe practices. This creates a critical SQL injection vulnerability, allowing an attacker to execute arbitrary SQL commands (e.g., DML, DDL) if the database user has sufficient privileges.
Similar Servers
MCP-PostgreSQL-Ops
This MCP server provides comprehensive PostgreSQL database operations, monitoring, and management through natural language queries.
MsSqlMCP
Provides an MCP Server for SQL Server database schema inspection and safe, read-only query execution to AI clients.
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-postgres
Provides a read-only Model Context Protocol (MCP) server for AI tools (like Claude Code, Cursor) to query a PostgreSQL database directly.