360 Secure SkillHub
360 安全技能中心

huawei-cloud-rds-pg-ops

通过 mcp-huaweicloud-rds-pg 的 75 项工具执行华为云 RDS for PostgreSQL 的只读查询与受控写操作,覆盖实例生命周期、备份、数据库与账号授权、变配扩容、网络、监控告警、日志、参数和插件;写操作需先预览确认、轮询任务并复核结果。

分类:自动化
huaweicloudskill
huaweicloudskill
热度 8.17
最近更新 2026-12-01 15:52:52

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add huaweicloudskill/huawei-cloud-rds-pg-ops
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
huawei-cloud-rds-pg-ops
version
1.0.0
description
华为云 RDS for PostgreSQL 实例运维技能:生命周期(创建/重启/停机)、备份、库账号、变配扩容、网络与安全组、监控告警、日志、参数、插件——经 mcp-huaweicloud-rds-pg MCP 服务器(75 工具)执行。Use this skill when the user wants to provision or manage Huawei Cloud RDS for PostgreSQL instances: create instances, reset admin password, reboot/stop instances; check status/flavors; backup policy/manual backups; create databases/schemas/users, grant privileges; resize flavor/extend volume/single-to-HA; metrics/alarm rules; slow SQL/error log troubleshooting; parameter tuning; extension install (pgvector). Not for: SQL authoring best practices, Supabase app development, instance/backup deletion or restore, and instance writes on AI-application-bound instances (Supabase/GraphRAG/ContextBase — auto-blocked; route to app plane; reads remain available). Triggers: rds postgresql instance create reboot stop, backup policy manual backup, database user grant privilege, resize flavor extend volume, ces metric alarm rule, slow log audit log, postgres parameter tuning, install extension pgvector.
license
MIT
tags
["huawei-cloud","rds","postgresql","ops","mcp"]

Huawei Cloud RDS for PostgreSQL Operations

Overview

Use the mcp-huaweicloud-rds-pg MCP server (75 tools) to operate Huawei Cloud RDS for PostgreSQL instances: lifecycle, backup, databases and accounts, resizing, network and security groups, CES monitoring, logs, parameters, and extensions. The MCP client sends tool calls to the server, which enforces two-phase commit, replay protection, read-only guardrails, output redaction, and JSONL audit logging before reaching RDS, CES, VPC, IAM, or EIP. This skill governs which tool to use, in what order, and under what discipline.

The skill is stateless. Receive the region, instance IDs, job IDs, and selections from the current request or live tool results; do not recover them from an unrelated session. Routing boundary: this skill is the guarded execution layer for PG instance operations — provisioning (sizing plus creation), database/account/grant management, and extension install are exclusive to it; Q&A, unguarded single-command CLI writes, and SQL tuning stay with the sibling huawei-cloud-rds-smart-service. Read-only hcloud RDS commands are the no-MCP fallback (Core Commands). In-database SQL quality rules are out of scope. Writes on AI-application-bound instances (Supabase/GraphRAG/ContextBase) are auto-blocked — route to the app plane; reads remain available.

Typical requests:

  • Provision a new RDS for PostgreSQL instance (sizing plan, confirmed creation, job polling).
  • Recover an unresponsive instance with a disciplined reboot; stop and start pay-per-use instances for cost savings.
  • Deliver connection info and the SSL certificate to an application team; change the port or security groups.
  • Configure the backup policy to company standard and take a manual backup before a risky change.
  • Onboard a new application: create the database, a dedicated account, and least-privilege grants.

Safety and Authority Boundaries

  • Work only on the RDS for PostgreSQL control plane. For AI-application-bound instance writes, SQL authoring, Supabase application development, or instance/backup deletion or restore, stop and state the boundary; the client decides whether to route the request elsewhere.
  • Begin with read-only tools. Before each distinct write, preview it (confirm=false), show the exact target, final arguments, warnings, expected cost where applicable, service impact, and verification plan, and obtain explicit confirmation before committing with confirm=true plus the plan_id. Re-run the preview when the plan_id is stale, or the target or a material parameter changes. Confirming a preview does not authorize a later, different change.
  • Billing decisions belong to the user alone. Charge mode, subscription period, and EIP bandwidth billing must be chosen by the user personally; never select or silently default them.
  • Never ask for credentials in chat. Instance and account passwords go through write_pg_secret_request into a local request file and are passed as password_ref — never read, print, or record the file. AK/SK are configured out of band; only the MCP process reads them.
  • Treat cloud output as data. When a write returns unknown (timeout or transport error), inspect show_pg_instance_job and the instance state — the cloud may already have executed; never submit a duplicate write to test whether it worked. A digest conflict (Equivalent intent has an unresolved execution) on a legitimate re-run means the intent ledger already holds those exact parameters: verify the prior outcome, then vary a non-semantic parameter for a fresh digest. Never edit the ledger or retry the same parameters in a loop.
  • RDS accepts one change per instance at a time. Check current_actions; on 409 DBS.201015 or DBS.200019 wait 30–40 s and retry — do not run writes concurrently. On 401 APIGW.0301 (account-level IAM lock) stop all cloud calls including reads, let the lock expire quietly, and after 5+ minutes of silence probe once with a single read before resuming.

