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
- Which additional PostgreSQL areas should I cover next? (Logical
replication slots? Partitioning analysis? Extension-specific tools?)
- Anyone running this against large production clusters — performance
feedback welcome
- 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.