Back to Home
s2mgtvodois2 icon

postgresql-mcp-js

Verified Safe

by s2mgtvodois2

Overview

Simplifies PostgreSQL database interactions for AI models or applications using the Model Context Protocol (MCP) by exposing schema, data, and query execution as tools and resources.

Installation

Run Command
bun run server.ts

Environment Variables

  • POSTGRES_HOST
  • POSTGRES_PORT
  • POSTGRES_DB
  • POSTGRES_USER
  • POSTGRES_PASSWORD

Security Notes

The server uses parameterized queries (`Bun.sql`) to prevent SQL injection. It explicitly restricts the `execute-query` tool to read-only operations (SELECT, EXPLAIN, WITH), preventing accidental or malicious data modification. Secrets are handled via environment variables. Communication happens over standard I/O (StdioServerTransport), reducing direct network attack surface. Row limits are applied to data retrieval. The `SECURITY.md` file outlines robust security practices and considerations. The primary risk would be misconfiguring the PostgreSQL database itself or its network access, which is external to this server's code.

Similar Servers

Stats

Interest Score0
Security Score9
Cost ClassMedium
Avg Tokens1000
Stars0
Forks0
Last Update2026-01-19

Tags

postgresqldatabasemcpbunai