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 分