postgresql-mcp-js
Verified Safeby 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
bun run server.tsEnvironment 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
enhanced-postgres-mcp-server
This server acts as a Model Context Protocol interface for PostgreSQL, enabling LLMs to query data, modify records, and manage database schema objects with read and write capabilities.
postgres-mysql-mcp-server
A Model Context Protocol (MCP) server that enables AI assistants to query PostgreSQL and MySQL databases for schema introspection and data retrieval.
dx-mcp-server
Empowers AI applications to interact with and query a user-provided Postgres database via the Model Context Protocol (MCP).
postgresql-mcp
Provides PostgreSQL integration tools as a Model Context Protocol (MCP) server for Claude Code.