postgresql-mcp-server
by vpro1032
Overview
Provides a standardized Model Context Protocol (MCP) interface for AI assistants to interact with and manage PostgreSQL databases.
Installation
docker exec -i postgresql-mcp-server node dist/index.jsEnvironment Variables
- POSTGRES_HOST
- POSTGRES_PORT
- POSTGRES_DB
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_MAX_CONNECTIONS
- POSTGRES_IDLE_TIMEOUT
- POSTGRES_CONNECTION_TIMEOUT
- MCP_SERVER_NAME
- LOG_LEVEL
Security Notes
The server has critical SQL injection vulnerabilities. Table names, schema names, column names, and SQL fragments (like WHERE clauses) are often directly interpolated into SQL queries without proper escaping or identifier quoting. For example, `export_table`, `vacuum_table`, `analyze_table`, `insert_data`, `update_data`, and `delete_data` tools are susceptible. An attacker or a malicious/uncontrolled AI agent could craft inputs to these tools (e.g., in `table`, `schema`, `data` keys, `where`, or `returning` arguments) to execute arbitrary SQL commands like `DROP TABLE` or `DELETE` sensitive data. While `pg` parameterization is used for *values*, it does not protect against injection of SQL identifiers or clauses themselves. No direct use of `eval` or obfuscation was found, and credentials are handled via environment variables, but the SQL injection risk is severe.
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.
mcp-servers
Provides an MCP server for Qdrant vector database integration, enabling AI agents to perform semantic search, store documents, and manage collections with advanced multi-tenant filtering capabilities.
dx-mcp-server
Empowers AI applications to interact with and query a user-provided Postgres database via the Model Context Protocol (MCP).
metabase-ai-assistant
The Metabase AI Assistant integrates an AI agent with Metabase to enable AI-powered data exploration, SQL generation, dashboard creation, and Metabase instance management through an MCP client.