Skip to main content

MCP server for Belgian electronic invoicing (Peppol BIS 3.0, UBL 2.1, PINT-BE, Mercurius)

Project description

mcp-einvoicing-be ๐Ÿ‡ง๐Ÿ‡ช

English | Francais | Nederlands

PyPI version Python License mcp-einvoicing-be MCP server


Introduction

mcp-einvoicing-be is an MCP (Model Context Protocol) server that exposes tools for Belgian electronic invoicing. It covers the full Belgian e-invoicing ecosystem: Peppol BIS Billing 3.0, UBL 2.1/2.3, the PINT-BE extension (National Bank of Belgium), and the Mercurius network for public-sector invoicing. The server is part of the mcp-einvoicing-* family of country-specific servers, all built on top of mcp-einvoicing-core, which provides the shared validation engine, UBL abstractions, and Peppol network utilities.


Installation

Requirements

Using uv (recommended)

uv add mcp-einvoicing-be

Using pip

pip install mcp-einvoicing-be

From source

git clone https://github.com/cmendezs/mcp-einvoicing-be.git
cd mcp-einvoicing-be
uv sync --all-extras

Configuration

Add the server to your MCP client configuration. For Claude Desktop, edit claude_desktop_config.json:

{
  "mcpServers": {
    "einvoicing-be": {
      "command": "uvx",
      "args": ["mcp-einvoicing-be"]
    }
  }
}

For a local development install:

{
  "mcpServers": {
    "einvoicing-be": {
      "command": "uv",
      "args": ["run", "mcp-einvoicing-be"],
      "cwd": "/path/to/mcp-einvoicing-be"
    }
  }
}

Environment variables

Variable Description Default
BCE_API_KEY API key for the Belgian BCE/KBO enterprise database โ€”
PEPPOL_ENV Peppol environment: production or test production
PEPPOL_SML_URL Override the SML lookup URL (auto)
LOG_LEVEL Logging level: DEBUG, INFO, WARNING, ERROR INFO

Available Tools

validate_invoice_be

Validates a UBL 2.1 XML invoice against Belgian business rules (EN 16931 + PINT-BE or Peppol BIS 3.0 + Mercurius overlay).

Parameter Type Required Description
xml string yes Raw UBL 2.1 XML content
profile string no peppol-bis-3 (default), pint-be, or mercurius

Returns a ValidationResult with valid, errors, and warnings (each carrying the failed rule ID and a human-readable message).


validate_pint_be

Validates an invoice against the PINT-BE-specific business rules published by the National Bank of Belgium (NBB). Wraps the PINT-BE Schematron rules on top of the EN 16931 base.

Parameter Type Required Description
xml string yes Raw UBL 2.1 XML content

generate_invoice_be

Generates a valid UBL 2.1 Belgian e-invoice XML document from structured data.

Parameter Type Required Description
invoice_data object yes Invoice fields (see InvoiceInput schema below)
profile string no peppol-bis-3 (default) or pint-be

The InvoiceInput object supports:

{
  "invoice_number": "INV-2024-001",
  "issue_date": "2024-01-15",
  "due_date": "2024-02-14",
  "currency_code": "EUR",
  "supplier": { "name": "...", "vat_number": "BE0123456789", "address": {...} },
  "customer": { "name": "...", "vat_number": "BE0987654321", "address": {...} },
  "lines": [{ "description": "...", "quantity": 1, "unit_price": 100.00, "vat_rate": 21.0 }]
}

Returns a UBL 2.1 XML string.


transform_to_ubl

Converts a structured JSON invoice payload to UBL 2.1 XML without full validation. Useful as a first step before validation.

Parameter Type Required Description
data object yes Source invoice data (same shape as InvoiceInput)

lookup_vat_be

Looks up a Belgian enterprise number (VAT number) against the BCE/KBO public database.

Parameter Type Required Description
vat_number string yes Belgian VAT/enterprise number, e.g. BE0123456789 or 0123456789

Returns enterprise name, registered address, legal status, and NACE activity codes.


check_peppol_participant_be

Checks whether a Belgian company is registered as a Peppol participant by querying the SMP/SML network.

Parameter Type Required Description
identifier string yes Peppol participant ID (e.g. 0088:BE0123456789) or plain Belgian VAT number

Returns registration status, supported document type identifiers, and the SMP access point endpoint URL.


get_invoice_types_be

Returns the list of supported Belgian e-invoice document types (invoice, credit note, debit note) with their UBL customizationID and profileID values for each profile.

No input parameters required.


Architecture

