Integrates with AWS Secrets Manager to fetch database credentials and enable automatic password rotation with zero downtime for AWS RDS PostgreSQL instances.
Provides production-ready PostgreSQL database access with global connection pooling, transaction-level pooling via PgBouncer, and tools for query execution, schema operations, performance analysis, and index recommendations.
PostgreSQL MCP AllAccess
Production-ready PostgreSQL MCP server with global connection pooling, PgBouncer integration, and automatic password rotation for AWS RDS.
Quick Start (2 minutes)
With AWS Secrets Manager
That's it! The MCP server is now running and Claude Code will auto-detect it.
Optional: Set custom AWS secret names:
Without AWS (Simple Credentials)
What You Get
✅ Global connection pooling - 15 max connections to PostgreSQL (configurable) ✅ Automatic password rotation - Zero downtime when AWS rotates passwords ✅ Transaction-level pooling - Efficient connection reuse across all queries ✅ Production ready - Health checks, logging, monitoring built-in
How It Works
PgBouncer enforces max 15 connections to your PostgreSQL database
Automatic queueing - Extra requests wait, then process when connections free up
Zero config needed - Default settings work for most use cases
Common Tasks
Check if it's running
View logs
Stop server
Change connection limits
Edit pgbouncer/pgbouncer.ini:
Then redeploy: docker-compose up -d --build
Available Tools (Use in Claude)
Query Execution:
list_tables- List tables in a schemaexecute_query- Run any SQL querydescribe_table- See table structureexecute_file- Run SQL from a file
Schema Operations:
list_schemas- List all schemassearch_tables- Find tables by name patternget_database_context- Overview of database structure
Analysis:
explain_query- Get query execution plananalyze_query- Performance analysissuggest_indexes- Index recommendations
Session:
get_session_info- Current session statusget_query_history- View query history
Troubleshooting
Claude Code can't connect
Solution: Restart Claude Code after deploying the MCP server.
"Pool not initialized" error
Solution: Run any query first - pool initializes on first use.
Container won't start
Connection timeout
Increase pool timeout (default 30 seconds):
Too many connections to PostgreSQL
Check your limit:
Should show 2-15 connections (never exceeds default_pool_size).
Configuration
Connection Pool Settings
Environment variables (set before deploying):
PgBouncer limits (edit pgbouncer/pgbouncer.ini):
Understanding the Pool
Question: If 90 Claude sessions query at once, does PostgreSQL see 90 connections?
Answer: NO! PostgreSQL sees maximum 15 connections (or whatever you set in default_pool_size).
Connections auto-release after each query
Extra requests queue and process when connections free up
No session management needed - everything is automatic
Automatic Password Rotation
When AWS rotates your password:
Next query fails with auth error
MCP fetches new password from AWS Secrets Manager
Updates both MCP pool and PgBouncer
Retries query - succeeds!
Zero downtime. No restart needed.
Requirements:
Deploy with
deploy_with_aws_secrets.py(AWS credentials available)AWS secret names configured (done automatically)
Security
✅ Never commit:
.envfiles*.logfilesconfig/postgres_config.ini
✅ Safe to commit:
AWS secret names (e.g., "postgres/dev/db")
Database hostnames (e.g., "mydb.rds.amazonaws.com")
All sensitive data is gitignored automatically.
Advanced
Project Structure
Health Monitoring
Manual Password Refresh
License
Apache License 2.0 - See LICENSE file for details.
Support
Issues: https://github.com/yty-build/postgres_mcp_allaccess/issues
Discussions: https://github.com/yty-build/postgres_mcp_allaccess/discussions
Security: Report privately via GitHub Security Advisories
This server cannot be installed