PostgreSQL DBA Tools

v1.0.0โ€ขDatabasesโ€ขstable

๐Ÿ˜ 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.

agentagentic-aiaiclaudedatabase
Share:
149
Stars
0
Downloads
0
Weekly
0/5

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

Detect and resolve lock and deadlock conditions
Analyze autovacuum and schema structure
Get performance insights without extensions
call518

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 13, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-postgresql-ops

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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-ops
2

Set 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=mydb
3

Optional: 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;
4

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"
      }
    }
  }
}
5

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-key

PostgreSQL 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.

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.

Quick Config Preview

{ "mcpServers": { "mcp-postgresql-ops": { "command": "npx", "args": ["-y", "mcp-postgresql-ops"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide โ†’

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides