mcpField
I
Invoice Intake (reference)

Invoice Intake (reference)

Local
justdukkan.comDeveloper Tools0Updated 7w ago

About Invoice Intake (reference)

Invoice Intake (reference) is an MCP server reference implementation for supplier invoice processing, aimed at developers designing safe back-office workflows. It demonstrates separated read, staging, and commit roles, typed errors, audit logs, and server-enforced approval.

Key features

  1. 01Separate reads, staging, and commits
  2. 02Strict tool input schemas
  3. 03Typed errors with retry flags
  4. 04Approval gate and audit log
  5. 05Replayable deterministic workflow

Use cases

  1. 01Design invoice workflows with human approval
  2. 02Study permission separation in MCP tools
  3. 03Test invoice decisions and error handling

MCP support

It provides separate read-role and commit-role MCP servers for reads and reversible staging versus irreversible posting. The server requires recorded human approval before posting.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"com-justdukkan-invoice-intake": {
"command": "uvx",
"args": [
"invoice-intake-mcp"
]
}
}
}
Run commanduvx invoice-intake-mcp

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypiinvoice-intake-mcp0.1.1

Tools

8

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
namestringYes

Details

From the project 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

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

python -m invoice_intake_mcp.orchestrator            # process the inbox
python -m invoice_intake_mcp.approve list            # see what is waiting
python -m invoice_intake_mcp.approve APR-xxxx approved --by cfo
python -m invoice_intake_mcp.orchestrator --resume   # post the approved item
cat 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

{
  "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

pytest                 # unit tests on the core operations and the gate
python 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/             pytest
evals/             cases.jsonl + run.py

MIT. Built by JustDukkan, AI solutions architecture.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.