Mcp Percona Pg

io.github.dockndevai由 GitHub 帳號 dockndevai 發布v0.3.3更新於 Oct 26, 2026

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

已驗證STDIO僅桌面資料庫雲端與基礎設施

概覽

AI 產生的概覽

透過 Percona Operator 檢視 Kubernetes 上的 Percona PostgreSQL 與 PgBouncer 叢集,預設唯讀並具備受控的寫入操作。

可以做什麼
  • 列出 kube-config 中的情境與 PerconaPGCluster 資源,可依命名空間篩選並標示受保護叢集
  • 讀取叢集摘要、完整狀態(Patroni 成員、就緒情形、條件)、連線端點與宣告的使用者名稱
  • 讀取 PgBouncer 設定,以及 Patroni 動態設定中調校過的 PostgreSQL 參數
  • 列出備份與還原來源及其狀態與目標叢集
  • 讀寫模式下可擴縮、暫停、調參、切換擴充功能與建立備份;管理模式另有還原、升級、提升與刪除
適用情境
適合在 Kubernetes 上以 Percona Operator for PostgreSQL v2 執行 PostgreSQL 的團隊,想讓助理回答叢集健康、連線池、參數調校、備份與還原等問題,或在不手動編輯自訂資源的情況下進行受控變更。
執行需求
透過 npx 從 npm 套件在本機執行,需要 Node.js。需要執行 Percona Operator for PostgreSQL v2 的 Kubernetes 叢集,以及伺服器可讀取的 kube-config,由 KUBECONFIG_PATH 指定。PERCONA_MODE 選擇唯讀、讀寫或管理模式,PERCONA_NAMESPACE 設定預設命名空間。另有選用的允許清單、受保護叢集、各項操作開關、試跑與稽核記錄變數。
安裝前請注意
預設唯讀,但讀寫與管理模式可以擴縮、暫停、調參、備份、還原、升級、提升或刪除叢集與備份。除非確實需要變更,否則讓 PERCONA_MODE 保持唯讀,並搭配命名空間與叢集允許清單、受保護叢集,以及還原、升級、刪除的個別開關。kube-config 會授予叢集存取權,應以 RBAC 限縮範圍。密碼不會被回傳,但連線端點與使用者名稱會。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mcp Percona Pg,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

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

來源:README.md,提交 98d0aa5

工具

9

list_contexts

List kube-config contexts

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

無需輸入參數。

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.

輸入參數contextnamespace

get_cluster

Get cluster (summary)

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

輸入參數name必填contextnamespace

get_cluster_status

Get cluster status (raw)

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

輸入參數name必填contextnamespace

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

輸入參數name必填contextnamespace

get_pgbouncer_config

Get PgBouncer config

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

輸入參數name必填contextnamespace

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

輸入參數name必填contextnamespace

list_backups

List backups

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

輸入參數contextnamespace

list_restores

List restores

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

輸入參數contextnamespace

版本歷史

3
  1. v0.3.3最新Oct 26, 2026
  2. v0.3.0Sep 29, 2026
  3. v0.2.3Sep 16, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分