Back to Home
gharshit icon

mcpServer

by gharshit

Overview

Provides a standardized interface for AI assistants to interact with PostgreSQL databases securely and contextually.

Installation

Run Command
uv run python main.py

Environment Variables

  • MCP_TRANSPORT
  • MCP_HOST
  • MCP_PORT

Security Notes

The `run_sql_query` tool, which is central to database interaction, employs a keyword-based filtering mechanism to prevent forbidden operations (delete, drop, update, insert, etc.). This approach is highly vulnerable to bypasses and SQL injection. An attacker could use various techniques such as comments (e.g., `SELECT * FROM users; -- DROP TABLE orders;`), capitalization (`UpDate`), or advanced SQL constructs to circumvent these filters and execute arbitrary malicious SQL commands if the underlying PostgreSQL user account has the necessary permissions. The server's core security objective to prevent data manipulation is not adequately met by the current query validation logic. For instance, `SELECT 1; DROP TABLE users;` would likely bypass the filter. The database connection parameters are specified in `config.yaml`, which should be secured and ideally managed through environment variables or a secrets manager in production, as directly committing it to a repository would expose credentials.

Similar Servers

Stats

Interest Score0
Security Score3
Cost ClassLow
Avg Tokens100
Stars0
Forks0
Last Update2025-12-11

Tags

AIDatabasePostgreSQLMCPAPI