Mcp Ooxml Ledger

io.github.Anselmoo由 GitHub 帳號 Anselmoo 發布v0.3.0更新於 Oct 24, 2026

Edit Office documents and prove no edit went unrecorded

概覽

AI 產生的概覽

一個 MCP 伺服器,可編輯 Word 與 PowerPoint 文件、記錄每一次變更,並拒絕提交無法解釋的編輯。

可以做什麼
它在工作階段中開啟 Office 文件,並提供讀取工具(describe_structure、find_text)、編輯工具(preview_edits、apply_edits、delete_paragraph、insert_paragraph)以及封存工具(commit_document)。封存前,它會依據文件基準重播所有已記錄的操作,並將結果與磁碟上的內容進行比對;若有無法解釋的變更,提交會被拒絕。它另外提供無狀態驗證工具(digest、verify、list_receipts、export_receipt)以及供聊天用戶端使用的傳輸工具(import_document、export_document)。
適用情境
當助理需要修改 Word 或 PowerPoint 檔案,且你希望有可稽核的記錄來證明沒有編輯未被記錄時,適合使用。它適用於問責性重要的文件編輯工作流程,例如在 CI 或提交前掛鉤中讓無法解釋的變更導致建置失敗。
執行需求
以本機 stdio 程序執行;需要 PATH 中有 uv。文件根目錄透過 OOXML_LEDGER_ROOTS 設定(以 os.pathsep 分隔的清單);若未設定,預設為伺服器的工作目錄。選用的 OOXML_LEDGER_READ_ONLY=1 會限制為唯讀工具,OOXML_LEDGER_IMPORT_MAX_BYTES 設定匯入大小上限(預設 25 MiB)。.mcpb 桌面套件僅在 macOS/arm64 上建置並驗證,首次啟動需要網路存取以從 PyPI 解析固定相依套件。
安裝前請注意
此伺服器會寫入文件以及設定根目錄內的收據檔案,因此請將 OOXML_LEDGER_ROOTS 視為安全邊界並審慎設定。匯入的文件只會寫入 _inbox/,且從不覆寫現有檔案。未簽章的收據只能證明意外,無法防竄改:它無法防止有人在改寫文件的同時改寫收據。v0.3.0 驗證器會依設計拒絕 ooxml-ledger/2 收據,且 verify 從不重播操作。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

mcp-ooxml-ledger

[CI] [codecov] [PyPI] [TestPyPI] [Python] [License: MIT] [MCP]

An MCP server that edits Office documents and refuses to write one where an edit went unrecorded.

Before sealing a session it replays every recorded operation against the document's baseline and compares the result to what is actually on disk. A change no operation explains means the commit is refused. Of ~18 competing MCP document-editing projects, none gates the write on that check. The refusal is the product.

Setup

bash
uv add mcp-ooxml-ledger

