Invoice Intake (reference)

com.justdukkan由 justdukkan.com 發布v0.1.1更新於 Nov 3, 2026

Reference invoice-intake MCP servers: read/draft/commit split, typed errors, approval gate, audit

已驗證STDIO僅桌面開發者工具商業與電商

概覽

AI 產生的概覽

一個參考用的發票進件 MCP 伺服器,讓助理擷取、比對並暫存供應商發票,入帳須先有記錄在案的人工核准。

可以做什麼
  • 從收件匣擷取發票並解析供應商
  • 將發票與採購單比對並暫存到模擬 ERP
  • 透過獨立的 commit 角色伺服器送出已核准的發票
  • 回傳 approval_required、validation_failed、business_rule、not_found 等具型別錯誤
  • 在僅可追加的稽核日誌中記錄操作者、工具、ID 與核准編號
適用情境
適合作為後台業務流程中安全工具設計的範例:讀取、草稿與送出分離、嚴格 schema、具型別錯誤以及伺服器端核准關卡。它是使用 JSON 檔模擬 ERP 的小型參考實作,並非正式環境的發票系統。
執行需求
以 PyPI 套件形式透過 uvx 在本機以 stdio 執行(Python)。需設定兩個伺服器項目,分別使用 read 角色與 commit 角色。未宣告 API 金鑰或憑證;協調器具確定性,無需金鑰即可重播。
安裝前請注意
commit 角色伺服器會執行不可逆的入帳,因此除非是協調器,否則只應給代理 read 伺服器。沒有記錄在案的核准時入帳會被拒絕,核准須透過另立的 CLI 完成。工具結果被視為不可信輸入,評測集包含提示注入案例。ERP 是本機 JSON 檔,並非真實系統。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Invoice Intake (reference),將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

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

其他 MCP 客戶端

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

README

invoice-intake-mcp

Reference implementation of the tool-design rules in Designing MCP servers and tools that agents can use safely, on a real back-office process: supplier invoice intake.

It is small on purpose. The fake ERP is a JSON file; everything else is the shape we use in production systems.

What it shows

RuleWhere
Model the business operation, not the APIerp_match_po, erp_stage_invoice, not PATCH /invoices
Separate reads, drafts and commits--role read server (reads + reversible staging) vs --role commit server (irreversible post)
Strict schemasLiteral enums for currency, ids not names, found=false as a valid empty result
Permissions on the server and credentialspecialist agents get read; only the orchestrator connects to commit
Tool results are untrusted inputinvoices_extract says so in its description; the eval set includes a prompt-injection case
Typed errors{"error": "approval_required" | "validation_failed" | "business_rule" | "not_found", "retryable": bool, ...}
Log for the auditoraudit.jsonl: actor, tool, ids, approval reference
Human checkpoint enforced server-sideerp_post_invoice refuses without a recorded approval, whatever the client believes

Run it

bash
python -m venv .venv && . .venv/bin/activatepip install -e ".[dev]"
python -m invoice_intake_mcp.orchestrator            # process the inboxpython -m invoice_intake_mcp.approve list            # see what is waitingpython -m invoice_intake_mcp.approve APR-xxxx approved --by cfopython -m invoice_intake_mcp.orchestrator --resume   # post the approved itemcat audit.jsonl

Expected first run:

plan: 4 new invoices -> extract, resolve vendor, match, stage, post-or-approve  invoice_2291.pdf: staged STG-… -> WAITING for APR-…        (7,420 EUR > 5,000 limit)  invoice_2292.pdf: match=goods_not_received -> REVIEW  invoice_2293.pdf: match=variance {"variance_pct": 2.34} -> REVIEW  invoice_2294.pdf: no PO reference -> REVIEW (ask requester)

The orchestrator is deterministic so the flow replays without an API key. An LLM belongs in the places marked in orchestrator.py (ambiguous vendor candidates, free-text remarks, the note back to the requester), not in the match rule, the tolerance or the approval limit.

Use the servers from an MCP client

json
{  "mcpServers": {    "invoice-intake-read":   { "command": "uvx", "args": ["invoice-intake-mcp", "--role", "read"] },    "invoice-intake-commit": { "command": "uvx", "args": ["invoice-intake-mcp", "--role", "commit"] }  }}

Give an agent only the read server unless it is the orchestrator.

Tests and evals

bash
pytest                 # unit tests on the core operations and the gatepython evals/run.py    # replayable decision cases, run on every change

Layout

invoice_intake_mcp/  core.py          business operations + policy (tolerance, approval limit), pure functions  server.py        the two MCP servers and their tool descriptions  orchestrator.py  minimal hub over MCP stdio: read server for work, commit server for posting  approve.py       the human decision, as a CLI  audit.py         append-only JSONL audit log  erp.py           fake ERP / inbox state (JSON file)tests/             pytestevals/             cases.jsonl + run.py

MIT. Built by JustDukkan, AI solutions architecture.

來源:README.md,提交 aa9a9cd

工具

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

版本歷史

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

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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