ต้นแบบ · รุ่นทดลอง: มีทุก server ในทะเบียนทางการ อัปเดตทุก 30 นาที รีวิวและบัญชีผู้ใช้จะมาในขั้นถัดไป
PopNx MCPที่รวม MCP สำหรับคนใช้ AI · อธิบายเป็นภาษาคน

PgVouch

โดย Shubh-Sgrรุ่น 0.4.4i★ –iรันบนเครื่อง
ชื่อใน registryio.github.Shubh-Sgr/pgvouch

ติดตั้ง

ภาพรวม

คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)

Safe PostgreSQL migrations: schema drift, lock analysis, safe rewrites, data checksums. Read-only.

สามเสาของ PopNx MCP

สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน

ใช้ทำอะไรได้

ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry

  • การเชื่อมต่อ: รันบนเครื่อง
  • ช่องทาง (transport): stdio
  • หมวด: ฐานข้อมูลและชุดข้อมูล
  • ต้องใส่ค่าเหล่านี้: SOURCE_DATABASE_URL, TARGET_DATABASE_URL

ติดตั้ง

เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง

ก่อนติดตั้ง

ค่าที่ติดป้ายความลับคือกุญแจของบัญชีคุณ อย่าส่งให้ใคร และอย่าวางในแชต

ต้องเตรียมก่อน

  • npmติดตั้ง Node.js (มีคำสั่ง npx) ในเครื่อง

คุณใช้แอปไหน

เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”

เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json

{
  "mcpServers": {
    "pgvouch": {
      "command": "npx",
      "args": [
        "-y",
        "pgvouch",
        "mcp"
      ],
      "env": {
        "SOURCE_DATABASE_URL": "ใส่ค่าของคุณ",
        "TARGET_DATABASE_URL": "ใส่ค่าของคุณ",
        "PGVOUCH_LLM": "ใส่ค่าของคุณ"
      }
    }
  }
}

พิมพ์คำสั่งนี้ใน Terminal

claude mcp add pgvouch --env SOURCE_DATABASE_URL='ใส่ค่าของคุณ' --env TARGET_DATABASE_URL='ใส่ค่าของคุณ' --env PGVOUCH_LLM='ใส่ค่าของคุณ' -- npx -y pgvouch mcp

เติมค่าที่เว้นว่างไว้ก่อนรัน

เปิดใน Cursor

หรือคัดลอกค่าตั้งเอง

วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json

{
  "mcpServers": {
    "pgvouch": {
      "command": "npx",
      "args": [
        "-y",
        "pgvouch",
        "mcp"
      ],
      "env": {
        "SOURCE_DATABASE_URL": "ใส่ค่าของคุณ",
        "TARGET_DATABASE_URL": "ใส่ค่าของคุณ",
        "PGVOUCH_LLM": "ใส่ค่าของคุณ"
      }
    }
  }
}

เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง

เปิดใน VS Code

หรือคัดลอกค่าตั้งเอง

วางในไฟล์ .vscode/mcp.json ของโปรเจกต์

{
  "servers": {
    "pgvouch": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "pgvouch",
        "mcp"
      ],
      "env": {
        "SOURCE_DATABASE_URL": "ใส่ค่าของคุณ",
        "TARGET_DATABASE_URL": "ใส่ค่าของคุณ",
        "PGVOUCH_LLM": "ใส่ค่าของคุณ"
      }
    }
  }
}

เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง

ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น

ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี

ค่าที่ต้องใส่เอง

  • SOURCE_DATABASE_URL ความลับ จำเป็น env
    Read-only postgres:// URL of the reference database
  • TARGET_DATABASE_URL ความลับ จำเป็น env
    Read-only postgres:// URL of the database to check
  • PGVOUCH_LLM env
    Optional planner LLM: none (default), ollama or gemini

ค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README

ทำอะไรได้บ้าง

รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง

ผลตรวจเบื้องต้นi

เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 7 พ.ย. 2569

  • ✓ ผ่าน

    ตัวตนผู้ทำตรงกับ repo

    ชื่อใน registry ยืนยันด้วยบัญชี GitHub Shubh-Sgr ซึ่งเป็นเจ้าของ repo

  • … ยังไม่ตรวจ

    ยังมีคนดูแล

    ยังไม่ได้อ่านข้อมูล repo จาก GitHub

  • … ยังไม่ตรวจ

    มีสัญญาอนุญาต (license)

    ยังไม่ได้อ่านข้อมูล repo จาก GitHub

  • – ไม่เกี่ยว

    endpoint ตอบ

    ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต

  • – ไม่เกี่ยว

    ล็อกอินแบบ OAuth

    ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน

  • … ยังไม่ตรวจ

    คำอธิบายเครื่องมือไม่มีคำสั่งแอบแฝง

    รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต

เทียบกับตัวอื่นในหมวด ฐานข้อมูลและชุดข้อมูลi

  • ดาวมากกว่า 0% ของอีก 954 ตัวในหมวดนี้
  • ส่งรุ่นใหม่เข้า registry ล่าสุดกว่า 65% ของอีก 954 ตัวในหมวดนี้
  • ผลตรวจเบื้องต้นดีกว่าหรือเท่ากับ 100% ของอีก 954 ตัวในหมวดนี้

เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo

คำถามที่พบบ่อย

PgVouch ปลอดภัยไหม?

จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น

ต้องใช้กุญแจหรือรหัสอะไรบ้าง?

ต้องใส่ค่าเหล่านี้: SOURCE_DATABASE_URL, TARGET_DATABASE_URL

ตัวนี้รันบนเครื่องหรือบนคลาวด์?

รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)

ยังมีคนดูแลอยู่ไหม?

repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (0.4.4) เข้า registry 34 วันที่ผ่านมา

ใช้กับโปรแกรมไหนได้บ้าง?

โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Node.js ในเครื่องด้วย

มีตัวไหนใช้แทนได้บ้าง?

ในหมวดเดียวกันมี Supabase, MongoDB MCP Server, Elasticsearch MCP Server

ตัวที่ใช้แทนได้

server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว

อ่านการ์ด:★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi

Supabase

โดย supabase

server ทางการของ Supabase ให้ AI สร้างตาราง ถามข้อมูล และดูการตั้งค่าโปรเจกต์ในฐานข้อมูล Supabase ของคุณ

บนเครื่องหรือคลาวด์★ 2,993Apache-2.0อัปเดต เมื่อวาน
ติดตั้ง

MongoDB MCP Server

โดย mongodb-js

MongoDB Model Context Protocol Server

รันบนเครื่อง★ 1,157Apache-2.0อัปเดต เมื่อวานซืน
ติดตั้ง

Elasticsearch MCP Server

โดย cr7258

MCP server for interacting with Elasticsearch

รันบนเครื่อง★ 315Apache-2.0อัปเดต 14 เดือนที่ผ่านมา
ติดตั้ง

README จากผู้ทำ

เปิดอ่าน README

ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ PopNx MCP ไม่ได้ตรวจหรือรับรองเนื้อหา ตัด HTML รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ

PgVouch

An MCP server + CLI that lets AI assistants safely inspect, plan and _prove_ PostgreSQL migrations. The LLM proposes; deterministic code decides.

Real output against the seeded demo databases (1M transactions, 2M ledger entries) with the target broken as in step 2 below. Typing is real-time; command run times are shortened (the verify run took 14.0 s).

The problem

Writing ALTER TABLE is the easy part of a database migration. The hard parts are:

  1. What differs? Schemas drift between environments (hotfixes, failed migrations, manual changes).
  2. What will it lock? CREATE INDEX on a busy table blocks every write until it finishes. A "1 ms" ALTER TABLE can still cause an outage by waiting in the lock queue.
  3. Is the data really the same? "Row counts match" is not proof.
  4. Which rows are wrong? When proof fails, you need the exact rows, not "something in this 2M-row table".

AI assistants now write migrations, but they hallucinate objects, ignore locks and can't prove anything. PgVouch gives them (and you) read-only tools that answer those four questions, and it wraps every AI suggestion in deterministic checks.

Results (measured, not estimated)

All numbers come from npm run eval against the seeded Docker databases. The full tables are in evals/.

