PG_SQL_MCP_SERVER
Verified Safeby TomerGutman1
Overview
Production-ready PostgreSQL server supporting both MCP and A2A protocols for secure, read-only database access.
Installation
docker-compose up -dEnvironment Variables
- DB_HOST
- DB_PORT
- DB_USER
- DB_PASSWORD
- DB_NAME
- SECRET_KEY
Security Notes
The server implements strong multi-layered security measures, including SQL guardrails to prevent DDL/DML operations and common injection patterns (like `DROP`, `DELETE`, `pg_read_file`), Role-Based Access Control (RBAC) for granular permissions on databases, schemas, and tables, automatic row limiting and query timeouts. It supports various SSL/TLS modes for secure connections. Audit logging is comprehensive, and the configuration explicitly warns against hardcoded default secrets in production, recommending environment variables instead. While `sqlglot` is used for robust SQL parsing, a regex-based fallback for table extraction exists, which is a minor theoretical weakening compared to pure AST parsing, but still guarded by the overall validation. The project also provides explicit instructions on production security hardening (e.g., reverse proxy, secrets management).
Similar Servers
mcp-server-neon
Enables natural language interaction with Neon Postgres databases, facilitating database management, migrations, and query optimization via an LLM agent.
MCP-PostgreSQL-Ops
This MCP server provides comprehensive PostgreSQL database operations, monitoring, and management through natural language queries.
agentor
Deploy scalable AI agents with tool integrations (weather, email, GitHub, etc.) and support for A2A and MCP communication protocols.
tiger-docs-mcp-server
An MCP server and Claude plugin providing AI assistants with advanced PostgreSQL knowledge through semantic documentation search and curated best practice skills.