Back to Home
vpro1032 icon

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

Run Command
docker exec -i postgresql-mcp-server node dist/index.js

Environment 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

Stats

Interest Score0
Security Score2
Cost ClassMedium
Avg Tokens2500
Stars0
Forks0
Last Update2025-12-07

Tags

PostgreSQLDatabaseMCPAI ToolsDocker