Mcp Percona Pg

io.github.dockndevaiPublished by GitHub account dockndevaiv0.3.3Updated Oct 26, 2026

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

VerifiedSTDIODesktop onlyDatabasesCloud & Infrastructure

Overview

AI-generated overview

Inspect Percona PostgreSQL and PgBouncer clusters on Kubernetes through the Percona Operator, with read-only defaults and guarded write actions.

What you can do
  • List kube-config contexts and PerconaPGCluster resources, with namespace filtering and protected-cluster flags
  • Read a cluster's summary, full status (Patroni members, readiness, conditions), connection endpoints and declared user names
  • Read PgBouncer settings and tuned PostgreSQL parameters from the Patroni dynamic configuration
  • List backups and restores with their state and target cluster
  • In read-write mode, scale, pause, tune, toggle extensions and create backups; admin mode adds restore, upgrade, promote and delete
When to use it
Useful when you run PostgreSQL with the Percona Operator for PostgreSQL v2 on Kubernetes and want an assistant to answer questions about cluster health, pooling, tuning, backups and restores, or to make controlled changes without hand-editing custom resources.
Requirements
Runs locally via npx from the npm package, so Node.js is needed. Requires a Kubernetes cluster with the Percona Operator for PostgreSQL v2 and a kube-config the server can read, set through KUBECONFIG_PATH. PERCONA_MODE selects read-only, read-write or admin; PERCONA_NAMESPACE sets a default namespace. Optional allowlists, protected clusters, opt-in gates, dry-run and audit log variables exist.
Before you install
Starts read-only, but read-write and admin modes can scale, pause, tune, back up, restore, upgrade, promote or delete clusters and backups. Keep PERCONA_MODE at read-only unless changes are intended, and use namespace and cluster allowlists, protected clusters and the restore, upgrade and delete opt-ins. The kube-config grants cluster access, so scope it with RBAC. Passwords are not returned, but connection endpoints and user names are.

Installation

In SourceWeft

  1. Open Mcp Percona Pg in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

mcp-percona-pg

[CI] [License: MIT] [npm]

A Model Context Protocol server for the Percona Operator for PostgreSQL. It lets an MCP-capable client (Claude Desktop, Claude Code, Cursor, …) operate PostgreSQL + PgBouncer clusters on Kubernetes — topology, connection pooling, tuning, backups/PITR, DR, extensions, and lifecycle — with behaviour controlled entirely by flags.

It drives the operator's custom resources (PerconaPGCluster, PerconaPGBackup, PerconaPGRestore, PerconaPGUpgrade) through your kube-config, so the model works the way you already do: "scale dev-pg to 3 replicas", "switch pooling to transaction mode", "restore prod-pg to 12:00 UTC".

Safe by default: it starts read-only, can be scoped to an allowlist of namespaces and clusters, protects critical clusters from mutation, gates restore / upgrade / delete behind separate opt-ins, and requires typed confirmation for high-impact actions. It never reads or returns database credentials.

Features

  • Discovery & status — list clusters, per-cluster summary and raw .status (Patroni members, PostgreSQL/PgBouncer readiness), connection endpoints, backups and restores.
  • Connection pooling — read and update PgBouncer pool_mode and the global pool tunables (default_pool_size, max_client_conn, …).
  • PostgreSQL tuning — read/merge parameters via spec.patroni.dynamicConfiguration (the only Patroni-safe path).
  • Lifecycle — scale PostgreSQL/PgBouncer, pause/resume, toggle built-in extensions, on-demand backups.
  • DR & recovery — restore / point-in-time recovery, promote a standby, major-version upgrades — each individually gated.

Security model

LayerFlagEffect
Access modePERCONA_MODEread-only → read-write → admin; over-privileged tools are never registered
Namespace/cluster allowlistsPERCONA_NAMESPACE_ALLOWLIST, PERCONA_CLUSTER_ALLOWLISTscope what the agent can touch
Protected clustersPERCONA_PROTECTED_CLUSTERSreadable, never mutated/restored/deleted
Restore / upgrade / deletePERCONA_ALLOW_RESTORE, PERCONA_ALLOW_UPGRADE, PERCONA_ALLOW_DELETEseparate opt-ins on top of admin mode
ConfirmationPERCONA_REQUIRE_CONFIRMATIONhigh-impact ops require echoing the cluster name
Dry-run / auditPERCONA_DRY_RUN, PERCONA_AUDIT_LOGvalidate-only; JSON audit line per guarded op
Interactive confirmation(automatic)destructive & high-impact ops prompt the human to approve via MCP elicitation before running; fall back to the PERCONA_ALLOW_* gates when the client can't elicit

