Repository avatar
AI Tools
v0.3.0
active

xrechnung-validator

io.github.wenboteng/xrechnung-validator

Validate XRechnung XML and ZUGFeRD / Factur-X PDFs with the free checkxrechnung.com API.

Documentation

XRechnung / ZUGFeRD validator — free API, CLI, and MCP server

Client tools for the free, keyless validator at checkxrechnung.com. Send one XRechnung XML file (UBL or CII) or a ZUGFeRD PDF and get EN 16931 / XRechnung rule results back. The API runs the KoSIT validator with the official XRechnung configuration.

This repository is only the public client: CLI, MCP server, OpenAPI copy, samples, and examples. It does not contain the validator engine.

The file is uploaded to POST https://checkxrechnung.com/v1/validate for that request. The service reports persisted: false.

Free limits

LimitValue
API keynone
Per IP per UTC day50 validations
Per minute10
Max upload5 MB on POST /v1/validate. 10 MB on POST /v1/zugferd/validate and POST /v1/zugferd/extract
Over the daily or minute limitHTTP 429 and Retry-After
Over 5 MBHTTP 413

More volume: a free API key gives 500 checks per calendar month with no daily cap (60 per minute, from any IP, for example in CI). Send it as the X-API-Key header: curl -H "X-API-Key: xr_free_..." -F "file=@invoice.xml" https://checkxrechnung.com/v1/validate. API Pro (EUR 19/month, 5,000 checks) upgrades that same key, so your code does not change. The CLI and MCP server below call the keyless API. Docs: English, Deutsch. Machine-readable contract: openapi.json (copy in openapi/openapi.json).

A file can pass here and still be rejected by a portal such as ZRE or OZG-RE. This is not a Peppol access point and not legal or tax advice.

curl

UBL, using the published valid sample:

curl -F "file=@samples/valid-xrechnung-ubl.xml" https://checkxrechnung.com/v1/validate

CII uses the same endpoint and the same file field. Point it at a Cross Industry Invoice XML file:

curl -F "file=@invoice-cii.xml" https://checkxrechnung.com/v1/validate

examples/curl.sh wraps the same request. The public sample set below is UBL plus a PDF; it does not include a CII file.

Sample request and response

Request:

curl -F "file=@samples/invalid-xrechnung-ubl.xml" https://checkxrechnung.com/v1/validate

The invalid sample is published as failing. The API docs show this shape (first issue only; the full report has more):

{
  "ok": false,
  "persisted": false,
  "fileName": "invalid-xrechnung-ubl.xml",
  "bytes": 2496,
  "hasXml": true,
  "syntax": "UBL Invoice",
  "invoiceType": "XRechnung",
  "summary": { "errors": 14, "warnings": 0 },
  "versions": {
    "product": "RechnungCheck",
    "domain": "checkxrechnung.com",
    "xrechnung": "3.0.2",
    "kosit_validator": "1.6.3",
    "kosit_configuration": "2026-08-31",
    "en16931_schematron": "1.3.16"
  },
  "issues": [
    {
      "severity": "error",
      "code": "BR-08",
      "location": "/Invoice",
      "message": "[BR-08]-An Invoice shall contain the Seller postal address.",
      "hint": "Die Verkäuferanschrift (BG-5) fehlt. StreetName, CityName, PostalZone und Country/IdentificationCode setzen.",
      "source": "kosit"
    }
  ]
}

ok: true means the file passed. The CLI and MCP server map that to valid, and map each issue's code to rule_id. When the response includes rule_url (or ruleUrl), that URL is kept. Otherwise the tools link the public rule page https://checkxrechnung.com/fehler/<code> in lowercase. Some rule pages are not published yet.

Samples

Downloaded from checkxrechnung.com/samples. Synthetic data, not real invoices.

FileWhat the site says to expect
samples/valid-xrechnung-ubl.xmlValid XRechnung 3.0 UBL. Pass, no errors.
samples/invalid-xrechnung-ubl.xmlMissing required data. Fail, 14 errors, including BR-08 and BR-DE-15.
samples/plain-invoice.pdfPDF with no embedded XML. Not an e-invoice.
samples/factur-x-en16931.pdfSynthetic Factur-X PDF, profile EN16931. xrechnung-check zugferd expects a pass.
samples/factur-x-en16931-invalid.pdfSame profile, seller address removed. Expect BR-08 and BR-09 with rule_url.
samples/factur-x-minimum.pdfProfile MINIMUM. EN 16931 CII rules can fail a correct subset.
samples/zugferd-xrechnung.pdfProfile XRECHNUNG, embedded xrechnung.xml.

