# mcp-percona-pg [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/dockndevai/mcp-percona-pg  
**GitHub Stars:** 1  
**npm Downloads (last month):** 637  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-percona-pg

## Description
Manage Percona PostgreSQL + PgBouncer on Kubernetes — safe-by-default access modes and guards.

## Tools
Capabilities this server exposes over MCP:

- **list_contexts** — List the contexts (clusters) available in the loaded kube-config.
- **list_clusters** — List PerconaPGCluster resources (PostgreSQL + PgBouncer). Omit `namespace` to list across all namespaces. Results are filtered by the namespace/cluster allowlists; protected clusters are flagged.
- **get_cluster** — Summary of a PerconaPGCluster: state, PostgreSQL size, PgBouncer, version, standby, host.
- **get_cluster_status** — The full `.status` of a PerconaPGCluster — Patroni members, PostgreSQL/PgBouncer readiness, host, and conditions.
- **get_connection_info** — Connection endpoints for a cluster: the primary/replica Service hosts, port, and the declared users (names only — passwords live in Secrets and are never returned).
- **get_pgbouncer_config** — The PgBouncer settings for a cluster: replicas, pool_mode, and the global pool tunables.
- **get_pg_parameters** — The tuned PostgreSQL parameters from `spec.patroni.dynamicConfiguration.postgresql.parameters` (the only correct place to set them — direct postgresql.conf edits are reverted by Patroni).
- **list_backups** — List PerconaPGBackup resources in a namespace, with their state, repo, and completion time.
- **list_restores** — List PerconaPGRestore resources in a namespace, with their target cluster and state.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "mcp-percona-pg": {
    "command": "npx",
    "args": ["-y","@dockndevai/mcp-percona-pg"]
  }
}
```

## Documentation

## What mcp-percona-pg does

mcp-percona-pg exposes Percona Operator for PostgreSQL v2 resources to MCP clients. It works with Kubernetes objects including `PerconaPGCluster`, `PerconaPGBackup`, `PerconaPGRestore`, and `PerconaPGUpgrade`, using the kube-config available to the process. The server covers PostgreSQL and PgBouncer operations such as cluster discovery, status inspection, pooling configuration, parameter tuning, scaling, backups, recovery, standby promotion, upgrades, and deletion.

Database passwords are not read or returned. Connection details include service hosts, ports, and declared usernames only.

## How it works

The MCP client starts the published npm package with `npx`, and the server uses Kubernetes access to inspect or modify the operator's custom resources. Access is separated into three modes:

- `read-only` exposes inspection tools.
- `read-write` adds routine changes such as scaling, pooling updates, parameter changes, pauses, extensions, and backups.
- `admin` adds higher-impact operations, subject to additional gates.

Namespace and cluster allowlists restrict the resources visible to the agent. Protected clusters remain readable but cannot be changed, restored, or deleted. Restore, upgrade, and delete each require their own opt-in. High-impact operations can require typed confirmation, and destructive actions use MCP human-approval prompts when supported. Dry-run mode validates operations without applying them, while audit logging records guarded actions as JSON lines.

## Setup and configuration

The prerequisites are a Kubernetes cluster running Percona Operator for PostgreSQL v2 and a kube-config that the server can read. A narrowly scoped ServiceAccount and RBAC policy can limit access to the operator namespaces and `pgv2.percona.com` resources the agent should see.

Install from npm at runtime with:

```bash
npx -y @dockndevai/mcp-percona-pg
```

Start with `PERCONA_MODE=read-only`. The configuration also supports namespace and cluster allowlists, protected cluster names, separate restore/upgrade/delete permissions, confirmation requirements, dry-run behavior, audit logging, and requiring human approval when the client cannot perform MCP elicitation. The package includes an `.env.example` with the available variables.

For development, install dependencies, build the project, and run `node dist/index.js` with the environment configuration in place.

## Tools and capabilities

Read operations include:

- Listing kube-config contexts and Percona PostgreSQL clusters.
- Viewing cluster summaries, raw status, Patroni members, readiness, conditions, and hosts.
- Inspecting primary and replica service endpoints and declared user names.
- Reading PgBouncer replicas, pool mode, global pool settings, and Patroni-managed PostgreSQL parameters.
- Listing backup and restore resources with state and related metadata.

Write operations can scale PostgreSQL or PgBouncer, change PgBouncer settings, merge PostgreSQL parameters through Patroni's dynamic configuration, pause or resume clusters, toggle built-in extensions, and create backups. Administrative operations cover restores, point-in-time recovery, major-version upgrades, standby promotion, and deletion of backups or clusters, subject to the configured mode and safety gates.

## Limitations and notes

The server manages the Percona Operator custom resources rather than editing database files directly. PostgreSQL tuning must use `spec.patroni.dynamicConfiguration.postgresql.parameters`; direct `postgresql.conf` edits are reverted by Patroni. The server requires Kubernetes access to the relevant resources, and its connection-information tool intentionally omits secret values and passwords. Client support for interactive human approval affects whether operations requiring MCP elicitation can proceed.

_Full upstream README: https://allmcps.com/mcp/mcp-percona-pg/readme_

