New advertisers: 50% off your first month with code FIRSTMONTHSee slots
salmankhan957 avatar

ZATCA e-invoicing (Saudi Fatoora)

salmankhan957/zatca-toolkit

Create, sign, validate, and submit Saudi ZATCA Phase 2 e-invoices through the Fatoora API.

tools
7
auth
Secret needed
transport
STDIO
env vars
5
last updated
Nov 14, 2026
View on GitHub

What it does

  • Builds and signs invoices with create_invoice, then runs offline checks with validate_invoice and compute_invoice_hash
  • Decodes QR payloads with decode_qr, explains rule and API errors with explain_error, and generates CSRs with generate_csr
  • Sends signed invoices to the Fatoora API with submit_invoice, which needs a CSID and secret and runs against sandbox or production
  • Designed for developers wiring ZATCA Phase 2 into Saudi billing systems, and for assistants that need to create or check invoices

Tools

7 tools

Public tool metadata for what this MCP can expose to an agent.

create_invoiceCreate a signed ZATCA invoice from a JSON description.

Create a signed ZATCA invoice from a JSON description.

No parameter schema in public metadata yet.

validate_invoiceRun offline ZATCA pre-checks on an invoice XML document.

Run offline ZATCA pre-checks on an invoice XML document.

No parameter schema in public metadata yet.

decode_qrDecode a ZATCA QR payload into its tags.

Decode a ZATCA QR payload into its tags.

No parameter schema in public metadata yet.

explain_errorExplain a ZATCA rule or API error code in plain language.

Explain a ZATCA rule or API error code in plain language.

No parameter schema in public metadata yet.

compute_invoice_hashCompute the invoice hash ZATCA expects for an invoice XML.

Compute the invoice hash ZATCA expects for an invoice XML.

No parameter schema in public metadata yet.

generate_csrGenerate a ZATCA-shaped certificate signing request.

Generate a ZATCA-shaped certificate signing request.

No parameter schema in public metadata yet.

submit_invoiceSubmit a signed invoice to the Fatoora API.

Submit a signed invoice to the Fatoora API.

No parameter schema in public metadata yet.

Configuration

ZATCA_ENV

sandbox (default), simulation or production

ZATCA_PRIVATE_KEY_FILE

Path to the EGS secp256k1 private key (PEM)

ZATCA_CERTIFICATEsecret

CSID certificate or binarySecurityToken from ZATCA

ZATCA_CSID_SECRETsecret

CSID secret, needed to submit invoices

ZATCA_SELLER_FILE

Path to seller details JSON

Readme

zatca-toolkit

CI npm license: MIT

Generate, sign, validate and submit Saudi ZATCA (Fatoora) Phase 2 e-invoices in TypeScript, plus an MCP server so AI assistants can do it too.

Try it in your browser → Build, sign, validate and decode invoices client-side; nothing is uploaded.

Pure TypeScript: no OpenSSL, no Java, no temp files. Runs in Node, browsers and edge workers. MIT licensed.

ZATCA's Wave 25 brings every VAT-registered business with revenue above SAR 187,500 into Phase 2 integration by 1 February 2027. This library is for the developers wiring that up.

Why another ZATCA library?

Because ZATCA's byte-level rules are unforgiving, and most open-source implementations get some of them wrong. This one is verified, not hoped:


View the full README on GitHub

Details

Repository
github.com/salmankhan957/zatca-toolkit
Website
salmankhan957.github.io/zatca-toolkit
Categories
Finance & Trading, Business, Legal & HR, Developer Tools
Package
zatca-toolkit-mcp
Transport
STDIO
Auth
Required
Registry
MCP registry, active

Similar to ZATCA e-invoicing (Saudi Fatoora)

More Finance & Trading