CLI

Python 3.9+, package xrechnung-check. The only dependency is requests.

pip install ./cli
xrechnung-check samples/valid-xrechnung-ubl.xml
xrechnung-check samples/invalid-xrechnung-ubl.xml --json
xrechnung-check zugferd samples/factur-x-en16931.pdf
xrechnung-check extract samples/factur-x-en16931.pdf --json

zugferd posts the PDF to POST /v1/zugferd/validate (PDF/A-3 check, profile, EN 16931 CII Schematron, rule_url). extract posts it to POST /v1/zugferd/extract and prints the raw XML plus the JSON summary. Both share the free counter with POST /v1/validate. The PDF limit is 10 MB.

Node 18+, package xrechnung-check, no dependencies:

npx ./cli-node samples/valid-xrechnung-ubl.xml
node cli-node/bin/xrechnung-check.js samples/invalid-xrechnung-ubl.xml --json
node cli-node/bin/xrechnung-check.js zugferd samples/factur-x-en16931.pdf

Human output prints each issue with its rule id and rule_url. --json prints the normalized report. Exit 0 when valid is true, 1 when the file fails or is not an e-invoice, 2 on usage, file, or HTTP errors (including 413 and 429).

Published install: pip install xrechnung-check and npx xrechnung-check file.xml. The MCP server is npx -y xrechnung-validator-mcp, registry name io.github.wenboteng/xrechnung-validator. See llms-install.md.

MCP server

mcp/ is a stdio MCP server, package xrechnung-validator-mcp 0.2.1. Tools: validate_xrechnung (file_path or xml), validate_zugferd (file_path), and extract_zugferd (file_path). Validation results are valid plus errors[] (rule_id, severity, location, message, hint, rule_url). Extract returns ok, profile, summary, and the raw xml.

Registry metadata is in mcp/server.json (io.github.wenboteng/xrechnung-validator). Config snippets for Claude Desktop, Cursor, and VS Code are in mcp/README.md. Listed in the official MCP registry as io.github.wenboteng/xrechnung-validator (v0.2.1).

Hosted MCP server (no install)

https://checkxrechnung.com/mcp is a remote MCP server (Streamable HTTP) with the same tools: validate_xrechnung (xml or file_base64), validate_zugferd and extract_zugferd (file_base64 of the PDF). Files are sent inline, nothing is stored. Without a key the free limit is 50 checks per IP per UTC day; send a free API key as X-API-Key or Authorization: Bearer for 500 a month. Claude Code: claude mcp add --transport http xrechnung https://checkxrechnung.com/mcp. Generic config: {"mcpServers": {"xrechnung": {"type": "http", "url": "https://checkxrechnung.com/mcp"}}}.

Examples

Short snippets that post the file field. Each run spends one free validation.

LanguageFile
curlexamples/curl.sh
Python (requests)examples/python_requests.py
Node (fetch)examples/node_fetch.mjs
PHPexamples/validate.php
C#examples/Program.cs
Javaexamples/Validate.java

Links

Deutsch

Kostenlose Client-Werkzeuge für die Prüfung von XRechnung (UBL und CII) und ZUGFeRD auf checkxrechnung.com. Kein API-Schlüssel nötig. Dieses Repository enthält nur Clients, Beispiele und die öffentliche OpenAPI-Datei, nicht die Validator-Engine.

Die Datei geht an POST https://checkxrechnung.com/v1/validate und wird für diese eine Anfrage geprüft. Die Antwort enthält persisted: false.