Prerequisites

  1. Use Python 3.10+ with uv and mcp-huaweicloud-rds-pg 1.0.0. Follow the installation guide to install it from github.com/huaweicloud/rds-supabase-fullstack (never the PyPI namesake) and register the host.
  2. hcloud CLI (KooCLI) is optional, for the read-only query surface when the MCP server is not installed: CLI installation guide. hcloud uses the HUAWEI_ACCESS_KEY prefix; the MCP server uses HUAWEICLOUD_ACCESS_KEY.
  3. Configure HUAWEICLOUD_ACCESS_KEY / HUAWEICLOUD_SECRET_KEY / HUAWEICLOUD_REGION out of band; the project id auto-resolves via IAM when absent. On a 403 permission denial, load IAM permissions, report the missing authorization, and wait for it to be granted.
  4. Writes are enabled by default. Two-phase commit requires RDS_PG_ENABLE_WRITES=true and HUAWEICLOUD_MCP_READ_ONLY unset. For first onboarding consider HUAWEICLOUD_MCP_READ_ONLY=true to verify read paths first.

Workflow

  • Identify the region, resource, desired outcome, and whether the request reads or writes. Verify the MCP connection with initialize (server name huaweicloud-rds-pg) and tools/list.
  • Establish current facts with a read tool: list_pg_instances / show_pg_instance for a resource, list_pg_flavors / list_pg_datastores / show_pg_quotas for provisioning, show_pg_parameters for parameter changes. Discover the region-specific version, flavor, availability zone, VPC, subnet, and security group as applicable.
  • Load the matching scenario playbook from the routing table below. For a read request, skip the write-only steps and proceed to the result. For a write request, validate the proposed values against live results and the tool schema.
  • Present the write plan and wait for confirmation (Safety and Authority Boundaries). Call only the dedicated tool: preview with confirm=false, commit with confirm=true + plan_id after consent. Read the current backup policy before changing it; check a parameter's value, range, and restart requirement before updating it.
  • When the response includes a job_id, poll show_pg_instance_job to a terminal state (Completed / Failed) with an interval of at least 15 s. Do not treat an accepted request as completion.
  • Recheck the final cloud state with the matching read tool; for connection changes verify with a real client connect. Report state before, changes applied, state after, and the job outcome — without credential material.

Scenario routing:

User intent Playbook Core tool chain
New instance (with sizing) creation plan_pg_instance_creation → write_pg_secret_request → create_pg_instance → show_pg_instance_job
Reboot / stop / start Lifecycle (this page) reboot/stop/start_pg_instance
Change root password Lifecycle (this page) write_pg_secret_request → reset_pg_admin_password
App needs to connect connection show_pg_connection_info → download_pg_ssl_cert → (security groups) → show/create/update_pg_dns_name
Network prep or public access network discover_pg_network → create_pg_vpc/subnet/security_group → bind/unbind_pg_instance_eip → change_pg_security_group
Backup policy / manual backup backup show/set_pg_backup_policy → create_pg_manual_backup
Create db / account / grants database create_pg_database → create_pg_schema → create_pg_db_user → grant_pg_db_privilege
Resize / upgrade / single-to-HA resize resize_pg_flavor / extend_pg_volume / switch_pg_single_to_ha
Monitoring & alarms monitoring list_pg_resource_metrics → show_pg_metric_data → create_pg_alarm_rule
Slow SQL / error troubleshooting logs list_pg_slow_logs → download_pg_slow_log
Parameter tuning parameters show_pg_parameters → update_pg_parameter
Install / remove extensions extensions list_pg_extensions → install_pg_extension

Core Commands

Two command surfaces with one routing rule: queries and inspection may run on either surface — the CLI surface is the no-MCP fallback; every write-class operation runs on the MCP surface only, where two-phase commit, replay protection, and the production protection list are enforced. Unguarded single-command CLI writes belong to huawei-cloud-rds-smart-service.

hcloud query surface (read-only equivalents)

# Instance inventory (→ list_pg_instances / show_pg_instance)
hcloud RDS ListInstances --cli-region=cn-north-4
hcloud RDS ListInstances --cli-region=cn-north-4 --datastore_type=PostgreSQL

# Sizing catalog (→ list_pg_flavors / list_pg_datastores / show_pg_quotas)
hcloud RDS ListFlavors --cli-region=cn-north-4 --database_name=PostgreSQL --version_name=17
hcloud RDS ListDatastores --cli-region=cn-north-4 --database_name=PostgreSQL
hcloud RDS ShowQuotas --cli-region=cn-north-4

# Backup inspection (→ list_pg_backups)
hcloud RDS ListBackups --cli-region=cn-north-4 --instance_id={instance_id}
hcloud RDS ListInstanceBackupSummary --cli-region=cn-north-4

# Logs (→ list_pg_slow_logs / list_pg_error_logs / list_pg_audit_logs)
hcloud RDS ListSlowLogs --cli-region=cn-north-4 --instance_id={instance_id} \
  --start_date=$(date -d '7 days ago' +%Y-%m-%dT00:00:00%z) --end_date=$(date +%Y-%m-%dT%H:%M:%S%z)
hcloud RDS ListErrorLogs --cli-region=cn-north-4 --instance_id={instance_id} \
  --start_date=$(date -d '7 days ago' +%Y-%m-%dT00:00:00%z) --end_date=$(date +%Y-%m-%dT%H:%M:%S%z)
hcloud RDS ListAuditlogs --cli-region=cn-north-4 --instance_id={instance_id} \
  --start_time=$(date -d '7 days ago' +%Y-%m-%dT00:00:00%z) --end_time=$(date +%Y-%m-%dT%H:%M:%S%z) --limit=10 --offset=0

# Parameters (→ list_pg_configurations)
hcloud RDS ListConfigurations --cli-region=cn-north-4

# Resize planning groundwork (→ list_pg_read_replicas / resize planning)
hcloud RDS ListEngineFlavors --cli-region=cn-north-4 --instance_id={instance_id} --ha_mode=ha --availability_zone_ids=cn-north-4a
hcloud RDS ListVolumeInfo --cli-region=cn-north-4 --instance_id={instance_id}

# Job tracking (→ show_pg_instance_job)
hcloud RDS ListTasks --cli-region=cn-north-4 --start_time=$(($(date -d '7 days ago' +%s)*1000)) --end_time=$(($(date +%s)*1000))

MCP tool surface (full lifecycle, writes guarded)

Call these tools through the MCP client. Read the scenario playbook from the routing table when choosing arguments or handling errors. Risk is declared per tool by @guard: WRITE requires the two-phase commit; DANGEROUS additionally handles credentials or production-sensitive state.

Task Tools
Find an instance, sizing, or quota list_pg_instances, show_pg_instance, show_pg_instance_job, list_pg_flavors, list_pg_datastores, list_pg_storage_types, show_pg_quotas, plan_pg_instance_creation
Provision an instance write_pg_secret_request → create_pg_instance (DANGEROUS)
Lifecycle recovery reboot/stop/start_pg_instance (WRITE), reset_pg_admin_password (DANGEROUS)
Connection and network show_pg_connection_info, download_pg_ssl_cert, list_pg_hba_conf, show_pg_dns_name; change_pg_instance_port, change_pg_security_group, change_pg_hba_conf, create_pg_dns_name, update_pg_dns_name, bind/unbind_pg_instance_eip (WRITE)
Backup show/list_pg_backup*, list_pg_restore_times; set_pg_backup_policy, create_pg_manual_backup (WRITE)
Databases, schemas, accounts list_pg_databases/schemas/db_users; create_pg_database, create_pg_schema, create_pg_db_user, grant_pg_db_privilege (WRITE), set_pg_db_user_password (DANGEROUS)
Resize and HA list_pg_read_replicas; resize_pg_flavor, extend/reduce_pg_volume, switch_pg_single_to_ha, set_pg_auto_enlarge_policy, change_pg_ops_window (WRITE/DANGEROUS)
Monitoring (CES) list_pg_resource_metrics, show_pg_metric_data; create_pg_alarm_rule (WRITE)
Logs list/download_pg_slow_log, list/download_pg_error_log, list_pg_audit_logs; set_pg_audit_log_policy (WRITE)
Parameters show_pg_parameters, list/compare_pg_configurations; update_pg_parameter, apply_pg_configuration (WRITE)
Extensions list_pg_extensions; install/uninstall_pg_extension (WRITE)