mcp-einvoicing-be/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ mcp_einvoicing_be/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ server.py              # MCP server entry point & tool registration
โ”‚       โ”œโ”€โ”€ tools/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ validation.py      # validate_invoice_be, validate_pint_be
โ”‚       โ”‚   โ”œโ”€โ”€ generation.py      # generate_invoice_be
โ”‚       โ”‚   โ”œโ”€โ”€ transformation.py  # transform_to_ubl
โ”‚       โ”‚   โ””โ”€โ”€ lookup.py          # lookup_vat_be, check_peppol_participant_be, get_invoice_types_be
โ”‚       โ”œโ”€โ”€ models/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ invoice.py         # InvoiceInput, InvoiceLine, ValidationResult
โ”‚       โ”‚   โ””โ”€โ”€ party.py           # Supplier, Customer, Address
โ”‚       โ”œโ”€โ”€ standards/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ peppol_bis_3.py    # Peppol BIS Billing 3.0 rules & customization IDs
โ”‚       โ”‚   โ”œโ”€โ”€ ubl.py             # UBL 2.1 namespace constants & XML helpers
โ”‚       โ”‚   โ”œโ”€โ”€ pint_be.py         # PINT-BE (NBB) Schematron rules
โ”‚       โ”‚   โ””โ”€โ”€ mercurius.py       # Mercurius network config & overlay rules
โ”‚       โ””โ”€โ”€ utils/
โ”‚           โ”œโ”€โ”€ __init__.py
โ”‚           โ””โ”€โ”€ helpers.py         # VAT number normalization, date formatting, etc.
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ conftest.py
โ”‚   โ”œโ”€โ”€ test_tools/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ test_validation.py
โ”‚   โ”‚   โ”œโ”€โ”€ test_generation.py
โ”‚   โ”‚   โ””โ”€โ”€ test_transformation.py
โ”‚   โ””โ”€โ”€ fixtures/
โ”‚       โ”œโ”€โ”€ invoice_valid_peppol.xml
โ”‚       โ”œโ”€โ”€ invoice_valid_pint_be.xml
โ”‚       โ””โ”€โ”€ invoice_invalid.xml
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ”œโ”€โ”€ ci.yml
โ”‚       โ””โ”€โ”€ publish.yml
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ CONTRIBUTING.md
โ””โ”€โ”€ LICENSE

Relationship to mcp-einvoicing-core

mcp-einvoicing-core provides:

  • Shared UBL 2.1/2.3 XML parsing and serialization utilities
  • EN 16931 base validation rules (syntax + semantic)
  • Peppol network client (SMP lookup, SML resolution)
  • Common Pydantic base models (BaseInvoice, BaseParty, BaseValidationResult)

mcp-einvoicing-be adds Belgium-specific logic on top:

  • PINT-BE Schematron rules (NBB publication)
  • Mercurius network endpoint configuration and overlay rules
  • BCE/KBO enterprise database integration
  • Belgian VAT number normalization (BTW/TVA format)
  • customizationID and profileID values specific to the Belgian Peppol corner

Contributing

Contributions are welcome. Please open an issue to discuss significant changes before submitting a pull request.

git clone https://github.com/cmendezs/mcp-einvoicing-be.git
cd mcp-einvoicing-be
uv sync --all-extras
uv run pytest
uv run ruff check src tests
uv run mypy src

All pull requests must:

  • Pass the full test suite (pytest)
  • Pass linting (ruff check)
  • Pass type checking (mypy)
  • Include or update tests for any changed behaviour
  • Reference the relevant rule ID(s) when fixing a validation issue

See CONTRIBUTING.md for full guidelines.


Other e-invoicing MCP servers

Country Server
๐ŸŒ Global mcp-einvoicing-core
๐Ÿ‡ง๐Ÿ‡ช Belgium mcp-einvoicing-be
๐Ÿ‡ง๐Ÿ‡ท Brazil mcp-nfe-br
๐Ÿ‡ซ๐Ÿ‡ท France mcp-facture-electronique-fr
๐Ÿ‡ฉ๐Ÿ‡ช Germany mcp-einvoicing-de
๐Ÿ‡ฎ๐Ÿ‡น Italy mcp-fattura-elettronica-it
๐Ÿ‡ต๐Ÿ‡ฑ Poland mcp-ksef-pl
๐Ÿ‡ช๐Ÿ‡ธ Spain mcp-facturacion-electronica-es

License

This project is licensed under the Apache 2.0 โ€” see LICENSE for details.


Changelog

See CHANGELOG.md for a full list of changes by version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_einvoicing_be-0.3.0.tar.gz (157.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_einvoicing_be-0.3.0-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

Details for the file mcp_einvoicing_be-0.3.0.tar.gz.

File metadata

  • Download URL: mcp_einvoicing_be-0.3.0.tar.gz
  • Upload date:
  • Size: 157.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcp_einvoicing_be-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cddb5bca3e4cd4eef5c3d243efe37620342b9089dee576d9090ddc2b54518fcb
MD5 6ba017a5c45f9057189a78849a27fb42
BLAKE2b-256 7a084414f6a2ebc452408770ea689a9e42fb2b0ff8a1339b74412480d9763143

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_einvoicing_be-0.3.0.tar.gz:

Publisher: publish.yml on cmendezs/mcp-einvoicing-be

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_einvoicing_be-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_einvoicing_be-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d89ba5954b61bcce63694465287e50bd514663a4d48116b06cf9fc0448eb4ae
MD5 b4bbebabb85ae0419d9b907596f8af5f
BLAKE2b-256 a70f24a04ff754299ae7f9e1ebe05849424a387ea2876974b9be4e61049fd6c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_einvoicing_be-0.3.0-py3-none-any.whl:

Publisher: publish.yml on cmendezs/mcp-einvoicing-be

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page