MCP server for Belgian electronic invoicing (Peppol BIS 3.0, UBL 2.1, PINT-EU, Mercurius)
Project description
mcp-einvoicing-be ๐ง๐ช
English | Francais | Nederlands
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
- Python โฅ 3.11
mcp-einvoicing-core(installed automatically as a dependency)
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 + 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) 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
invoice_data |
object |
yes | Invoice fields (see InvoiceInput schema below) |
profile |
string |
no | peppol-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.
| 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. 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
identifier |
string |
yes | Peppol 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
xml_content |
string |
yes | Raw 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:
- Peppol BIS 3.0 business rule validation (XPath-based)
- Mercurius network overlay rules 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)
customizationIDandprofileIDvalues 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_einvoicing_be-0.5.0.tar.gz.
File metadata
- Download URL: mcp_einvoicing_be-0.5.0.tar.gz
- Upload date:
- Size: 165.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a5221d07e869f9caa20f35ddfacf71c22437168c0ebb6e622a0d0f00d195e80
|
|
| MD5 |
d455d5ce5286fba0d415d53493c24de1
|
|
| BLAKE2b-256 |
d5523eae668d72a4e580db6a0fe80362e407550645dab993e253dc626b1d2721
|
Provenance
The following attestation bundles were made for mcp_einvoicing_be-0.5.0.tar.gz:
Publisher:
publish.yml on cmendezs/mcp-einvoicing-be
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_einvoicing_be-0.5.0.tar.gz -
Subject digest:
6a5221d07e869f9caa20f35ddfacf71c22437168c0ebb6e622a0d0f00d195e80 - Sigstore transparency entry: 2173028533
- Sigstore integration time:
-
Permalink:
cmendezs/mcp-einvoicing-be@21c317bd6f8c4b1b8a521d57295177994af8d795 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/cmendezs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@21c317bd6f8c4b1b8a521d57295177994af8d795 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_einvoicing_be-0.5.0-py3-none-any.whl.
File metadata
- Download URL: mcp_einvoicing_be-0.5.0-py3-none-any.whl
- Upload date:
- Size: 38.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a30556a28c3edff4a1ce87feaa7454b9cf89e74f05d4259607cad6c926e96a0
|
|
| MD5 |
403ee691b0c4b36ed80151956274630e
|
|
| BLAKE2b-256 |
fe0fd5f59fa9112d57397e0890eebf7d28b0db1820bd5826eba4f46872e0f539
|
Provenance
The following attestation bundles were made for mcp_einvoicing_be-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on cmendezs/mcp-einvoicing-be
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_einvoicing_be-0.5.0-py3-none-any.whl -
Subject digest:
9a30556a28c3edff4a1ce87feaa7454b9cf89e74f05d4259607cad6c926e96a0 - Sigstore transparency entry: 2173028546
- Sigstore integration time:
-
Permalink:
cmendezs/mcp-einvoicing-be@21c317bd6f8c4b1b8a521d57295177994af8d795 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/cmendezs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@21c317bd6f8c4b1b8a521d57295177994af8d795 -
Trigger Event:
push
-
Statement type: