# ZATCA e-invoicing (Saudi Fatoora)

> ZATCA e-invoicing (Saudi Fatoora) is an open-source MCP server for finance and payments. Create, sign, validate and submit Saudi ZATCA e-invoices from your AI assistant. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI
- **Website:** https://salmankhan957.github.io/zatca-toolkit/
- **Repository:** https://github.com/salmankhan957/zatca-toolkit/tree/HEAD/packages/mcp
- **MCP Registry name:** io.github.SalmanKhan957/zatca-toolkit
- **Categories:** finance and payments, legal and government
- **Listing updated:** 2026-11-15

## About

Saudi Arabia's ZATCA Phase 2 (Fatoora) e-invoicing has strict rules on hashes, signatures and QR tags. This server wraps the zatca-toolkit library, whose output the README says matches ZATCA's official SDK samples byte for byte and passed the live sandbox.

It builds invoices, credit notes and debit notes with exact VAT totals and keeps the ICV and PIH chain, runs an offline pre-check against common BR-KSA and EN 16931 rules with English and Arabic explanations, decodes QR payloads and explains ZATCA error codes. With credentials it can sign and submit; without them you can still validate, decode, explain and create unsigned invoices.

The default environment is sandbox, and production submission needs ZATCA_ALLOW_PRODUCTION set to 1. The project says it is not affiliated with ZATCA.

## Features

- **Invoice creation:** Invoices, credit and debit notes with exact VAT.
- **Offline validation:** Checks rules, totals, hash, signature, XAdES digests and QR.
- **QR decoding:** Flags non-BER lengths ZATCA rejects.
- **Error explanations:** Cause and fix for ZATCA codes.
- **CSR generation:** Creates a secp256k1 key and CSR.
- **Safe environments:** Sandbox default; production gated.

## Good for

- Debug an invalid-invoice-hash error
- Pre-check an invoice before submission
- Decode a QR from an invoice
- Generate a CSR for onboarding

## Install

### Claude Code (Terminal)

```sh
claude mcp add zatca-toolkit --env ZATCA_CERTIFICATE='<ZATCA_CERTIFICATE>' --env ZATCA_CSID_SECRET='<ZATCA_CSID_SECRET>' -- npx -y zatca-toolkit-mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "zatca-toolkit": {
      "command": "npx",
      "args": [
        "-y",
        "zatca-toolkit-mcp"
      ],
      "env": {
        "ZATCA_CERTIFICATE": "<ZATCA_CERTIFICATE>",
        "ZATCA_CSID_SECRET": "<ZATCA_CSID_SECRET>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "zatca-toolkit": {
      "command": "npx",
      "args": [
        "-y",
        "zatca-toolkit-mcp"
      ],
      "env": {
        "ZATCA_CERTIFICATE": "<ZATCA_CERTIFICATE>",
        "ZATCA_CSID_SECRET": "<ZATCA_CSID_SECRET>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "zatca-toolkit": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "zatca-toolkit-mcp"
      ],
      "env": {
        "ZATCA_CERTIFICATE": "<ZATCA_CERTIFICATE>",
        "ZATCA_CSID_SECRET": "<ZATCA_CSID_SECRET>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "zatca-toolkit": {
      "command": "npx",
      "args": [
        "-y",
        "zatca-toolkit-mcp"
      ],
      "env": {
        "ZATCA_CERTIFICATE": "<ZATCA_CERTIFICATE>",
        "ZATCA_CSID_SECRET": "<ZATCA_CSID_SECRET>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "zatca-toolkit": {
      "command": "npx",
      "args": [
        "-y",
        "zatca-toolkit-mcp"
      ],
      "env": {
        "ZATCA_CERTIFICATE": "<ZATCA_CERTIFICATE>",
        "ZATCA_CSID_SECRET": "<ZATCA_CSID_SECRET>"
      }
    }
  }
}
```

## Tools

- `create_invoice`: Builds and, with credentials, signs an invoice, credit note or debit note.
- `validate_invoice`: Offline pre-check of rules, totals, hash, signature and QR.
- `decode_qr`: Decodes a QR payload.
- `explain_error`: Explains a ZATCA error code.
- `compute_invoice_hash`: Computes the hash to debug invalid-invoice-hash.
- `generate_csr`: Creates a new key and ZATCA CSR.
- `submit_invoice`: Reports, clears or runs compliance checks via the Fatoora API.

## FAQ

### Is credential setup required?

No; validation, decoding and unsigned invoices work without it.

### Which environments?

Sandbox (default), simulation or production.

### Is it official?

No; it is not affiliated with or endorsed by ZATCA.

### Licence?

MIT.

### Is ZATCA e-invoicing (Saudi Fatoora) free?

Yes. ZATCA e-invoicing (Saudi Fatoora) is open source, so you can use and self-host it for free.

### How do I add ZATCA e-invoicing (Saudi Fatoora) to Claude Code?

Run this command in your terminal: claude mcp add zatca-toolkit --env ZATCA_CERTIFICATE='<ZATCA_CERTIFICATE>' --env ZATCA_CSID_SECRET='<ZATCA_CSID_SECRET>' -- npx -y zatca-toolkit-mcp

### What are the best alternatives to ZATCA e-invoicing (Saudi Fatoora)?

The closest alternatives to ZATCA e-invoicing (Saudi Fatoora) are Solana MCP by Vybe, Tapetide - Indian Stock Market MCP, Budget Tracker, NY LLC Publication (FileMyPublication) and Quantivex Research.

## Alternatives

- [Solana MCP by Vybe](https://ai-powered.com/mcp/solana-mcp-by-vybe): Solana MCP by Vybe is an MCP server for finance and payments.
- [Tapetide - Indian Stock Market MCP](https://ai-powered.com/mcp/tapetide-indian-stock-market-mcp): Tapetide - Indian Stock Market MCP is a freemium MCP server for finance and payments.
- [Budget Tracker](https://ai-powered.com/mcp/budget-tracker-2): Budget Tracker is a freemium MCP server for finance and payments.
- [NY LLC Publication (FileMyPublication)](https://ai-powered.com/mcp/ny-llc-publication-filemypublication): NY LLC Publication (FileMyPublication) is a free MCP server for legal and government.
- [Quantivex Research](https://ai-powered.com/mcp/quantivex-research): Quantivex Research is a free MCP server for finance and payments.
- [Provyan](https://ai-powered.com/mcp/provyan): Provyan is a free MCP server for finance and payments.
- [TribuJus](https://ai-powered.com/mcp/tribujus): TribuJus is an open-source MCP server for legal and government.
- [SupplyClub Catalog](https://ai-powered.com/mcp/supplyclub-catalog): SupplyClub Catalog is a free MCP server for legal and government.

---
Source: https://ai-powered.com/mcp/zatca-e-invoicing-saudi-fatoora