Tools

Read (read-only+): list_contexts, list_clusters, get_cluster, get_cluster_status, get_connection_info, get_pgbouncer_config, get_pg_parameters, list_backups, list_restores

Write (read-write+): scale_cluster, set_pgbouncer_config, set_pg_parameters, pause_cluster, toggle_builtin_extension, create_backup

Admin (admin): restore_cluster (needs PERCONA_ALLOW_RESTORE), upgrade_cluster (needs PERCONA_ALLOW_UPGRADE), promote_standby, delete_backup / delete_cluster (need PERCONA_ALLOW_DELETE)

Quickstart — add to your agent

Published on npm as @dockndevai/mcp-percona-pg. No clone or build needed — your MCP client runs it on demand with npx. Start in read-only mode; see .env.example for every variable and docs/CLIENTS.md for the full per-client guide.

Claude Code (CLI)

bash
claude mcp add percona-pg -e PERCONA_MODE="read-only" -e PERCONA_NAMESPACE="postgres-operator" -- npx -y @dockndevai/mcp-percona-pg

Claude Desktop · Cursor · Windsurf — same block in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.json:

json
{  "mcpServers": {    "percona-pg": {      "command": "npx",      "args": ["-y", "@dockndevai/mcp-percona-pg"],      "env": {        "PERCONA_MODE": "read-only",        "PERCONA_NAMESPACE": "postgres-operator"      }    }  }}

OpenAI Codex CLI — in ~/.codex/config.toml:

toml
[mcp_servers.percona-pg]command = "npx"args = ["-y", "@dockndevai/mcp-percona-pg"]env = { PERCONA_MODE = "read-only", PERCONA_NAMESPACE = "postgres-operator" }

Example prompts

  • "List the PostgreSQL clusters and show me the status of dev-pg."
  • "What pool_mode is dev-pg using, and how big is the default pool?" → get_pgbouncer_config
  • "Set dev-pg PgBouncer to transaction pooling with default_pool_size 25." (needs read-write)
  • "Bump shared_buffers to 512MB on dev-pg." (needs read-write)
  • "Take a full backup of dev-pg to repo1." (needs read-write)
  • "Restore dev-pg to 2026-08-30 12:00:00+00." (needs admin + PERCONA_ALLOW_RESTORE + confirmation)

Prerequisites

  • A Kubernetes cluster running the Percona Operator for PostgreSQL v2 (pgv2.percona.com/v2).
  • A kube-config the server can read. For safety, use a ServiceAccount/RBAC scoped to the operator's namespaces and to the pgv2.percona.com resources you want the agent to see.

Run from source (development)

Prefer the published package above. To run from a clone:

bash
npm installnpm run buildnode dist/index.js   # with the environment variables set

Develop

bash
npm run devnpm test          # security policy + annotationsnpm run typecheck

Publishing

This server ships a server.json for the official MCP registry and an mcpName for npm ownership validation. See PUBLISHING.md.

License

MIT

Source: README.md at commit 98d0aa5

Tools

9

list_contexts

List kube-config contexts

List the contexts (clusters) available in the loaded kube-config.

Takes no parameters.

list_clusters

List PostgreSQL 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.

Parameterscontextnamespace

get_cluster

Get cluster (summary)

Summary of a PerconaPGCluster: state, PostgreSQL size, PgBouncer, version, standby, host.

Parametersnamerequiredcontextnamespace

get_cluster_status

Get cluster status (raw)

The full `.status` of a PerconaPGCluster — Patroni members, PostgreSQL/PgBouncer readiness, host, and conditions.

Parametersnamerequiredcontextnamespace

get_connection_info

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).

Parametersnamerequiredcontextnamespace

get_pgbouncer_config

Get PgBouncer config

The PgBouncer settings for a cluster: replicas, pool_mode, and the global pool tunables.

Parametersnamerequiredcontextnamespace

get_pg_parameters

Get PostgreSQL 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).

Parametersnamerequiredcontextnamespace

list_backups

List backups

List PerconaPGBackup resources in a namespace, with their state, repo, and completion time.

Parameterscontextnamespace

list_restores

List restores

List PerconaPGRestore resources in a namespace, with their target cluster and state.

Parameterscontextnamespace

Version history

3
  1. v0.3.3LatestOct 26, 2026
  2. v0.3.0Sep 29, 2026
  3. v0.2.3Sep 16, 2026

Score

90% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts
  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listedRequired15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts