PostgreSQL DBA Tools
๐ Give AI assistants full PostgreSQL DBA superpowers โ 30+ tools for performance analysis, bloat detection, lock/deadlock monitoring, autovacuum & schema inspection. No extensions required. PG 12-18.
What is PostgreSQL DBA Tools?
PostgreSQL DBA Tools is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ๐ give ai assistants full postgresql dba superpowers โ 30+ tools for performance analysis, bloat detection, lock/deadlock monitoring, autovacuum & schema inspection. no extensions required. pg 12-18.
๐ Give AI assistants full PostgreSQL DBA superpowers โ 30+ tools for performance analysis, bloat detection, lock/deadlock monitoring, autovacuum & schema inspection. No extensions required. PG 12-18.
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- ๐ Give AI assistants full PostgreSQL DBA superpowers โ 30+ t
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-postgresql-opsConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use PostgreSQL DBA Tools
MCP PostgreSQL DBA Tools is a Python-based MCP server powered by FastMCP that equips AI assistants with over 30 production-grade DBA tools for PostgreSQL databases from version 12 to 18. It covers every critical DBA domain: schema inspection, active connection monitoring, slow query identification via pg_stat_statements, table and index bloat detection, autovacuum effectiveness analysis, lock and deadlock monitoring, replication lag tracking, and version-specific features like WAL summarization (PG17+) and async I/O stats (PG18+). All operations are read-only, making it safe to connect to live production databases, AWS RDS, and Aurora without risk of accidental modification.
Prerequisites
- Python 3.12+ installed
- uv package manager recommended (pip also works)
- PostgreSQL 12โ18 database network-accessible from the MCP server host
- Database user with SELECT privileges on pg_catalog, pg_stat_*, and information_schema views
- An MCP client: Claude Desktop or Claude Code
Install mcp-postgresql-ops
Install the package from PyPI using uv or pip.
pip install mcp-postgresql-ops
# or with uv
uv add mcp-postgresql-opsSet database connection environment variables
Configure the five core connection variables. Defaults are shown โ only override what differs from your setup.
export POSTGRES_HOST=127.0.0.1
export POSTGRES_PORT=5432
export POSTGRES_USER=postgres
export POSTGRES_PASSWORD=your_password
export POSTGRES_DB=mydbOptional: enable pg_stat_statements for slow query analysis
For the slow query tools to return data, add pg_stat_statements to your PostgreSQL shared preload libraries and restart the database. Then create the extension in each target database.
# postgresql.conf
shared_preload_libraries = 'pg_stat_statements'
track_functions = pl
track_io_timing = on
# After restart, in psql:
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;Configure Claude Desktop
Add the server to your claude_desktop_config.json with credentials in the env block.
{
"mcpServers": {
"postgresql-dba": {
"command": "uvx",
"args": ["mcp-postgresql-ops"],
"env": {
"POSTGRES_HOST": "127.0.0.1",
"POSTGRES_PORT": "5432",
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "your_password",
"POSTGRES_DB": "mydb"
}
}
}
}Use HTTP transport mode for remote access (optional)
For remote or multi-client setups, switch to streamable-http transport and optionally enable Bearer token authentication.
export FASTMCP_TYPE=streamable-http
export FASTMCP_HOST=0.0.0.0
export FASTMCP_PORT=8000
export REMOTE_AUTH_ENABLE=true
export REMOTE_SECRET_KEY=your-secret-keyPostgreSQL DBA Tools Examples
Client configuration (Claude Desktop)
Complete Claude Desktop configuration block with all connection variables.
{
"mcpServers": {
"postgresql-dba": {
"command": "uvx",
"args": ["mcp-postgresql-ops"],
"env": {
"POSTGRES_HOST": "db.example.com",
"POSTGRES_PORT": "5432",
"POSTGRES_USER": "dba_readonly",
"POSTGRES_PASSWORD": "securepassword",
"POSTGRES_DB": "production"
}
}
}
}Prompts to try
Sample DBA questions that map to the server's 30+ tools.
- "Show me the top 10 slowest queries in the production database"
- "Which tables have the most bloat and need VACUUM?"
- "Are there any locked sessions or deadlocks right now?"
- "Show me the foreign key relationships for the orders table"
- "What is the autovacuum status for tables with high DML activity?"
- "List all unused indexes in the ecommerce database"
- "What is the current replication lag on the standby?"Troubleshooting PostgreSQL DBA Tools
Connection refused or password authentication failed
Verify all POSTGRES_* environment variables are correct. For remote databases, check that the host allows connections from the MCP server IP in pg_hba.conf. Test connectivity with: `psql -h $POSTGRES_HOST -U $POSTGRES_USER -d $POSTGRES_DB`
pg_stat_statements tools return empty results
The extension must be installed in the target database. Run `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` and ensure `shared_preload_libraries = 'pg_stat_statements'` is in postgresql.conf with a PostgreSQL restart. On RDS, use a custom parameter group.
Version-specific tools are not available
Tools like get_wal_summarizer_status (PG17+), get_async_io_status (PG18+), and get_per_backend_io_stats (PG18+) only appear when the connected PostgreSQL version supports them. Call get_server_info to confirm which version and tools are active.
Frequently Asked Questions about PostgreSQL DBA Tools
What is PostgreSQL DBA Tools?
PostgreSQL DBA Tools is a Model Context Protocol (MCP) server that ๐ give ai assistants full postgresql dba superpowers โ 30+ tools for performance analysis, bloat detection, lock/deadlock monitoring, autovacuum & schema inspection. no extensions required. pg 12-18. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install PostgreSQL DBA Tools?
Follow the installation instructions on the PostgreSQL DBA Tools GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with PostgreSQL DBA Tools?
PostgreSQL DBA Tools works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is PostgreSQL DBA Tools free to use?
Yes, PostgreSQL DBA Tools is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
PostgreSQL DBA Tools Alternatives โ Similar Databases Servers
Looking for alternatives to PostgreSQL DBA Tools? Here are other popular databases servers you can use with Claude, Cursor, and VS Code.
Excelize
โ 20.6kGo language library for reading and writing Microsoft Excelโข (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
MCP Toolbox for Databases
โ 15.3kOpen source MCP server specializing in easy, fast, and secure tools for Databases.
DBHub
โ 2.8kA universal database gateway MCP server that enables AI assistants to connect to and query multiple databases (PostgreSQL, MySQL, MariaDB, SQL Server, SQLite) with support for schema exploration, SQL execution, and secure connections via SSH tunnels.
Tabularis
โ 2.1kA lightweight, cross-platform database client for developers. Supports MySQL, PostgreSQL and SQLite. Hackable with plugins. Built for speed, security, and aesthetics.
Postgres AI Guide
โ 1.7kMCP server and Claude plugin for Postgres skills and documentation. Helps AI coding tools generate better PostgreSQL code.
Anyquery
โ 1.7k๐๏ธ ๐ โ๏ธ - Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by design.
Browse More Databases MCP Servers
Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up PostgreSQL DBA Tools in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use PostgreSQL DBA Tools?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.