느린 쿼리 원인 분석, bloat 분석, 차단 락 체인 조사를 포함한 관리형 PostgreSQL DBA 작업을 제공합니다.
다른 이름 AIops-tools/Postgres-AIops, postgres-aiops
- 스타
- 0
- Tools
- —
- 다운로드, 30일
- 724
- 최신 버전
- 0.13.0
- 마지막 커밋
- 2026년 10월 30일
- 라이선스
- MIT
Postgres AIops MCP란?
Postgres AIops은(는) MCP server입니다. 느린 쿼리 원인 분석, bloat 분석, 차단 락 체인 조사를 포함한 관리형 PostgreSQL DBA 작업을 제공합니다.
프로젝트 README에서 생성된 요약
Postgres AIops MCP server 정보
Postgres AIops는 PostgreSQL 환경을 위한 관리형 데이터베이스 관리 기능을 제공합니다. AI 클라이언트를 통해 원인 분석 및 유지 관리 작업을 수행해야 하는 DBA와 개발자를 위해 설계되었습니다. 이 서버는 psycopg 3를 사용하여 대상 인스턴스에 연결하며 시스템 카탈로그 및 pg_stat 뷰와 상호 작용합니다. 통합 감사 로그, runaway budget guard, 모든 작업에 대한 위험 등급 레이블을 제공하는 내장 거버넌스 하네스를 포함합니다.
사용자는 느린 쿼리 원인 분석, bloat 및 vacuum 분석, 차단 락 체인 조사와 같은 복잡한 진단 작업을 수행할 수 있습니다. 이 도구는 25개의 읽기 전용 도구와 10개의 쓰기 도구를 포함하여 총 35개의 MCP 도구를 제공합니다. 안전을 보장하기 위해 create_index 또는 drop_index와 같은 변경 쓰기 작업은 실행 전 상태를 기록하여 undo 작업을 가능하게 합니다. 자격 증명은 Fernet과 scrypt를 사용하는 암호화된 저장소에 안전하게 보관되며 액세스하려면 마스터 비밀번호가 필요합니다. 이 시스템은 CLI 사용과 MCP server 모드를 모두 지원하여 Claude Code 또는 OpenClaw와 같은 클라이언트와 통합할 수 있습니다.
활용 사례
- 1느린 데이터베이스 쿼리 분석pg_stat_statements 데이터를 사용하여 성능이 가장 낮은 쿼리의 구체적인 원인과 필요한 조치를 식별합니다.
- 2데이터베이스 락 경합 조사wait-for tree에서 근본적인 차단 요소를 찾아 차단 락 체인을 해결합니다.
- 3테이블 bloat 및 vacuum 관리dead-tuple 비율을 기반으로 vacuum 또는 autovacuum 튜닝에 대한 순위별 권장 사항을 확인합니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
Postgres AIops MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 Postgres AIops MCP 설치
$ claude mcp add postgres-aiops -- uvx postgres-aiopsCursor에 Postgres AIops MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"postgres-aiops": {
"command": "uvx",
"args": [
"postgres-aiops"
]
}
}
}VS Code에 Postgres AIops MCP 설치
.vscode/mcp.json
{
"servers": {
"postgres-aiops": {
"type": "stdio",
"command": "uvx",
"args": [
"postgres-aiops"
]
}
}
}VS Code CLI에 Postgres AIops MCP 설치
$ code --add-mcp '{"name":"postgres-aiops","type":"stdio","command":"uvx","args":["postgres-aiops"]}'Claude Desktop에 Postgres AIops MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"postgres-aiops": {
"command": "uvx",
"args": [
"postgres-aiops"
]
}
}
}Codex에 Postgres AIops MCP 설치
$ codex mcp add postgres-aiops -- uvx postgres-aiopsCodex config.toml에 Postgres AIops MCP 설치
~/.codex/config.toml
[mcp_servers.postgres-aiops] command = "uvx" args = ["postgres-aiops"]
Gemini CLI에 Postgres AIops MCP 설치
$ gemini mcp add -s user postgres-aiops uvx -- postgres-aiopsGemini settings.json에 Postgres AIops MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"postgres-aiops": {
"command": "uvx",
"args": [
"postgres-aiops"
]
}
}
}구성
POSTGRES_AIOPS_MASTER_PASSWORD
| 이름 | 설명 | 유형 |
|---|---|---|
| POSTGRES_AIOPS_MASTER_PASSWORD | — |
자동 검사
2026년 11월 14일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능aiops-tools/postgres-aiops is public and reachablegithub.com/aiops-tools/postgres-aiops ↗통과
- 패키지가 이 저장소를 소스로 명시검사되지 않음
- 빌드 출처(Sigstore 증명)Sigstore attestation for postgres-aiopspypi.org/project/postgres-aiops/ ↗통과
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-10-30github.com/aiops-tools/postgres-aiops ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음No popular package one edit away from postgres-aiops통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음40 resolved dependencies checked; no critical advisoryosv.dev ↗통과
- 모델에 대한 숨겨진 지침 없음0 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기Postgres AIops
Audit availability: Real writes require a committed
pendingaudit row and stop before contacting the platform if storage is unavailable. Reads and previews may continue with a warning; new audit rows store outcome summaries rather than full responses.
Disclaimer: Community-maintained open-source project. Not affiliated with, endorsed by, or sponsored by the PostgreSQL Global Development Group or any vendor. "PostgreSQL" and the elephant logo are trademarks of the PostgreSQL Community Association; all product/trademark names belong to their respective owners. MIT licensed.
Governed AI-ops for PostgreSQL DBA operations — connecting to a server with
psycopg 3 and reading the system catalogs and pg_stat_* views — with a
built-in governance harness: unified audit log, token/runaway
budget guard, undo-token recording, and descriptive risk-tier labels.
Beyond the mock test suite, the reads, a governed write, and its undo have been
exercised against a live PostgreSQL 16.14 instance — see docs/VERIFICATION.md.
What it does
Three flagship signature analyses, plus the guarded reads and writes around them:
- Slow-query RCA — take the worst
pg_stat_statementsentry (plus an optionalEXPLAINplan) and map its numbers — mean time, cache-hit ratio, temp spill, call count, plan node types — to a cited cause and a concrete action. Every finding carries its measured number, not a black-box verdict. - Bloat & vacuum analysis — combine per-table dead-tuple ratio and autovacuum recency into a ranked, cited recommendation (VACUUM / tune autovacuum).
- Blocking lock-chain RCA — build the wait-for tree from
pg_blocking_pids, name the root blocker (blocks others, waits on none), and give the action; a cycle is flagged as a likely deadlock.
What works
- CLI (
postgres-aiops ...):init,overview,server,activity,query,index,table,repl,analyze,remediate,secret,doctor,mcp. - MCP server (
postgres-aiops mcporpostgres-aiops-mcp): 35 tools (25 read, 10 write), every one wrapped with the bundled@governed_toolharness. - Encrypted credentials: the role password lives in an encrypted store
~/.postgres-aiops/secrets.enc(Fernet + scrypt) — never plaintext on disk. Unlock with a master password fromPOSTGRES_AIOPS_MASTER_PASSWORD(MCP/CI) or an interactive prompt (CLI). - Reversibility: mutating writes fetch the real before-state first and record a faithful inverse —
create_index↔drop_index;drop_indexcapturespg_get_indexdefso undo recreates it exactly;update_settingcaptures the prior value so undo sets it back. Irreversible ops (terminate_backend,cancel_query,run_vacuum,run_analyze,reindex,reset_query_stats) record prior stats for audit but declare no undo. - Safety: every state-changing CLI op supports
--dry-runand requires double confirmation; every write MCP tool takes adry_runpreview. All identifiers that cannot be parameterised (table/index/GUC names) are validated and quoted; all values are bound query parameters.
Capability matrix (35 MCP tools)
| Domain | Tools | Count | R/W |
|---|---|---|---|
| Overview | overview |
1 | read |
| Server | server_version, show_settings, list_extensions, list_databases, list_roles |
5 | read |
| Activity | list_activity, long_running_queries, list_locks |
3 | read |
| Queries | top_queries, explain_query |
2 | read |
| Indexes | unused_indexes, missing_index_hints, index_bloat, invalid_indexes |
4 | read |
| Tables | table_sizes, table_bloat, autovacuum_status |
3 | read |
| Replication | replication_status, replication_slots, wal_status |
3 | read |
| Analysis (flagship) | slow_query_rca, bloat_and_vacuum_analysis, blocking_lock_chain_rca |
3 | read |
| Writes | terminate_backend, cancel_query, drop_index |
3 | write (high) |
run_vacuum, run_analyze, create_index, reindex, update_setting, reset_query_stats |
6 | write (medium) | |
| Undo | undo_list |
1 | read |
undo_apply |
1 | write (medium) |
The flagship analyses accept injected records for pure/offline analysis, or pull
live from a configured target. top_queries/slow_query_rca require the
pg_stat_statements extension; the read role should have pg_monitor.
What this tool does, and does not, decide
It delivers PostgreSQL DBA operations — reads and writes — accurately and efficiently, and records every one of them. It does not decide whether a write is allowed to happen. That is the agent's judgement, or the permission of the account you connect it with: connect with a PostgreSQL role that has no write privileges (a read-only role, or one without INSERT/UPDATE/DELETE/DDL), and the writes fail at the server — the place that actually owns the permission.
So there is no read-only switch, no policy file, no approval gate to configure.
The one thing the tool guarantees is that nothing is silent: every call, over
MCP and over the CLI alike, lands an audit row in ~/.postgres-aiops/audit.db,
and destructive writes still capture their before-state and record an inverse
where one exists.
Each tool declares a
risk_level, carried into the audit row as a descriptive tier (none/confirm/review) — so a reviewer can see at a glance that a row was a high-risk delete. It is a label, not a gate.
Running a smaller / local model? See agent-guardrails.md — it lists the guardrails this tool now enforces for you (so you don't spend prompt budget restating them) and gives a ready-made system prompt for what's left.
Quick start
As a Claude Code plugin
One install gives an agent both the skill and the MCP server:
/plugin marketplace add AIops-tools/marketplace
/plugin install postgres-aiops@aiops-tools
The MCP server is fetched with uv and pinned to the
package version this plugin declares, so an audit row can be traced back to the
code that wrote it. Credentials are still configured with postgres-aiops init — see below.
As an OpenClaw plugin
The same bundle is published on ClawHub, where one install delivers the skill and its MCP server together:
openclaw plugins install clawhub:@zw008/postgres-aiops
openclaw skills info postgres-aiops # expect: Visible to model: yes
Restart the OpenClaw gateway afterwards so it loads the plugin. The MCP server is
fetched with uv, pinned to this exact release, so
uvx has to be on PATH — without it the skill still installs but reports
Visible to model: no. Credentials are configured exactly as below.
As a CLI or standalone MCP server
uv tool install postgres-aiops # or: pipx install postgres-aiops
postgres-aiops init # wizard: add a target + store the password (encrypted)
postgres-aiops doctor # verify config, secrets, connectivity
postgres-aiops overview # one-shot cluster health snapshot
postgres-aiops analyze slow-query # RCA the worst pg_stat_statements entry
postgres-aiops table bloat # dead-tuple bloat proxy per table
Run as an MCP server (stdio):
export POSTGRES_AIOPS_MASTER_PASSWORD=... # unlock secrets non-interactively
postgres-aiops-mcp
Where that password then lives: an exported variable is readable by every process this shell starts and is recorded by shell history. On a shared or long-lived host, prefer the interactive prompt, or inject it from a secret manager for the life of the one command that needs it.
Governance
Every MCP tool passes through the bundled @governed_tool harness:
- Audit — every call (params, outcome summary, status, duration, risk tier, and any
operator-supplied approver/rationale) is logged to
~/.postgres-aiops/audit.db(relocatable viaPOSTGRES_AIOPS_HOME). The CLI writes the same row the MCP path does — there is no unaudited entry point. - Runaway guard — a safety backstop, not an authorization gate: the same call
hammered in a tight loop trips a circuit breaker. Disable with
POSTGRES_RUNAWAY_MAX=0; optional hard ceilings viaPOSTGRES_MAX_TOOL_CALLS/POSTGRES_MAX_TOOL_SECONDS. - Undo recording — reversible writes record an inverse descriptor built from the fetched before-state.
- Risk tier — a descriptive label on the audit row derived from
risk_level; it gates nothing.
Scope
This is the PostgreSQL DBA-ops member of the AIops-tools family (governed
AI-ops with audit + budget + undo + risk tiers). Do NOT use it for OT /
industrial edge (Modbus, OPC-UA, PROFINET) — see the separate industrial-aiops
line — nor for application-schema migrations or ORM management.
Missing a capability?
Coverage is intentionally a curated subset of PostgreSQL's catalogs and maintenance surface. Missing a view, a metric, or a maintenance command? Open an issue or PR — contributions welcome.
Status
The mock test suite is complemented by a live run: the catalog / pg_stat_*
reads, the bloat_and_vacuum_analysis RCA, and the create_index / drop_index
governed write path (audit + undo, with drop_index capturing
pg_get_indexdef first) were exercised against a live PostgreSQL 16.14 instance running in
Docker. docs/VERIFICATION.md records exactly what was
and was not covered. postgres-aiops doctor is the fastest live check.
Postgres AIops MCP 질문
Postgres AIops MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add postgres-aiops -- uvx postgres-aiops를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
Postgres AIops MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
데이터베이스 자격 증명은 어떻게 저장되나요?
자격 증명은 Fernet과 scrypt를 사용하여 ~/.postgres-aiops/secrets.enc에 암호화된 파일로 저장되므로 디스크에 평문으로 남지 않습니다.
모든 작업에 대한 감사 로그를 제공하나요?
네, MCP 또는 CLI를 통해 수행된 모든 호출은 ~/.postgres-aiops/audit.db에 통합 감사 로그로 기록됩니다.
도구의 무분별한 호출을 방지할 방법이 있나요?
네, 동일한 호출이 짧은 루프 내에서 반복적으로 실행될 경우 회로 차단기 역할을 하는 내장 runaway guard가 작동합니다.