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

protect-context

โดย XJTLUmediaรุ่น 2.0.0i★ –iรันบนเครื่อง
ชื่อใน registryio.github.XJTLUmedia/protect-context

ติดตั้ง

ภาพรวม

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

Agent guardrails: contract, evidence ledger, loop brake, diff-scope warnings, durable journal.

สามเสาของ PopNx MCP

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

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

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

  • การเชื่อมต่อ: รันบนเครื่อง
  • ช่องทาง (transport): stdio
  • หมวด: บัญชี การเงิน และภาษี

ติดตั้ง

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

ก่อนติดตั้ง

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

  • PyPIติดตั้ง uv ของ Python (มีคำสั่ง uvx) ในเครื่อง

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

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

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

{
  "mcpServers": {
    "protect-context": {
      "command": "uvx",
      "args": [
        "protect-context",
        "mcp"
      ]
    }
  }
}

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

claude mcp add protect-context -- uvx protect-context mcp

เปิดใน Cursor

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

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

{
  "mcpServers": {
    "protect-context": {
      "command": "uvx",
      "args": [
        "protect-context",
        "mcp"
      ]
    }
  }
}

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

เปิดใน VS Code

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

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

{
  "servers": {
    "protect-context": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "protect-context",
        "mcp"
      ]
    }
  }
}

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

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

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

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

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

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

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

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

  • ✓ ผ่าน

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

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

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

    ยังมีคนดูแล

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

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

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

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

  • – ไม่เกี่ยว

    endpoint ตอบ

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

  • – ไม่เกี่ยว

    ล็อกอินแบบ OAuth

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

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

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

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

เทียบกับตัวอื่นในหมวด บัญชี การเงิน และภาษีi

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

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

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

protect-context ปลอดภัยไหม?

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

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

registry ไม่ได้ระบุว่าต้องใช้กุญแจ แต่บางตัวจะขอให้ล็อกอินตอนใช้ครั้งแรก

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

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

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

repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (2.0.0) เข้า registry เมื่อวานซืน

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

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

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

ในหมวดเดียวกันมี Finance Toolkit, SolidInvoice, Korea Tax Calculator

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

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

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

Finance Toolkit

โดย JerBouma

500+ transparent financial methods calculated from raw statements, not third-party endpoints.

บนเครื่องหรือคลาวด์★ 5,496MITอัปเดต เมื่อวานซืน
ติดตั้ง

SolidInvoice

โดย SolidInvoice

Create and send invoices and quotes, manage clients, and track payments in SolidInvoice.

รันบนคลาวด์★ 981MITอัปเดต 7 วันที่ผ่านมา
ติดตั้ง

Korea Tax Calculator

โดย UpstageAI

Korean tax calculation and tax-audit judgment MCP: 96 tools with statutory citations.

รันบนเครื่อง★ 97MITอัปเดต เมื่อวาน
ติดตั้ง

README จากผู้ทำ

เปิดอ่าน README

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

protect-context · Agent Guardrail Suite

Durable context, real evidence, and a brake pedal for AI coding agents.

protect-context keeps the rules, decisions, and proof-of-work an agent needs in front of it — then makes scope creep, unverified claims, and repeated failures visible *before* they cost you a session.

One project-local .agent-guard/ store · three interfaces backed by the same logic:

InterfaceUse it forRuntime
pi extensionAutomatic brief injection, status widget, loop blocking, diff warnings, risky-command confirmationTypeScript, loaded by pi via jiti
MCP serverPortable model/host access to the same toolsPython 3.10+, fastmcp
Python CLIPeople, scripts, CI, and hosts without MCPPython 3.10+

The suite is advisory-first. It records evidence and makes unsafe or repetitive behavior visible; it is not a sandbox and does not prove that a change is correct. SPEC.md is the frozen v1.0 contract.