WhatResult
Drift detection over 32 seeded scenarios (tables, views, functions, triggers, enums, extensions, RLS)100% precision, 100% recall (34 true positives, 0 false positives, 0 missed)
Exact differing rows found by checksum bisection100% of seeded row changes, 0 false rows
Rows fetched to find them311 rows instead of 6,079,997 (the rows in the mismatched tables, both sides)
Lock mode predicted vs lock actually taken (read from pg_locks)36/36 statements, on PostgreSQL 13, 14, 15, 16 and 17
Table rewrite predicted vs actual rewrite (pg_class.relfilenode changed)35/35 statements
Sequence left behind its data after a copy (next INSERT would hit a duplicate key)found 1/1, 0 false alarms in 10 checks
Rules-only migration plans that pass a shadow run on a real schema copy27/27
LLM plans (local llama3.2, 3B), 17 drift scenarios of the first 21-scenario suite, *validator-only acceptance (v0.1.0)*5.9% valid on first try, 17.6% after one retry, 82.4% fell back to the rules plan; 0/3 accepted LLM plans passed the shadow run

Application stall during the migration, measured on the 1M-row table with a probe query every ~10 ms (evals/results-rewrite.md):

MigrationOriginal: max stallPgVouch rewrite: max stallRewrite total time
CREATE INDEX1.58 s47 ms2.1 s
ADD FOREIGN KEY (2M rows)1.01 s49 ms1.2 s
ADD CHECK440 ms63 ms0.85 s
SET NOT NULL625 ms31 ms0.68 s
ADD COLUMN ... NOT NULL DEFAULT gen_random_uuid()10.94 s964 ms108.7 s (batched backfill)
ALTER COLUMN merchant_id TYPE bigint6.51 s93 ms28.0 s (includes re-creating its foreign key; +3 manual steps)

What the LLM numbers show: a small local model is not reliable at migration planning. That's why PgVouch never trusts it. The validator rejected 14/17 plans (unparseable SQL, hallucinated or duplicate objects, blocking DDL). The 3 it accepted were *safe but incomplete*, and only the shadow run caught that (e.g. a missing index and a sequence left out when re-creating a dropped table). Deterministic rules plans passed all 17 (27/27 with the scenarios added later). Details: evals/results-llm.md.

What changed because of it: those numbers were measured when the validator alone decided. Now an LLM plan is accepted only if it passes the validator and a shadow run whose result matches the source exactly; a shadow failure is sent back to the LLM for one retry, then PgVouch falls back to the rules plan. So the 3 incomplete plans above would now be rejected. The LLM eval has not been re-run with the new pipeline yet, so there is no new number here.

The trade-off is visible: the rewrites that need a backfill take much longer in total, but the application keeps running. These are single runs on a laptop (Apple M1, 8 cores, Docker Desktop). Expect the absolute numbers to vary; the gap is the point.

How it works

flowchart LR

A["AI assistant (Claude Code, Cursor)"] -- "MCP (JSON-RPC, stdio)" --> S U["You (terminal)"] -- CLI --> S subgraph S["PgVouch core"] I["F1 introspect pg_catalog"] --> D["F2 diff (pure function)"] D --> P["F7 planner LLM + guardrail validator"] L["F5 lock analyzer (Postgres parser)"] --> R["F6 safe rewrites"] R --> P P --> SH["F10 shadow run (throwaway container)"] V["F3 chunked checksums"] --> B["F4 bisection"] P --> RC["F12 receipt (SHA-256)"] end S -- "read-only SQL" --> SRC[("source DB")] S -- "read-only SQL" --> TGT[("target DB")] P -. "structured facts only, no rows" .-> LLM["Ollama (local) or Gemini"]

Golden rule: the LLM never touches a database and never decides pass/fail. It proposes; the parser, the rules and the shadow run decide.

