pgmcp
Verified Safeby kyagoshi
Overview
The server provides introspection capabilities for PostgreSQL databases, allowing users to list tables, retrieve schema details, get index information, discover foreign keys, and generate Mermaid-formatted Entity-Relationship diagrams.
Installation
uvx --from git+https://github.com/kyagoshi/pgmcp pgmcpEnvironment Variables
- PGHOST
- PGPORT
- PGDATABASE
- PGUSER
- PGPASSWORD
Security Notes
The server explicitly establishes all database connections as read-only (`conn.set_session(readonly=True)`), preventing any write operations (INSERT, UPDATE, DELETE, CREATE). All SQL queries use parameterized statements (`%s`), effectively mitigating SQL injection risks. Database credentials are securely loaded from environment variables, not hardcoded. The project also incorporates a `pip-audit` workflow to scan for dependency vulnerabilities.
Similar Servers
enhanced-postgres-mcp-server
This server acts as a Model Context Protocol interface for PostgreSQL, enabling LLMs to query data, modify records, and manage database schema objects with read and write capabilities.
jewei-mssql-mcp-server
Provides a Micro-Agent Protocol (MCP) server for querying Microsoft SQL Server databases and retrieving table structures.
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.