Skip to main content

JP Invoice Check

An Agent Skill, CLI and MCP server that checks a Japanese qualified invoice (適格請求書): the six required items, reduced-rate marks, totals per rate, and the rule that consumption tax is rounded once per invoice per rate.

Japan's invoice system requires six items on every qualified invoice, and the tax must be rounded once per invoice for each rate, not line by line (NTA pamphlet: 「端数処理は一請求書当たり、税率ごとに1回ずつ」). A language model that writes an invoice tends to compute tax per line and add it up. On the example below that gives 597 yen instead of 599 for the 10% items and 285 instead of 286 for the 8% items.

This package computes instead of guessing:

  • checks the six items and returns each as true/false (required_items)
  • recomputes tax per rate for floor, half-up and ceil rounding (the method is the issuer's choice) and tells you which one the invoice used
  • names the per-line rounding mistake (E_TAX_LINE_ROUNDING) separately from other wrong tax
  • flags 8% items without a reduced-rate mark, and reduced marks on 10% items
  • normalizes the registration number (full-width, hyphens) and checks T + 13 digits and the corporate-number check digit
  • reads ISO dates, 2026年10月28日, 令和8年10月28日, and periods

Every message comes in English and Japanese. Python standard library only. No network. MIT.

Use as an Agent Skill

Copy this folder into your skills folder (for Claude: ~/.claude/skills/jp-invoice-check/). SKILL.md tells the agent to put the invoice into JSON and run the checker instead of computing tax itself.

CLI

python -m jpinvoice examples/ok.json                    # exit 0
python -m jpinvoice examples/line_rounding_mistake.json # exit 1, lists the errors
python -m jpinvoice invoice.json --rounding floor       # require one rounding method
from jpinvoice import check_invoice, expected_tax
expected_tax(5997, 10)                      # 599  (exclusive, floor)
expected_tax(1000, 10, "inclusive")         # 90
check_invoice(invoice)["errors"]            # [{level, code, field, message, message_ja}, ...]

MCP server (for AI agents)

{"mcpServers": {"jp-invoice-check": {"command": "python", "args": ["-m", "jpinvoice.server"], "cwd": "/path/to/jp-invoice-check"}}}
Tool Input Returns
jp_invoice_check invoice (object) ok, errors, warnings, required_items, by_rate
jp_invoice_registration_number number normalized, valid_format, corporate_check_digit_ok, messages
jp_invoice_tax amount, rate, price_basis, rounding tax

All tools are read-only.

Error codes

E_REGNO_MISSING E_REGNO_FORMAT E_ISSUER_NAME_MISSING E_DATE_MISSING E_DATE_INVALID E_ITEMS_MISSING E_ITEM_DESCRIPTION_MISSING E_RATE_INVALID E_REDUCED_NOT_MARKED E_REDUCED_RATE_MISMATCH E_TOTAL_BY_RATE_MISSING E_TOTAL_MISMATCH E_TAX_MISSING E_TAX_LINE_ROUNDING E_TAX_MISMATCH E_BUYER_MISSING; warnings W_REGNO_NORMALIZED W_REGNO_CHECK_DIGIT W_TOTAL_WITHOUT_ITEMS.

Limits

  • Offline. It does not check whether a registration number is registered today; use the NTA publication site for that.
  • The check digit rule used is the corporate-number rule. For a sole proprietor's number a mismatch is reported only as a warning.
  • Simplified invoices (適格簡易請求書), return invoices and other special cases are not covered.
  • This is a checking tool, not tax advice.
  • Tests: python -m unittest discover -s tests (18 tests)

日本語

適格請求書(インボイス)を検査する Agent Skill・コマンド・MCPサーバーです。

  • 記載事項6つ(発行者名と登録番号・取引年月日・取引内容と軽減税率の印・税率ごとの合計と税率・税率ごとの消費税額・買い手の名称)を1つずつ判定
  • 消費税は「1つの請求書につき税率ごとに1回」端数処理。品目ごとに端数処理して足す誤り(AIがよくする)を E_TAX_LINE_ROUNDING で知らせます。切捨て・四捨五入・切上げのどれを使ったかも返します
  • 8%の品目に※などの印がない、10%なのに印がある、を検出
  • 登録番号を整え(全角・ハイフン)、「T+13桁」と法人番号の検査用数字を確認
  • 西暦・和暦(令和・平成)・期間の日付に対応

外部通信なし(登録が今も有効かは国税庁の公表サイトで確認してください)・Python標準ライブラリのみ・MIT。税務の助言ではありません。

Metadata

Release files for jp-invoice-check 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jp-invoice-check 0.1.0
File Size Uploaded Provenance
jp_invoice_check-0.1.0.tar.gz 13.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for jp-invoice-check 0.1.0
File Interpreter ABI Platform
jp_invoice_check-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.6 kB

Release files / jp_invoice_check-0.1.0.tar.gz

Download URL jp_invoice_check-0.1.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ce2654d6ac33bd909abab13c130665f6d34053770fc78fc836b890a1a8fdca9e
BLAKE2b-256 checksum
How to use checksums
786cec9d5e13dcdba775faac3a8859698df5aa8013bdd85c7f258eb2bee6cb85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / jp_invoice_check-0.1.0-py3-none-any.whl

Download URL jp_invoice_check-0.1.0-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4172b26113bc134db46194ae6dda65875af9dc48d7151b12ec1e42309518d1e1
BLAKE2b-256 checksum
How to use checksums
594e9c260908d1b6659b0caee7399b990d06dc54fea8acc9f6acc71112a55399
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for jp-invoice-check 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page