MCP-PostgreSQL-Ops

MCP-PostgreSQL-Ops

posted 2 min read

What is MCP-PostgreSQL-Ops?

A production-ready Model Context Protocol (MCP) server for PostgreSQL
operations and monitoring. 30+ tools that let you analyze, monitor, and
maintain PostgreSQL databases through natural language — works with
Claude Desktop, Claude Code, OpenWebUI, or any MCP-compatible client.

Stop juggling psql, pgAdmin, and custom monitoring scripts. Just ask:

  • "Show me the slowest queries in the last hour"
  • "Which tables have high bloat and need VACUUM?"
  • "Analyze autovacuum activity for the past 48 hours"
  • "Show all foreign key relationships for the customers table"

Why I built it

Most PostgreSQL MCP servers are thin SQL wrappers. This one is built for
real DBA workflows — performance diagnosis, bloat analysis, autovacuum
monitoring, schema introspection — without requiring superuser access or
exotic extensions.

Key Features

  • 30+ tools covering connections, configs, schemas, indexes, IO,
    WAL, replication, locks, and more
  • PostgreSQL 12–17 support with automatic version detection and
    graceful feature degradation
  • Read-only and production-safe — works with regular role permissions
  • RDS / Aurora compatible — managed service friendly
  • Extension-independent core — most tools work without
    pg_stat_statements; advanced query analytics light up automatically
    when extensions are installed
  • Multi-database operations — switch between databases via parameter,
    no reconnection needed
  • Bloat & autovacuum intelligence — dead tuple ratios, VACUUM
    effectiveness analysis, autovacuum trigger thresholds
  • Bearer token auth for streamable-http mode in production

Installation

PyPI package available:

pip install mcp-postgresql-ops
# or
uvx --python 3.12 mcp-postgresql-ops

Claude Desktop config:

{
  "mcpServers": {
    "mcp-postgresql-ops": {
      "command": "uvx",
      "args": ["--python", "3.12", "mcp-postgresql-ops"],
      "env": {
        "POSTGRES_HOST": "127.0.0.1",
        "POSTGRES_PORT": "5432",
        "POSTGRES_USER": "postgres",
        "POSTGRES_PASSWORD": "your-password",
        "POSTGRES_DB": "your-db"
      }
    }
  }
}

Or run the full Docker Compose stack with built-in test data, OpenWebUI,
and MCPO proxy in 5 minutes.

Tech Stack

  • Python 3.12 + asyncpg
  • FastMCP framework
  • stdio and streamable-http transports
  • Available on PyPI, Docker Hub, and Smithery

Looking for Feedback

  1. Which additional PostgreSQL areas should I cover next? (Logical
    replication slots? Partitioning analysis? Extension-specific tools?)
  2. Anyone running this against large production clusters — performance
    feedback welcome
  3. Cross-version testing reports (especially PG 12 and PG 17 edge cases)

Repo: https://github.com/call518/MCP-PostgreSQL-Ops
PyPI: https://pypi.org/project/MCP-PostgreSQL-Ops/
Smithery: https://smithery.ai/server/@call518/mcp-postgresql-ops

⭐ Stars, issues, and PRs welcome. The codebase is structured for easy
custom-tool addition — see the "Adding Custom Tools" section in the README.

More Posts

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelskiverified - Mar 19

MCP-OpenStack-Ops

JungJungIn - May 1

Agent Action Guard

praneeth - Mar 31

The End of Data Export: Why the Cloud is a Compliance Trap

Pocket Portfolioverified - Apr 6

Everyone says DeepSeek is cheaper, but I got tired of guessing the exact math. So I built a calculat

abarth23 - Apr 27
chevron_left

Related Jobs

View all jobs →

Commenters (This Week)

3 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!