Back to Home
RafaPan04 icon

mcp-server

by RafaPan04

Overview

This server provides a Model Context Protocol (MCP) interface to a PostgreSQL database, allowing clients (e.g., AI models) to query the database and retrieve table schemas via defined tools.

Installation

Run Command
npm start

Environment Variables

  • DATABASE_URL
  • POSTGRES_USER
  • POSTGRES_HOST
  • POSTGRES_DB
  • POSTGRES_PASSWORD
  • POSTGRES_PORT
  • PORT

Security Notes

CRITICAL SQL INJECTION VULNERABILITY: The `query_database` tool directly executes the `args.query` parameter (`pool.query(args.query)` in `src/tools/queryDatabase.ts`) without any sanitization or parameterization. This allows an attacker to inject arbitrary SQL commands, potentially leading to data exfiltration, modification, deletion, or even remote code execution depending on database configuration. This is a severe vulnerability making the server unsafe to run with untrusted input. No hardcoded secrets were found as database configuration uses environment variables.

Similar Servers

Stats

Interest Score0
Security Score1
Cost ClassHigh
Avg Tokens2000
Stars0
Forks0
Last Update2026-01-18

Tags

Model Context ProtocolPostgreSQLDatabase ToolsAPIServer