Contents

  • Why this exists
  • What it does
  • Quick start
  • Install the pi extension
  • Install the MCP server
  • Install the Python CLI
  • From source
  • A 30-second tour
  • Interface comparison
  • Reference
  • pi commands and tools
  • MCP tools
  • CLI
  • Configuration
  • Environment variables
  • Runtime store and concurrency
  • The 12 failure modes and what ships
  • How it works
  • Session lifecycle
  • The brief
  • Local recall
  • Evidence and loop detection
  • Scope audit
  • Trust and provenance
  • Context budget
  • Development and validation
  • Troubleshooting
  • Limitations and security boundary
  • Design sources
  • Non-goals
  • License

Why this exists

Long agent sessions fail in boring, expensive ways:

  • the constraints you stated at minute two are gone by minute forty;
  • "done" is claimed with no command output behind it;
  • a "quick fix" quietly rewrites six unrelated files;
  • decisions get re-litigated because nothing recorded the reasoning;
  • the same failing command is retried until the context window dies.

protect-context treats those as state problems, not intelligence problems. A durable store plus three small habits — brief before work, evidence after work, journal when something is decided — removes most of the failure surface without turning the agent into a different agent.

What it does

PrimitiveWhat it gives youWhere you meet it
BriefOwner task, contract, recent trusted decisions and corrections, a short unverified section for the agent's own notes, open loops, and the last evidence ID — injected before a turn and re-asserted mid-run after a compactionAutomatic in pi; orientation, status, guard_journal elsewhere
OrientationBounded repo digest: tree, languages, and conventions files (CLAUDE.md, AGENTS.md, CONVENTIONS.md, README.md, README)Injected once per digest in pi; orientation in CLI/MCP
Evidence ledgerEvery verification run recorded as ev-NNNN with exit code, duration, command, and a bounded output digestguard_verify, protect-context verify, guard_evidence
Loop brakeIdentical failing commands are fingerprinted; the Nth attempt is blocked instead of re-runHard block in pi and the CLI; reported through MCP
Scope auditgit diff stats over tracked, staged, and bounded untracked work, with ok / warn / hard verdictsWidget and status in pi; diff, guard_diff_audit
JournalDurable decision / correction / risk / note entries with tags and trust levelsguard_note, protect-context note, guard_journal
RecallKeyword, tag, type, evidence-id, and command search over the retained journal and evidence window — no embeddingsguard_recall, protect-context recall; the brief names it when a cap hides entries
Risky-command confirmNine catastrophic shell patterns get one grouped confirmation instead of nonepi, when a UI is available
PreflightTool presence and versions plus Git worktree detectionpreflight, guard_preflight
Context budgetWatermarks on context usage and hard caps on every injected blockWidget, budget, guard_budget

Quick start

Python 3.10+ is required for the CLI and MCP server. Node 22.19+ is required only to validate the TypeScript extension from a checkout — pi supplies the extension's runtime modules, and the extension has zero npm runtime dependencies.

Install the pi extension

Installed from npm. The package declares "pi": { "extensions": ["./extension/index.ts"], "image": "./preview.png" } and the pi-package keyword required by the Pi package gallery:

pi install npm:protect-context

Try it for one run without adding it to settings

pi -e npm:protect-context

Install it through pi, not through npm install. The extension declares pi's host modules (@earendil-works/pi-ai, @earendil-works/pi-coding-agent, typebox) as "*" peer dependencies, as Pi requires; Pi suppresses peer installation for managed npm packages, while a plain npm install protect-context does not. The second path downloads the whole pi runtime and surfaces advisories from that tree, which belong to the host and not to this zero-runtime-dependency extension.

Remove any hand-installed copy first — a directory such as ~/.pi/agent/extensions/protect-context or .pi/extensions/protect-context, or pi remove npm:protect-context if that copy came from npm. Two copies register the same tool names, and pi drops the second one:

Error: Failed to load extension "…/.pi/npm/node_modules/protect-context/extension/index.ts":

Tool "guard_verify" conflicts with /home/you/.pi/agent/extensions/protect-context/index.ts