#FeatureHow
F1Schema introspectionpg_catalog (not information_schema, which hides index methods, partial-index predicates and NOT VALID)
F2Drift detectionA pure diffSchemas(source, target) over tables, columns, indexes, constraints, sequences, views, functions, triggers (including disabled ones), enum types, extensions and row-level security: deterministic and sorted, with severity rules, and it never guesses renames
F3Data verificationmd5(string_agg(md5(row::text) ORDER BY pk)) per primary-key chunk, inside a REPEATABLE READ snapshot with normalized session settings. Text keys are ordered byte-wise (COLLATE "C"), so servers with different collations agree. Also checks that every identity/serial sequence on the target is ahead of its data. On a target still being replicated to, --recheck looks at the differences again after a delay and reports only those that never catch up
F4Checksum bisectionMerkle-style: split the mismatched chunk at its median key and recurse only into halves whose hashes differ
F5Lock analyzerlibpg-query (Postgres' own parser, WASM) → rule table → risk from reltuples
F6Safe rewritesCONCURRENTLY, NOT VALID + VALIDATE, UNIQUE ... USING INDEX, expand/contract, batched DO loops with COMMIT per batch
F7Guarded LLM plannerzod-checked JSON → validator (parses, allow-list, objects exist, no unsafe DDL) → shadow run (the result must match the source) → one retry with the errors → rules-only fallback
F8MCP server7 read-only tools over stdio
F9Eval suite32 drift/data scenarios, 36 lock statements with ground truth from Postgres, and a stall benchmark under load
F10Shadow runsCopies the target's *schema* into a disposable container, applies the plan, and diffs the result against the source
F11ReversibilityTags each step reversible / reversible-with-backfill / data-lossy and generates rollback SQL
F12ReceiptsJSON of drift + verification + plan + shadow, with a SHA-256 over canonical (sorted-key) JSON
F13Lock-queue preflight"Safe to run right now?": the locks each statement needs vs. live pg_locks + pg_stat_activity, using Postgres' full 8×8 lock conflict table
F14PR review actionpgvouch review --format markdown + a GitHub Action: lock analysis and safe rewrites of changed migrations as a job summary and one PR comment

Get started

There are two ways to use PgVouch:

Option A: npm packageOption B: clone the repo
Best forYour own databases, CI, or an AI assistantTrying every feature on seeded demo databases, or contributing
NeedsNode 22 (or 20.12+)Node 22 (or 20.12+) and Docker
Commands run aspgvouch (or npx pgvouch )npm run cli --
Option A: use the npm package

1. Try it now, no database needed. Point it at any migration file:

npx pgvouch locks my_migration.sql --offline     # the locks each statement takes, and the risk

npx pgvouch rewrite my_migration.sql --offline # a safe, non-blocking version of the same migration

No migration file handy? Create one: echo "CREATE INDEX idx_amount ON transactions (amount);" > my_migration.sql

2. Install it (optional: npx pgvouch works without installing):

npm install -g pgvouch

pgvouch --help

3. Point it at your databases. Create a read-only role on each database (the SQL is here), then put a .env file in the folder you run PgVouch from:

SOURCE_DATABASE_URL=postgres://pgvouch_ro:PASSWORD@staging-host:5432/your_db

TARGET_DATABASE_URL=postgres://pgvouch_ro:PASSWORD@prod-host:5432/your_db PGVOUCH_LLM=none # rules-only plans; set it to ollama to let a local LLM propose plans

Variables already set in your environment take precedence over .env. Then check that both connections are read-only:

pgvouch doctor   # must say read_only=true and write privileges: none

4. Run it:

pgvouch diff                                      # schema drift (exit code 1 if any)

pgvouch verify --rows # checksums + exact differing rows pgvouch verify --rows --recheck 3 # target still being replicated to: ignore rows in flight pgvouch locks my_migration.sql # lock impact per statement, with real table sizes pgvouch preflight my_migration.sql # would it have to wait for locks RIGHT NOW? pgvouch rewrite my_migration.sql # safe multi-step script pgvouch review --format markdown migrations/*.sql # PR-comment report (offline, used by the GitHub Action) pgvouch plan --no-llm # rules-only plan that makes target match source pgvouch plan # LLM plan (Ollama) behind guardrails pgvouch shadow # plan, then prove it on a throwaway container (needs Docker) pgvouch receipt --shadow # hashed audit record pgvouch receipt-verify pgvouch-receipt.json

locks --fail-on high exits with code 1, so it can gate a CI pipeline on risky migrations.

preflight answers a different question: not "what will this lock?" but "is anyone holding or waiting for a conflicting lock right now?". It lists the sessions it would queue behind (pid, user, application, state, transaction age; never their query text), and flags that CREATE INDEX CONCURRENTLY waits for every older transaction in the database. It exits with code 1 if the migration would wait. PgVouch never terminates sessions.

5. Also: use it from an AI assistant (npx -y pgvouch mcp), or review every migration pull request with the GitHub Action (step 4 there).

Option B: clone the repo (demo databases included)

The repo includes two seeded Postgres databases, so you can try every feature without touching a real database. Requirements: Node 22 (or 20.12+) and Docker.

git clone https://github.com/Shubh-Sgr/pgvouch.git && cd pgvouch

npm in

ตัดมาแค่ช่วงต้น อ่านต่อใน repo

ถาม PopNx