Back to Discover

mcp-einvoicing-be

connector

cmendezs

Belgian e-invoicing MCP server: Peppol BIS 3.0, UBL 2.1, EU PINT v1.0.1, Mercurius.

View on GitHub
0 starsSynced Aug 17, 2026

Install to Claude Code

/plugin marketplace add cmendezs/mcp-einvoicing-be

README

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, 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

VariableDescriptionDefault
BCE_API_KEYAPI key for the Belgian BCE/KBO enterprise database—
PEPPOL_ENVPeppol environment: production or testproduction
PEPPOL_SML_URLOverride the SML lookup URL(auto)
LOG_LEVELLogging level: DEBUG, INFO, WARNING, ERRORINFO

Available Tools

validate_invoice_be

Validates a UBL 2.1 XML invoice. The peppol-bis-3/pint-eu profiles report an explicit "unavailable" result until a real compiled Peppol BIS 3.0 Schematron artifact is available (no package-local approximation is used — see CHANGELOG.md v0.7.0). The mercurius profile runs the Mercurius-specific overlay (endpoint scheme, PO reference) but does not check base EN 16931/Peppol BIS 3.0 compliance.

ParameterTypeRequiredDescription
xmlstringyesRaw UBL 2.1 XML content
profilestringnopeppol-bis-3 (default) or mercurius

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


generate_invoice_be

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

ParameterTypeRequiredDescription
invoice_dataobjectyesInvoice fields (see InvoiceInput schema below)
profilestringnopeppol-bis-3 (default)

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": "BE0428759497", "address": {...} },
  "customer": { "name": "...", "vat_number": "BE0403170701", "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.

ParameterTypeRequiredDescription
dataobjectyesSource invoice data (same shape as InvoiceInput)

lookup_vat_be

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

ParameterTypeRequiredDescription
vat_numberstringyesBelgian VAT/enterprise number, e.g. BE0428759497 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.

ParameterTypeRequiredDescription
identifierstringyesPeppol participant ID (e.g. 0088:BE0428759497) or plain Belgian VAT number

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


parse_ubl_invoice_be

Parses a UBL 2.1 XML invoice (Peppol BIS 3.0) into a structured dict. Satisfies the mandatory reception capability required by Art. 13quater of Royal Decree no. 1.

ParameterTypeRequiredDescription
xml_contentstringyesRaw UBL 2.1 XML invoice content

Returns {"success": true, "invoice": {...}, "warnings": []} on success, or {"success": false, "error": "..."} on parse failure.


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.


B2G via Mercurius

Mercurius is the Belgian federal public-sector e-invoicing platform. It operates as a Peppol network receiver, not a separate API. B2G invoices are submitted through the standard Peppol network using the authority's participant ID in the 0208 scheme (KBO/BCE 10-digit enterprise number). The Access Point routes the invoice to Mercurius automatically. No Mercurius-specific submission endpoint or API key is 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
│       │   ā”œā”€ā”€ generation.py      # generate_invoice_be
│       │   ā”œā”€ā”€ transformation.py  # transform_to_ubl
│       │   ā”œā”€ā”€ parsing.py         # parse_ubl_invoice_be
│       │   └── 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 placeholder (removed in v0.4.0)
│       │   └── 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:

  • Mercurius network overlay rule validation (XPath-based) for B2G invoicing
  • BCE/KBO enterprise database integration
  • Belgian VAT number normalization (BTW/TVA format) and OGM/VCS check-digit validation
  • UBL 2.1 invoice parsing for mandatory reception (Art. 13quater)
  • 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

CountryServer
šŸŒ Globalmcp-einvoicing-core
šŸ‡§šŸ‡Ŗ Belgiummcp-einvoicing-be
šŸ‡§šŸ‡· Brazilmcp-nfe-br
šŸ‡«šŸ‡· Francemcp-facture-electronique-fr
šŸ‡©šŸ‡Ŗ Germanymcp-einvoicing-de
šŸ‡®šŸ‡¹ Italymcp-fattura-elettronica-it
šŸ‡µšŸ‡± Polandmcp-ksef-pl
šŸ‡ŖšŸ‡ø Spainmcp-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.

Rendered live from cmendezs/mcp-einvoicing-be's GitHub README — not stored, always reflects the source repo.

1 Install Method

NameDescriptionCategorySource
pypi packageInstall via pypi (stdio transport)mcp-servermcp-einvoicing-be

0 Comments

Login required
Log in to post a comment or update on this repo.

No comments yet — be the first to share an update.