Back to Home
PawelK2012 icon

database-query-server

Verified Safe

by PawelK2012

Overview

A Go-based MCP server that provides a JSON-RPC API for executing SQL SELECT queries, prepared statements, and retrieving schema information for PostgreSQL databases.

Installation

Run Command
make run

Environment Variables

  • POSTGRES_USER
  • POSTGRES_PW
  • POSTGRES_DB
  • PGADMIN_DEFAULT_EMAIL
  • PGADMIN_DEFAULT_PASSWORD

Security Notes

The server uses parameterized queries (`ExecPrepared`, `GetSchema`, `GetStatus`) which effectively prevents SQL injection for these operations. For `execute_query`, there is an explicit check (`internal/utils/utils.go:CheckFirstWord`) to ensure the query starts with 'SELECT', significantly mitigating risks of arbitrary DDL/DML execution. Environment variables are used for sensitive database credentials. Direct SQL execution for 'SELECT' queries still carries inherent risks, but the implemented controls greatly reduce the attack surface. No 'eval' or similar dangerous patterns are used.

Similar Servers

Stats

Interest Score0
Security Score8
Cost ClassMedium
Avg Tokens3000
Stars0
Forks0
Last Update2025-11-28

Tags

Database interactionSQL queryPostgreSQLMCP ServerGo