Back to Home

PG_SQL_MCP_SERVER

Verified Safe

by TomerGutman1

Overview

Production-ready PostgreSQL server supporting both MCP and A2A protocols for secure, read-only database access.

Installation

Run Command
docker-compose up -d

Environment 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

Stats

Interest Score0
Security Score9
Cost ClassMedium
Avg Tokens750
Stars0
Forks0
Last Update2025-11-24

Tags

PostgreSQLDatabaseMCPA2ASecurityObservability