PostgreSQL Database

•
1
•

Enables secure, read-only access to PostgreSQL databases for AI assistants through the Model Context Protocol (MCP).

This tool acts as a secure Model Context Protocol (MCP) server, offering read-only access to PostgreSQL databases specifically for AI assistants. It ensures data integrity and operational safety by rejecting all write and DDL operations through parse-based protection, implementing per-transaction safeguards like statement and lock timeouts, and enforcing hard row caps. Designed for flexibility, it supports multiple connection environments (e.g., local, staging, production) with dedicated connection pools, allowing AI clients to query different database instances without server restarts. It also provides structured tools for listing tables, inspecting schemas, and running `SELECT`/`WITH` queries.

主な機能

01Per-transaction safety with read-only mode, statement/lock/idle timeouts, and hard row caps.
02Parse-based write protection to reject INSERT, UPDATE, DELETE, MERGE, DROP, CREATE, ALTER, TRUNCATE, and multi-statement payloads.
03Supports per-environment connection pools, allowing selection of local, staging, or production databases per call.
04Provides read-only access to PostgreSQL databases for AI assistants (tables, schemas, SELECT/WITH queries, EXPLAIN plans).
051 GitHub stars
06Efficiently handles large query results with streamed batched fetches.

ユースケース

01Enabling AI-driven analytical queries across different database environments (development, staging, production).
02Providing AI models with structured database information (table schemas, sample data) for tasks like code generation or data analysis.
03Allowing AI assistants to safely explore and query PostgreSQL database schemas and data without risk of modification.