postgresql-mcp
Verified Safeby neverinfamous
Overview
Enabling AI agents to programmatically interact with PostgreSQL databases through a rich set of specialized tools and a sandboxed code execution environment.
Installation
node dist/cli.js --transport stdio --postgres postgres://user:password@localhost:5432/databaseEnvironment Variables
- POSTGRES_HOST
- POSTGRES_PORT
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DATABASE
- LOG_LEVEL
- POSTGRES_TOOL_FILTER
- MCP_TOOL_FILTER
- TOOL_FILTER
- MCP_TRANSPORT
- PORT
- HOST
- OAUTH_ENABLED
- OAUTH_ISSUER
- OAUTH_AUDIENCE
- OAUTH_JWKS_URI
- CODEMODE_ISOLATION
Security Notes
The `codemode` module implements robust sandboxing using Node.js `vm` or `worker_threads`, explicitly blocking access to dangerous Node.js globals (like `require`, `process`, `eval`, filesystem, and networking modules). It uses regex patterns to detect and prevent common malicious code injection attempts. The `HttpTransport` also enforces strong network security measures including rate limiting, maximum request body size, HTTP Strict Transport Security (HSTS), Content Security Policy (CSP), and other security headers. OAuth 2.1 is supported for external authentication and authorization. While these layers provide strong protection, inherent theoretical limitations exist for any in-process sandbox compared to full containerization.
Similar Servers
mcp-server-neon
The Neon MCP Server allows users to interact with and manage their Neon Postgres databases using natural language commands, acting as a bridge between AI agents/LLMs and the Neon API and database operations.
MCP-PostgreSQL-Ops
The MCP server provides professional operations, monitoring, and management capabilities for PostgreSQL databases using natural language queries.
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.
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.