Grenzen: 50 Prüfungen pro IP und UTC-Tag, höchstens 10 pro Minute, gemeinsamer Zähler. POST /v1/validate maximal 5 MB, die ZUGFeRD-Endpunkte maximal 10 MB. Darüber HTTP 429 mit Retry-After, bei zu großen Dateien HTTP 413. Mehr Volumen: Ein kostenloser API-Key gibt 500 Prüfungen pro Kalendermonat ohne Tageslimit (60 pro Minute, von jeder IP, z. B. in CI), im Header X-API-Key. API Pro (19 €/Monat, 5.000 Prüfungen) upgradet denselben Key, am Code ändert sich nichts.

ZUGFeRD / Factur-X:

curl -F "file=@samples/factur-x-en16931.pdf" https://checkxrechnung.com/v1/zugferd/validate
xrechnung-check zugferd samples/factur-x-en16931.pdf
xrechnung-check extract samples/factur-x-en16931.pdf

UBL:

curl -F "file=@samples/valid-xrechnung-ubl.xml" https://checkxrechnung.com/v1/validate

CII, gleiche Schnittstelle, andere Datei:

curl -F "file=@invoice-cii.xml" https://checkxrechnung.com/v1/validate

Die Beispieldateien unter samples/ stammen von checkxrechnung.com/samples: gültige XRechnung-UBL, ungültige XRechnung-UBL (14 Fehler, unter anderem BR-08 und BR-DE-15) und ein PDF ohne XML.

CLI: pip install xrechnung-check, dann xrechnung-check datei.xml, oder npx xrechnung-check datei.xml. Exit-Code 0 bei gültig, 1 bei ungültig, 2 bei Aufruf- oder HTTP-Fehler. --json gibt den normalisierten Bericht aus, inklusive Regel-ID und rule_url. Der MCP-Server ist npx -y xrechnung-validator-mcp (Registry io.github.wenboteng/xrechnung-validator).

Links: API-Doku, englische Doku, OpenAPI, Fehler-Codes, Kostenloser API-Key.

Ein bestandener Check kann bei ZRE, OZG-RE oder einem anderen Portal trotzdem scheitern. Kein Peppol-Zugang und keine Rechts- oder Steuerberatung.

Development

GitHub Actions lints the Python and Node clients, typechecks the MCP server, boots it over stdio, and runs one live check of the valid sample. That live check skips when checkxrechnung.com:443 cannot be reached.

python -m pip install ./cli
python -m unittest discover -s tests -p 'test_*.py' -v
node --test cli-node/test
cd mcp && npm ci && npm run build && node --test test && node scripts/stdio-smoke.mjs

node mcp/scripts/stdio-smoke.mjs samples/invalid-xrechnung-ubl.xml performs one extra live tool call. Do not loop it: the free quota is 50 per IP per UTC day.

Publishing

Published as version 0.2.1 (ZUGFeRD/Factur-X since 0.2.0): xrechnung-check on npm and PyPI, xrechnung-validator-mcp on npm, and io.github.wenboteng/xrechnung-validator in the MCP registry. Do not publish from CI.

PyPI, from a machine logged in via ~/.pypirc or an API token:

cd cli
python -m pip install build twine
python -m build
python -m twine upload dist/*

npm CLI (unscoped package, public by default):

cd cli-node
npm login
npm publish

npm MCP server. npm publish runs prepack, which compiles TypeScript. Publish this package before the registry entry, because the registry checks mcpName in the published package.json.

cd mcp
npm login
npm publish

MCP registry, only after that npm publish. Use the official mcp-publisher binary from modelcontextprotocol/registry, not the unrelated npm package named mcp-publisher.

curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
sudo mv mcp-publisher /usr/local/bin/
cd mcp
mcp-publisher validate server.json
mcp-publisher login github
mcp-publisher publish

GitHub repository this metadata points at:

gh repo create wenboteng/xrechnung-validator --public --source=. --remote=origin \
  --description "Free XRechnung / ZUGFeRD (EN 16931) validator API — CLI, MCP server, examples. Powered by checkxrechnung.com" \
  --push
gh repo edit wenboteng/xrechnung-validator \
  --add-topic xrechnung --add-topic zugferd --add-topic e-invoicing --add-topic en16931 \
  --add-topic validator --add-topic mcp --add-topic einvoice --add-topic germany

License

MIT. Copyright (c) 2026 Bobook Limited. See LICENSE.

The API is operated by Bobook Limited. Contact published on the service: info@bobook.club.