One error is reported per tool (guard_verify, guard_note, guard_contract_check, guard_status, guard_journal, guard_recall), so nothing from the npm copy loads until the other copy is gone.

Or copy/symlink the checkout into a trusted extension directory:

# Personal

mkdir -p ~/.pi/agent/extensions cp -r extension ~/.pi/agent/extensions/protect-context

Project-local (read after the project is trusted)

mkdir -p .pi/extensions cp -r extension .pi/extensions/protect-context

Start a session and you get a single-line status widget, a brief before the first turn, and five slash commands. No configuration file is needed: the extension seeds .agent-guard/config.json with the frozen defaults on first session start.

Install the MCP server

For pi with pi-mcp-adapter, add .mcp.json at the project root:

{

"mcpServers": { "protect-context": { "command": "/absolute/path/to/protect-context/.venv/bin/python", "args": ["-m", "protect_context.mcp_server"] } } }

The same stdio shape works in any generic MCP host. No checkout is needed either: uvx protect-context mcp runs the same server straight from PyPI. Set PC_SESSION_ID when several host sessions need distinct evidence and loop views:

{

"mcpServers": { "protect-context": { "command": "/absolute/path/to/protect-context/.venv/bin/python", "args": ["-m", "protect_context.mcp_server"], "env": { "PC_SESSION_ID": "my-session" } } } }

The MCP surface exposes the nine frozen v1.0 tools plus later read surfaces (guard_journal, guard_orientation, and guard_recall). Tools carry conservative MCP annotations; in particular guard_verify is marked destructive and open-world because it can run any shell command. Annotations are host hints, not enforcement — configure the host to require human approval for that tool.

Install the Python CLI
pip install protect-context      # or: pipx install protect-context

protect-context init # seed .agent-guard/ in the current project protect-context status protect-context verify "pytest -q" protect-context mcp # serve the MCP tools on stdio

The CLI and MCP server are distributed through PyPI; the npm package ships only the pi extension. Both read the same .agent-guard/ directory, so a project can use the extension in pi and scripted verification in CI at the same time.

From source
# Python package, CLI, MCP server, and Python tests

python3 -m venv .venv .venv/bin/python -m pip install -e ".[dev]"

Reproducible extension development checks (dev dependencies only)

npm ci --ignore-scripts npm run check

If the machine's default Node is older than 22.19, run the same checks with an ephemeral Node 22 binary after npm ci:

npx -y node@22 node_modules/typescript/bin/tsc --noEmit -p extension/tsconfig.json

npx -y node@22 --experimental-strip-types --test extension/test/*.test.ts

A 30-second tour

Excerpts from a real session in this repository.

Ask for the current state:

$ protect-context status

PC status · session default · git 91fad4d Δdiff +88/-8 · 6 files · verdict ok loops: none contract 12 constraints conventions: README.md Nudge: verify changes with guard_verify and cite the evidence id before claiming success.

Record proof instead of asserting it:

$ protect-context verify --timeout 180 npm run check

PC verify ev-0005 · exit 0 · ok · 1440ms cwd: /path/to/project cmd: npm run check digest: … Nudge: cite this evidence id when claiming success.

A pipeline or || true is still recorded with the shell's real exit code, but the report says UNTRUSTED and the CLI exits 1. That exit 0 is not proof.

Re-run the same failing command a third time and the brake engages:

$ protect-context verify "npm test"

PC verify blocked · npm test · 3 prior failures Nudge: change approach or gather new information — do not re-run unchanged.

What pi injects before the agent starts working (sections elided):

contract:

01-obey-instructions: Obey the owner's explicit instructions and stated constraints exactly; when instructions conflict, ask instead of guessing. 02-evidence-before-success: Never claim success without citing a fresh verification run (evidence id or pasted output) for the exact claim. … decisions:

  • Use the atomic-mkdir lease, not fcntl alone; Python must interoperate with the extension. [locking,spec]

last verify: ev-0005 exit=0 'npm ru

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

ถาม PopNx