MCP PostgreSQL Ops logo

MCP PostgreSQL Ops

Read-only PostgreSQL monitoring and analysis through natural-language MCP tools, covering performance, bloat, locks, schemas, VACUUM, and replication.

Install MCP PostgreSQL Ops

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "mcp-postgresql-ops": {
      "command": "uvx",
      "args": [
        "--python",
        "3.12",
        "mcp-postgresql-ops"
      ],
      "env": {
        "POSTGRES_HOST": "YOUR_VALUE_HERE",
        "POSTGRES_PORT": "YOUR_VALUE_HERE",
        "POSTGRES_USER": "YOUR_VALUE_HERE",
        "POSTGRES_PASSWORD": "YOUR_VALUE_HERE",
        "POSTGRES_DB": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Claude Code command
claude mcp add --env POSTGRES_HOST=YOUR_VALUE_HERE --env POSTGRES_PORT=YOUR_VALUE_HERE --env POSTGRES_USER=YOUR_VALUE_HERE --env POSTGRES_PASSWORD=YOUR_VALUE_HERE --env POSTGRES_DB=YOUR_VALUE_HERE --transport stdio mcp-postgresql-ops -- uvx --python 3.12 mcp-postgresql-ops

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We hit an unexpected error while testing this listing automatically.

uvx --python 3.12 mcp-postgresql-ops

Rate limit exceeded, please try again later - you have reached the maximum number of concurrent E2B sandboxes (20). If you need more, please visit 'https://e2b.dev/docs/billing'

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

MCP-PostgreSQL-Ops connects AI assistants to PostgreSQL 12–18 for read-only operations, monitoring, and database analysis. Its tools cover slow queries, I/O, connections, locks, bloat, schemas, replication, WAL, VACUUM, and autovacuum behavior, with version-aware handling for newer PostgreSQL releases. Most capabilities work without extensions, while pg_stat_statements and optionally pg_stat_monitor add query-analysis data. Reach for it when an agent needs operational visibility across one or more PostgreSQL databases without applying changes.

Use cases

  • Inspect active connections and blocking locks
  • Find slow PostgreSQL queries
  • Analyze table and database bloat
  • Review VACUUM and autovacuum needs
  • Explore schemas and table relationships

Key features

  • Read-only PostgreSQL monitoring
  • Performance and slow-query analysis
  • Bloat, capacity, and maintenance inspection
  • Lock, connection, and deadlock monitoring
  • Schema and relationship discovery
  • Replication, WAL, and version-aware I/O metrics

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

9/9 checks healthy over the last 25d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 8d ago via OSV.dev · mcp-postgresql-ops (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars165Stargazers on the source repository.
Last commitTodayMost recent push to the default branch.
Install checkInconclusiveWe hit an unexpected error running the automated check.

How MCP PostgreSQL Ops works

What MCP-PostgreSQL-Ops does

MCP-PostgreSQL-Ops exposes PostgreSQL operations and monitoring through MCP tools that can be invoked with natural-language requests. It is designed for PostgreSQL versions 12 through 18 and focuses on read-only inspection, making it suitable for database visibility tasks where the agent should not modify production data or configuration.

The server covers database performance, capacity, table bloat, active connections, locks, deadlocks, background processes, checkpoints, replication, WAL, schemas, and table relationships. It can also assess VACUUM and autovacuum activity and produce maintenance-oriented findings. Multi-database analysis is supported, allowing monitoring across databases accessible through the configured PostgreSQL connection.

How it works

The server connects to PostgreSQL using connection settings supplied through environment variables. It detects the PostgreSQL version and adjusts supported statistics and fields accordingly. PostgreSQL 16 and later provide enhanced I/O statistics, PostgreSQL 17 adds wait-event and WAL-summarizer monitoring, and PostgreSQL 18 adds byte-level or per-backend I/O and WAL details described by the project.

Core monitoring works with ordinary database permissions, while superuser access can expose more databases and system information. Query analysis benefits from the optional pg_stat_statements extension and can use pg_stat_monitor when that extension is installed. These extensions are enhancements rather than prerequisites for the main monitoring features.

Setup and configuration

A Docker Compose quickstart is provided for local testing. Clone the repository, copy .env.example to .env, set the PostgreSQL connection values, and start the Compose services. The bundled PostgreSQL container is intended for demonstration; to use an existing database, configure the connection variables and disable the built-in postgres and postgres-init-extensions services.

The connection settings are POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB. The default database identifies the initial connection, while superusers may be able to access additional databases. The quickstart also starts an MCPO proxy and OpenWebUI environment; the example interface is available on port 3003, and the proxy's API documentation is exposed on port 8003.

Tools and capabilities

Available operations cover:

  • Finding slow queries and analyzing query statistics.
  • Inspecting active connections, locks, deadlocks, wait events, and background processes.
  • Reviewing database size, capacity, table bloat, and maintenance needs.
  • Examining schemas and relationships between database objects.
  • Checking VACUUM and autovacuum effectiveness.
  • Monitoring replication state, WAL activity, checkpoints, and I/O statistics.
  • Comparing or inspecting multiple accessible databases.

Limitations and notes

Operations are read-only, so the server is intended for observation and recommendations rather than executing maintenance changes. The depth of results depends on PostgreSQL version, available permissions, and installed statistics extensions. Features tied to newer PostgreSQL releases are not available on older versions. The Docker Compose database and generated test data are for quickstart testing, not a substitute for connecting the server to an intended production instance.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MCP PostgreSQL Ops

MCP-PostgreSQL-Ops is an MCP server that connects AI assistants to PostgreSQL 12–18 databases for read-only monitoring and analysis. Its main tools inspect performance, slow queries, connections, locks, bloat, schemas, VACUUM and autovacuum activity, replication, WAL, and I/O, with optional query-statistics extensions.

Install it by cloning the repository, copying `.env.example` to `.env`, configuring the PostgreSQL connection variables, and running the Docker Compose setup. The quickstart includes a PostgreSQL test container, or you can disable that service and connect to an existing database.

MCP-PostgreSQL-Ops supports PostgreSQL 12 through 18. It detects the database version and adjusts available statistics, with additional I/O, wait-event, WAL-summarizer, and per-backend metrics available on newer PostgreSQL releases.

No, the main monitoring features work without extensions. Installing `pg_stat_statements`, and optionally `pg_stat_monitor`, provides additional data for advanced query analysis and slow-query inspection.

Yes, it is designed for read-only monitoring and can work with regular user permissions for basic tasks, including RDS or Aurora environments. Superuser access can provide visibility into more databases and system information.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCP PostgreSQL Ops AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/mcp-postgresql-ops?style=directory)](https://allmcps.com/mcp/mcp-postgresql-ops)
HTML Embed
<a href="https://allmcps.com/mcp/mcp-postgresql-ops"><img src="https://allmcps.com/api/badge/mcp-postgresql-ops?style=directory" alt="MCP PostgreSQL Ops on AllMCPs" /></a>