Back to Home
techslaves icon

postgresql-mcp-server

by techslaves

Overview

Integrates Spring AI with a PostgreSQL database to expose read-only database operations as tools for AI agents.

Installation

Run Command
java -Dspring.main.banner-mode=off -Dserver.port=0 -jar target/postgres-mcp-server-0.0.1-SNAPSHOT.jar

Environment Variables

  • DB_URL
  • DB_USER
  • DB_PASSWORD

Security Notes

CRITICAL: The `DatabaseService.executeQuery` method directly executes user-provided SQL strings without proper parameterization, making it highly vulnerable to SQL injection, even with the `SELECT` prefix check. An attacker could craft a `SELECT` statement to exfiltrate sensitive data, perform denial-of-service, or execute other malicious queries depending on database permissions. The example `claude_desktop_config.json` also hardcodes database credentials, which is a security risk if not managed properly.

Similar Servers

Stats

Interest Score0
Security Score2
Cost ClassMedium
Avg Tokens750
Stars0
Forks0
Last Update2025-11-29

Tags

Spring AIPostgreSQLMCPDatabase ToolsJava