PostgreSQL Full Access MCP Server
@kamusis
A fully featured PostgreSQL server adapter for the Model Context Protocol (MCP), providing robust read/write access and enhanced schema metadata for LLM and AI-powered applications. Supports full SQL DML/DDL operations.
Overview
What is PostgreSQL Full Access MCP Server?
A Model Context Protocol server that provides full read-write access to PostgreSQL databases. It is an independently maintained fork of the original mcp-postgres-full-access, enabling LLMs to both query and modify database content with transaction management and safety controls.
How to use PostgreSQL Full Access MCP Server?
Install via npx and configure Claude Desktop by editing claude_desktop_config.json with the server command and connection string. Use environment variables to customize timeouts and safety limits. The server can also be run in a Docker container. Example configurations are provided in the README.
Key features of PostgreSQL Full Access MCP Server
- Execute DML, DDL, DCL, and TCL operations with safety controls
- Rich schema information including primary keys, foreign keys, and indexes
- Transaction management with explicit commit and rollback
- SQL query classification and automatic timeout monitoring
- Two-step commit process requiring user approval
- Docker support for containerized deployment
Use cases of PostgreSQL Full Access MCP Server
- Create new tables and insert data with user approval
- Perform read-only data analysis and reporting
- Manage database objects and schema changes
- Review and safely commit write transactions after verification
FAQ from PostgreSQL Full Access MCP Server
How does PostgreSQL Full Access MCP Server differ from the official MCP PostgreSQL server?
The official server is read-only; this server provides full read-write access with transaction management and safety controls.
What environment variables are available?
Key variables include TRANSACTION_TIMEOUT_MS, MAX_CONCURRENT_TRANSACTIONS, ENABLE_TRANSACTION_MONITOR, PG_STATEMENT_TIMEOUT_MS, PG_MAX_CONNECTIONS, and MONITOR_INTERVAL_MS. Defaults are specified in the README.
What permissions should I grant the database user?
Create a dedicated user with restricted grants. Avoid superuser access. For example, grant SELECT on all tables and INSERT/UPDATE/DELETE only on specific tables as needed.
How does the two-step commit safety workflow work?
For write operations, the SQL executes in a transaction and the conversation ends. The user reviews results, then starts a new conversation saying "Yes" to commit or "No" to rollback.
Can I run this server in Docker?
Yes. Build the Docker image and run it with a PostgreSQL connection string. On macOS use host.docker.internal to reach the host network.