Add to .mcp.json (project) or claude_desktop_config.json (desktop — use an absolute path, ${CLAUDE_PROJECT_DIR} isn't expanded there):

json
{  "mcpServers": {    "ooxml-ledger": {      "command": "uv",      "args": ["run", "--project", "${CLAUDE_PROJECT_DIR}", "ooxml-ledger-mcp"],      "env": { "OOXML_LEDGER_ROOTS": "${CLAUDE_PROJECT_DIR}" }    }  }}

Needs uv on PATH; nothing else installed globally. Invoking the ooxml-ledger-mcp script directly gives ENOENT — it lives in the project venv, not your shell's PATH.

OOXML_LEDGER_ROOTS is the security boundary. An os.pathsep-separated list; every path any tool receives is resolved inside it and refused outside. Unset, it defaults to the server's working directory — set it deliberately, since export_receipt writes anywhere inside a root.

Tools

Tool
sessionopen_document · close_documentwrites
readdescribe_structure · find_textread-only
editpreview_edits · apply_edits · delete_paragraph · insert_paragraphwrites
sealcommit_documentwrites · enforces the gate
statelessserver_info · digest · verify · list_receiptsread-only
export_receiptwrites
transferimport_documentwrites — into _inbox/ only
export_documentread-only

Typical loop:

open_document → find_text → preview_edits → apply_edits → commit_document → verify
python
sid = open_document(document="report.docx")["session_id"]find_text(sid, query="Q3 revenue")                     # → part, para_id, para_hashpreview_edits(sid, edits=[...], author="alice")        # → what WOULD happen; writes nothingapply_edits(sid, edits=[...], author="alice", mode="tracked")commit_document(sid)                                   # → refuses if anything is unaccounted forverify("report.docx")                                  # → verified | unknown | failed

preview_edits runs the same engine function as apply_edits against a throwaway copy, so the two cannot disagree. Batches are all-or-nothing: a failing edit leaves the document byte-identical.

mode="tracked" emits Word revision marks a reviewer sees in the document. mode="direct" rewrites the text with none — still fully recorded, and the receipt discloses that a direct edit touched a revision-capable part, so it is never silently indistinguishable from an ordinary save.

Chat and hosted clients

A file uploaded into a chat lives in the client's sandbox, not on the server's filesystem, so open_document correctly refuses its path. Widening OOXML_LEDGER_ROOTS cannot reach it. Send the bytes instead:

import_document → open_document → … → commit_document → export_document
python
p = import_document(name="report.docx", content_base64="UEsDB…")["path"]  # → <root>/_inbox/report.docxsid = open_document(document=p)["session_id"]...                                                    # edit as usualcommit_document(sid)                                   # → receipt schema ooxml-ledger/2export_document(document=p)                            # → file + receipt as embedded resources
  • Where it lands. import_document takes a bare filename and writes _inbox/<name> under the first root. It never overwrites an existing file, and it validates the bytes as a real Office package before anything is published.
  • Large files. A model has to emit the base64 itself, so a single call carries far less than the cap. Send chunks: final=false returns an upload_id; continue with it and offset (the bytes received so far); the final=true call must carry the sha256 of the whole file. A lost or repeated chunk is a refusal, never a different document.
  • Size cap. OOXML_LEDGER_IMPORT_MAX_BYTES sets the largest document either tool accepts, in decoded bytes. The default is 25 MiB.
  • Provenance. An imported document's first bytes on this host came from a tool call, not from the user's filesystem. Every receipt in that lineage is therefore sealed as ooxml-ledger/2, with a chain-bound provenance block (docs/superpowers/specs/receipt-format-v2.md). verify prints it as a PROVENANCE line, and it never changes the verdict. Receipts for every other document stay ooxml-ledger/1, byte-identical to before.
  • Getting it back. export_document returns the file as an MCP embedded resource, with its Office media type and the receipt alongside. By default it refuses a document that no stored receipt matches, so an unsealed edit is never handed out; pass require_receipt=false to override.

Format matrix

FormatVerifyEdit
Word .docxYesYes — tracked + direct, paragraph insert/delete
PowerPoint .pptxYesDirect only — PresentationML has no revision model, so every edit carries a mandatory disclosure
Excel .xlsxYesNo — editing verbs refuse, naming the format

Verification, digests, the gate and the receipt model are format-agnostic. Only the editing engines are format-specific: wml.py (Word) and pml.py (PowerPoint).

Read-only deployment

OOXML_LEDGER_READ_ONLY=1 leaves exactly server_info, digest, verify, list_receipts, export_document. The others aren't merely hidden — calling one answers Unknown tool. No write surface inside the roots at all.

CLI

bash
ooxml-ledger verify report.docx    # exit 0 only when verified

No server, no session — digests the file, finds its receipt by content address, checks it. Wire it into CI or a pre-commit hook and an unaccounted-for change fails the build.

Desktop bundle (.mcpb)

Every GitHub Release attaches a .mcpb file — a one-click Claude Desktop install: drag it onto the app and Desktop launches it with uv run --directory <bundle> --frozen --no-dev ooxml-ledger-mcp. Nothing is vendored — the bundle carries only manifest.json, pyproject.toml, uv.lock, README.md, LICENSE and src/. The host needs uv on PATH, and the first launch resolves the exact dependency versions uv.lock pins from PyPI, which needs network access; --frozen means it installs precisely the versions the test suite ran against, never a fresh resolve, and --no-dev keeps the dev group (pytest, ruff, pre-commit) out of the install. mcpb/manifest.json exposes the document root and read-only toggle as install-time settings instead of environment variables; the tool list matches the stdio server's.

CI builds and smoke-tests the bundle on macos-latest only, and the manifest's compatibility.platforms declares darwin only — the bundle is built and proven on macOS/arm64, nothing else. Because nothing is vendored, uv itself picks a Python satisfying requires-python = ">=3.13" and installs the wheels uv.lock pins for the host's own platform — native ones such as pydantic-core and cryptography included. That part is not darwin-specific, but only the darwin launch path has actually been proven end-to-end here.

Honest limits

  • An unsigned receipt is accident-evident, not tamper-evident. It catches an agent falling back to a generic file write, an Office round-trip, a careless collaborator — not someone who rewrites the receipt alongside the document. Anchoring its hash somewhere the holder doesn't control (a git commit, a DOI, a submission portal) is what buys tamper-evidence.
  • Imported provenance lives beside _inbox/. The import record sits in the store next to the imported file. Moving that file out of _inbox/ before its first commit drops the record, so the first receipt is written as v1. After a commit, the lineage travels with the receipts store. Provenance records what arrived, not that it matches the user's original upload: compare its sha256 out of band if that matters.
  • A v0.3.0 verifier rejects ooxml-ledger/2. This is by design. It cannot check the genesis rule, so refusing is better than silently accepting a chain it does not understand.
  • verify never replays. It checks the digest and the receipt's internal consistency; the replay runs once, at commit, and verify reports that verdict rather than recomputing it.
  • pptx and xlsx have no human-visible record. Word tracked changes are a second recording layer inside the document; those two formats have none, so the ledger is the only record.
  • The Word engine reaches paragraph text only (w:p/w:r/w:t). Styles, numbering, settings and relationships are uneditable and covered by the accountability check alone.

Contributing and security

CONTRIBUTING.md covers setup, the branch and commit naming CI enforces, and the release flow. SECURITY.md covers private vulnerability reporting, and is explicit about which of this project's documented limits are design rather than defects.

MIT licensed. Design notes and specifications live in docs/superpowers/.

來源:README.md,提交 e5eac71

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分