Add PostgreSQL DBA MCP server#31
Open
viveksingh112 wants to merge 2 commits into
Open
Conversation
…fe, read-only diagnostic access to Amazon RDS and Aurora PostgreSQL instances via AWS DevOps Agent. - 10 tools, 39 predefined queries across 11 diagnostic categories - Covers health check, parameter tuning, pre-upgrade validation, SQL tuning - Lambda + FastMCP + pg8000 with Streamable HTTP transport - SAM template for one-command deployment (VPC + Secrets Manager) - Tool-level instance/database allowlists for defense-in-depth - Tested across RDS PG15, PG16, and Aurora PG16
…Consolidates 8 diagnostic features into a single SKILL.md per reviewer feedback. Includes decision trees, thresholds, patterns, and DBA safety rules for: health check, vacuum/bloat, parameter tuning, index optimization, pre-upgrade validation, SQL plan analysis, replication health, and connection/lock troubleshooting. Key guardrails baked in: - Never VACUUM FULL (use pg_repack) - Always CREATE INDEX CONCURRENTLY - Aurora vs RDS parameter differences - Never kill autovacuum workers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary Adds a query-allowlist MCP server for AWS DevOps Agent that provides safe, read-only diagnostic access to Amazon RDS and Aurora PostgreSQL instances. ## What it does - 10 tools, 39 predefined diagnostic queries across 11 categories - Covers: health check, parameter tuning, pre-upgrade validation, SQL tuning, vacuum analysis, index optimization, replication health - Lambda + FastMCP + pg8000 with Streamable HTTP transport - SAM template for one-command deployment (VPC + Secrets Manager + Lambda Web Adapter) - Tool-level instance/database allowlists for defense-in-depth - Production enforcement (wildcard allowlists blocked in prod stage) ## Security model - Query-allowlist approach — no dynamic SQL, only 39 predefined read-only queries - Credentials from AWS Secrets Manager (never exposed) - VPC deployment for database connectivity - Read-only database user with SELECT-only privileges ## Testing - Validated 30/30 queries across RDS PostgreSQL 15, RDS PostgreSQL 16, and Aurora PostgreSQL 16 - Registered and tested end-to-end with AWS DevOps Agent AgentSpace via SigV4 - All 10 tools verified working in DevOps Agent chat interface - Unit tests for allowlist integrity and SQL safety validation (13/13 passing) ## Structure
mcp/postgresql-dba-mcp/ ├── README.md ├── LICENSE ├── template.yaml # SAM deployment template ├── src/ │ ├── server.py # FastMCP server with all tools and queries │ └── run.sh # Lambda Web Adapter entry point ├── layers/dependencies/ │ ├── requirements.txt # fastmcp, pg8000, boto3 │ └── Makefile # Layer build └── tests/ ├── test_allowlist.py # Unit tests └── e2e_test.py # End-to-end test framework