mcp-percona-pg
An MCP server for managing Percona PostgreSQL + PgBouncer clusters on Kubernetes; the supplied schema exposes read-only discovery/status capabilities, while the README documents gated write/admin operations.
List kube-config contexts and Percona PostgreSQL clusters, filtered by namespace/cluster allowlists.
Get a cluster summary, raw
.status(Patroni members, readiness, conditions), connection endpoints/users, PgBouncer config, and Patroni-managed PostgreSQL parameters.List backups and restores.
In read-write mode: scale PostgreSQL/PgBouncer, set PgBouncer/PostgreSQL parameters, pause/resume, toggle extensions, and create backups.
In admin mode with opt-ins: restore/PITR, upgrade, promote standby, and delete backups/clusters.
Safety controls include read-only default, allowlists, protected clusters, confirmation/elicitation, dry-run, and audit logging; credentials are never returned.
Interacts with Kubernetes custom resources such as PerconaPGCluster, PerconaPGBackup, PerconaPGRestore, and PerconaPGUpgrade via kube-config to manage PostgreSQL cluster lifecycle, backups, restores, and upgrades within Kubernetes.
Operates PostgreSQL and PgBouncer clusters managed by the Percona Operator for PostgreSQL, providing capabilities for cluster discovery, scaling, pausing/resuming, connection pooling configuration, PostgreSQL parameter tuning, backups, point-in-time recovery, standby promotion, and major-version upgrades.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-percona-pg List the PostgreSQL clusters and show me the status of dev-pg."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-percona-pg
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_modeand 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.
Related MCP server: k8s-mcp-go
Security model
Layer | Flag | Effect |
Access mode |
|
|
Namespace/cluster allowlists |
| scope what the agent can touch |
Protected clusters |
| readable, never mutated/restored/deleted |
Restore / upgrade / delete |
| separate opt-ins on top of admin mode |
Confirmation |
| high-impact ops require echoing the cluster name |
Dry-run / audit |
| validate-only; JSON audit line per guarded op |
Interactive confirmation | (automatic) | destructive & high-impact ops prompt the human to approve via MCP elicitation before running. The prompt shows the tool, the exact arguments and a fingerprint; the target's version ( |
Require a human |
|
|
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)
claude mcp add percona-pg -e PERCONA_MODE="read-only" -e PERCONA_NAMESPACE="postgres-operator" -- npx -y @dockndevai/mcp-percona-pgClaude Desktop · Cursor · Windsurf — same block in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.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:
[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-pgusing, and how big is the default pool?" →get_pgbouncer_config"Set
dev-pgPgBouncer to transaction pooling with default_pool_size 25." (needsread-write)"Bump
shared_buffersto 512MB ondev-pg." (needsread-write)"Take a full backup of
dev-pgto repo1." (needsread-write)"Restore
dev-pgto 2026-08-30 12:00:00+00." (needsadmin+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.comresources you want the agent to see.
Run from source (development)
Prefer the published package above. To run from a clone:
npm install
npm run build
node dist/index.js # with the environment variables setDevelop
npm run dev
npm test # security policy + annotations
npm run typecheckPublishing
This server ships a server.json for the official MCP registry and an mcpName for npm ownership validation. See PUBLISHING.md.
License
MIT
Available Tools
9 toolsget_clusterGet cluster (summary)ARead-onlyIdempotent
Summary of a PerconaPGCluster: state, PostgreSQL size, PgBouncer, version, standby, host.
Inputs: name (required), context, namespace.
get_cluster_statusGet cluster status (raw)BRead-onlyIdempotent
The full .status of a PerconaPGCluster — Patroni members, PostgreSQL/PgBouncer readiness, host, and conditions.
Inputs: name (required), context, namespace.
get_connection_infoGet connection infoARead-onlyIdempotent
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).
Inputs: name (required), context, namespace.
get_pgbouncer_configGet PgBouncer configBRead-onlyIdempotent
The PgBouncer settings for a cluster: replicas, pool_mode, and the global pool tunables.
Inputs: name (required), context, namespace.
get_pg_parametersGet PostgreSQL parametersBRead-onlyIdempotent
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).
Inputs: name (required), context, namespace.
list_backupsList backupsBRead-onlyIdempotent
List PerconaPGBackup resources in a namespace, with their state, repo, and completion time.
Inputs: context, namespace.
list_clustersList PostgreSQL clustersARead-onlyIdempotent
List PerconaPGCluster resources (PostgreSQL + PgBouncer). Omit namespace to list across all namespaces. Results are filtered by the namespace/cluster allowlists; protected clusters are flagged.
Inputs: context, namespace.
list_contextsList kube-config contextsARead-onlyIdempotent
List the contexts (clusters) available in the loaded kube-config.
Inputs: no named parameters.
list_restoresList restoresBRead-onlyIdempotent
List PerconaPGRestore resources in a namespace, with their target cluster and state.
Inputs: context, namespace.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
get_cluster and get_cluster_status both describe cluster status and could be confused (summary vs full .status). list_clusters and list_contexts also overlap in listing clusters, though descriptions hint at a distinction. Other tools are clearly distinct.
All tools follow a consistent snake_case verb_noun pattern: list_* and get_*. No naming deviations or mixed conventions.
9 tools is well-scoped for a Kubernetes operator inspection server. Each tool maps to a distinct resource or config aspect, and nothing feels redundant by count.
The server is clearly read-only, but within that scope it lacks singular detail tools like get_backup or get_restore, and has no operations for cluster management (create/update/delete) or triggering backup/restore. Core inspection needs are covered, but notable gaps remain.
Maintenance
Related MCP Connectors
Agent-native backend: Postgres, auth, storage, functions, hosting and deploy, over MCP
Postgres backend your coding agent builds over MCP; destructive actions wait for a person.
Guard AI agents' PostgreSQL/MySQL access via MCP: SQL audit, auth, masking, write approval
Managed Postgres MCP: projects, SQL, docs search, and storage buckets via OAuth.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables querying and modifying PostgreSQL databases through MCP tools with read/write operations, schema inspection, and write-safety constraints that limit modifications to the mcp schema.1-
- AlicenseNot gradedqualityCmaintenanceSafe, read-only-by-default Kubernetes access for AI agents via MCP. Provides explicit readonly, readwrite, and dangerous permission modes, plus MCPB bundles for desktop clients.2MIT
- AlicenseNot gradedqualityCmaintenanceSafe-write Postgres MCP server enabling secure read and write access to PostgreSQL databases with role-based separation and allowlist controls, allowing agents to query and modify data without risk of unrecoverable accidents.79 npmMIT
- FlicenseNot gradedqualityCmaintenanceEnables MCP clients to safely query one or more PostgreSQL databases with read-only tools and explicitly approved write operations.1-