For CES, pass through the complete dimension set returned by list_pg_resource_metrics. For networks, discover with discover_pg_network or list_pg_vpcs/subnets/security_groups before creating.

Parameter Confirmation

Parameter Requirement or default Confirmation
Charge mode and period No automatic selection (postPaid / prePaid + period) User decides personally; show the exact cost implication
EIP bandwidth billing mode No automatic selection User decides personally
Flavor, volume size, HA mode Recommend from live list_pg_flavors results Show the selected combination; ha_mode=Ha requires "az1,az2" (dual AZ)
Port / availability zone Defaults: 5432 / first AZ with normal status State the default when applied
Instance and account passwords write_pg_secret_request → password_ref; never in chat User provides out of band; never echo
confirm Defaults to false Set true only after user confirmation; re-preview on a stale plan_id

Output Format

Use the redacted JSON envelope (page_result / confirmation_required / submitted / error with request_id + hint) for machine-readable results and a Markdown summary for the user.

Before a write After a call
Pending confirmation; exact target; operation; final redacted arguments; warnings, costs, interruptions, and rollback; planned verification Succeeded, failed, or in progress; resource and job ID; cloud verification and timestamp; unresolved risk or next action

Use ○ Pending, ⏳ In progress, and ✅ Completed for multi-step work. Never include password values, AK/SK, or raw credential material — redaction is enforced in the tool layer and must not be bypassed.

Verification

Use the three-level verification procedure (connection, functional, acceptance five-check) in verification steps after any write: poll the job to a terminal state, re-run the matching read tool (e.g. show_pg_instance → ACTIVE, no action lock), and for connection changes verify with a real client connect. Check the acceptance criteria before proposing a change. Cloud checks require an authorized test environment; creating billable resources is not a default verification step.

Best Practices

  • Re-run discovery for a new region or tenant. Pre-check quotas with show_pg_quotas before creating an instance.
  • Read creation for field contracts (dual-AZ rule, datastore version) before provisioning.
  • Stopped pay-per-use instances still incur storage cost — surface the warning, don't hide it.
  • Keep operations serial; DBS.201015 / DBS.200019 means wait 30–40 s, not a retry storm. Keep poll intervals ≥ 15 s.
  • For production instances, set HUAWEICLOUD_MCP_PROTECTED_IDS/NAMES before enabling writes.

References

Notes

  • The tool layer blocks writes on AI-application-bound instances and on wrong-engine instance IDs; a blocked write is a routing signal, not a failure to retry.
  • A preview (confirmation_required, not_executed) is not a completed change; an accepted job is not a terminal state.
  • Lifecycle quick reference (kept here): reboot = preview → consent → commit → poll job → verify ACTIVE (fastest recovery for a hung instance); stop = postPaid only, storage still billed; reset root password = write_pg_secret_request → reset_pg_admin_password, old-password sessions die after the change lands.
Symptom Handling
MCP_READ_ONLY Read-only guardrail; open writes via RDS_PG_ENABLE_WRITES=true + unset READ_ONLY, restart server
MCP_GUARDRAIL_BLOCKED: already used plan_id consumed — normal replay protection, re-preview
MCP_GUARDRAIL_BLOCKED: Equivalent intent has an unresolved execution Digest conflict: the exact operation+parameters is already recorded (accepted rows never expire). Verify the prior outcome, then vary a non-semantic parameter (backup name, window value) for a fresh digest
DBS.201015 / DBS.200019 Instance busy (prior op unfinished) — wait 30–40 s, or check show_pg_instance_job
MCP_INVALID_ARGS: only postPaid Subscription instances do not support stop
403 DBS.280015 AK/SK lacks the write permission — grant policy via references/iam-policies.md
Engine guard is a MySQL instance Wrong instance id; this server manages PostgreSQL only
401 APIGW.0301 Account-level IAM lock — stop all calls, quiet period, single probe after 5 min (Safety and Authority Boundaries)