PostgreSQL Operations

v1.0.0Databasesstable

Enables comprehensive PostgreSQL database monitoring, analysis, and management through natural language queries. Provides performance insights, bloat analysis, vacuum monitoring, and intelligent maintenance recommendations across PostgreSQL versions

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

What is PostgreSQL Operations?

PostgreSQL Operations is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to enables comprehensive postgresql database monitoring, analysis, and management through natural language queries. provides performance insights, bloat analysis, vacuum monitoring, and intelligent maint...

Enables comprehensive PostgreSQL database monitoring, analysis, and management through natural language queries. Provides performance insights, bloat analysis, vacuum monitoring, and intelligent maintenance recommendations across PostgreSQL versions

This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Enables comprehensive PostgreSQL database monitoring, analys

Use Cases

Monitor PostgreSQL performance and health
Analyze and fix bloat and vacuum issues
Get intelligent maintenance recommendations
call518

Maintainer

LicenseMIT License
Languagepython
Versionv1.0.0
UpdatedMay 13, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-postgresql-operations

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 Operations

MCP PostgreSQL Operations is a Python-based MCP server that gives AI assistants comprehensive read-only DBA superpowers over PostgreSQL databases spanning versions 12 through 18. It provides over 30 tools covering schema discovery, performance monitoring, bloat analysis, vacuum tracking, lock monitoring, replication status, and intelligent maintenance recommendations — all accessible through natural language queries. Built on FastMCP with automatic version detection, it adapts its capabilities to the connected PostgreSQL version without requiring any database extensions, making it safe and useful against production, RDS, and Aurora databases alike.

Prerequisites

  • Python 3.12+ installed
  • uv package manager recommended (pip also works)
  • PostgreSQL 12–18 database accessible from the server host
  • Database credentials with at least SELECT privileges on pg_stat_* views
  • An MCP client such as Claude Desktop or Claude Code
1

Install the package

Install mcp-postgresql-ops from PyPI using uv (faster) or pip.

pip install mcp-postgresql-ops
# or with uv (recommended)
uv add mcp-postgresql-ops
2

Configure database connection environment variables

Set environment variables for your PostgreSQL connection. All variables have sensible defaults so only POSTGRES_PASSWORD and possibly POSTGRES_HOST need to be overridden for most setups.

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 enhanced slow query tracking, add the following lines to your postgresql.conf and reload PostgreSQL. This is optional — the server works without it but some query analysis tools will be limited.

# In postgresql.conf:
shared_preload_libraries = 'pg_stat_statements'
track_functions = pl
track_io_timing = on
4

Add to Claude Desktop configuration

Edit your claude_desktop_config.json to register the MCP server using the uvx runner so credentials stay in the env block.

{
  "mcpServers": {
    "postgresql-ops": {
      "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

Verify the connection

Ask Claude to call get_server_info to confirm the server can connect and to see the detected PostgreSQL version and installed extensions.

PostgreSQL Operations Examples

Client configuration (Claude Desktop)

Complete Claude Desktop config block using uvx with all connection environment variables.

{
  "mcpServers": {
    "postgresql-ops": {
      "command": "uvx",
      "args": ["mcp-postgresql-ops"],
      "env": {
        "POSTGRES_HOST": "db.example.com",
        "POSTGRES_PORT": "5432",
        "POSTGRES_USER": "readonly_user",
        "POSTGRES_PASSWORD": "secret",
        "POSTGRES_DB": "production"
      }
    }
  }
}

Prompts to try

Natural language queries that map to the server's 30+ tools.

- "What are the top 10 slowest queries in the database?"
- "Show me all tables with significant bloat and estimate how much disk would be reclaimed after VACUUM"
- "Are there any blocked sessions or lock conflicts right now?"
- "Which indexes are unused and safe to drop?"
- "Show me autovacuum activity and whether any tables are falling behind on maintenance"
- "What is the current replication lag on my standby?"

Troubleshooting PostgreSQL Operations

Connection refused or authentication failed

Verify POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, and POSTGRES_PASSWORD are set correctly. For remote hosts, confirm the PostgreSQL server's pg_hba.conf allows connections from the MCP server's IP address.

Slow query tools return no data

The get_pg_stat_statements_top_queries tool requires the pg_stat_statements extension. Add `shared_preload_libraries = 'pg_stat_statements'` to postgresql.conf, restart PostgreSQL, then run `CREATE EXTENSION pg_stat_statements;` in the target database.

Some tools are missing or unavailable

Several tools are version-specific (e.g., get_wal_summarizer_status requires PG17+, get_async_io_status requires PG18+). The server auto-detects the PostgreSQL version and only exposes tools that are supported. Check get_server_info to confirm which version was detected.

Frequently Asked Questions about PostgreSQL Operations

What is PostgreSQL Operations?

PostgreSQL Operations is a Model Context Protocol (MCP) server that enables comprehensive postgresql database monitoring, analysis, and management through natural language queries. provides performance insights, bloat analysis, vacuum monitoring, and intelligent maintenance recommendations across postgresql versions It connects AI assistants to external tools and data sources through a standardized interface.

How do I install PostgreSQL Operations?

Follow the installation instructions on the PostgreSQL Operations GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with PostgreSQL Operations?

PostgreSQL Operations works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is PostgreSQL Operations free to use?

Yes, PostgreSQL Operations is open source and available under the MIT License 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-operations": { "command": "npx", "args": ["-y", "mcp-postgresql-operations"] } } }

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

Read the full setup guide →

Ready to use PostgreSQL Operations?

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