Skip to main content

Base package for European electronic invoicing MCP servers

Project description

mcp-einvoicing-core

Topics: mcp mcp-server e-invoicing electronic-invoicing european-invoicing python fastmcp peppol en16931 ubl fatturapa xp-z12-013 xml base-library

Base package for European electronic invoicing MCP servers.

Provides abstract base classes, shared Pydantic models, XML utilities, and an HTTP client so country-specific packages (mcp-facture-electronique-fr, mcp-fattura-elettronica-it, …) share a common foundation without duplicating code.


What this package provides

Module Contents Used by
models.py InvoiceParty, InvoiceLineItem, VATSummary, PaymentTerms, InvoiceDocument, DocumentValidationResult IT (structured invoice generation), future BE/PL/DE/ES
base_server.py BaseDocumentGenerator, BaseDocumentValidator, BaseDocumentParser, BaseLifecycleManager, BasePartyValidator, EInvoicingMCPServer All country adapters
xml_utils.py format_amount, format_quantity, validate_date_iso, validate_iban, xml_element, xml_optional, format_error, filter_empty_values IT (extracted verbatim), future XML-based formats
http_client.py TokenCache, OAuthConfig, BaseEInvoicingClient (OAuth2 + no-auth) FR (extracted verbatim), future API-based countries
exceptions.py EInvoicingError, ValidationError, PartyValidationError, XSDValidationError, DocumentGenerationError, AuthenticationError, PlatformError All country adapters
logging_utils.py setup_logging, get_logger All country adapters

Installation

pip install mcp-einvoicing-core

This package has no country-specific dependencies. lxml (needed for XSD validation in IT and future countries) is declared by each country package individually.

Architecture

mcp-einvoicing-core           ← this package
  ├── BaseDocumentGenerator   ← abstract: generate(InvoiceDocument) → str
  ├── BaseDocumentValidator   ← abstract: validate(xml) → DocumentValidationResult
  ├── BaseDocumentParser      ← abstract: parse(xml) → dict
  ├── BaseLifecycleManager    ← abstract: submit/search/get_status (async HTTP)
  ├── BasePartyValidator      ← abstract: validate_seller/buyer/tax_id
  ├── BaseEInvoicingClient    ← concrete: async HTTP + OAuth2/no-auth/token
  ├── InvoiceDocument (Pydantic)  ← shared data model
  └── EInvoicingMCPServer     ← plugin registry wrapping FastMCP

mcp-facture-electronique-fr   ← country adapter (FR)
  ├── PAConfig(OAuthConfig)
  ├── FlowClient(BaseEInvoicingClient)      ← OAuth2, XP Z12-013 Annex A
  ├── DirectoryClient(BaseEInvoicingClient) ← OAuth2, XP Z12-013 Annex B
  └── FrLifecycleManager(BaseLifecycleManager)

mcp-fattura-elettronica-it    ← country adapter (IT)
  ├── ItalyPartyValidator(BasePartyValidator)   ← Partita IVA modulo-10
  ├── FatturaGenerator(BaseDocumentGenerator)   ← FatturaPA XML v1.6.1
  ├── FatturaValidator(BaseDocumentValidator)   ← lxml XSD v1.6.1
  └── FatturaParser(BaseDocumentParser)         ← lxml xpath

Plugin registration pattern

Country packages register their tools on a shared or standalone FastMCP instance:

# Standalone (existing server.py — no changes required)
from fastmcp import FastMCP
mcp = FastMCP(name="mcp-fattura-elettronica-it", instructions="…")
register_header_tools(mcp)
register_body_tools(mcp)
register_global_tools(mcp)

# Multi-country (optional EInvoicingMCPServer)
from mcp_einvoicing_core import EInvoicingMCPServer
server = EInvoicingMCPServer(name="mcp-einvoicing-eu", instructions="…")
server.register_plugin(register_header_tools, "it-header")
server.register_plugin(register_flow_tools, "fr-flow")
server.run()

Claude Desktop / Cursor / Kiro compatibility

Existing configurations for mcp-facture-electronique-fr and mcp-fattura-elettronica-it require no changes: tool names, signatures, environment variables, and entry points (server:main) are fully preserved.

Roadmap compatibility

Country Standard Inherits Overrides Known gaps
🇫🇷 FR (existing) XP Z12-013 BaseEInvoicingClient, BaseLifecycleManager submit_lifecycle_status, healthcheck None
🇮🇹 IT (existing) FatturaPA v1.6.1 BaseDocumentGenerator, BaseDocumentValidator, BaseDocumentParser, BasePartyValidator all abstract methods to_invoice_document() not yet implemented
🇧🇪 BE 2026 Peppol BIS 3.0 all base classes generate() → UBL 2.1, validate() → Schematron EN16931 Need BaseSchematronValidator variant
🇵🇱 PL 2026 KSeF FA(2) BaseDocumentGenerator, BaseDocumentValidator, BaseLifecycleManager KSeF session auth flow MTLS auth mode not yet implemented
🇩🇪 DE ZUGFeRD / XRechnung all base classes generate() returns PDF bytes (base64) generate() return type: str vs bytes ambiguity
🇪🇸 ES FACeB2B / FacturaE all base classes mTLS auth MTLS auth mode not yet implemented

License

Apache 2.0 — see LICENSE.

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_core-0.1.0.tar.gz (24.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_core-0.1.0-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_einvoicing_core-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_einvoicing_core-0.1.0.tar.gz
  • Upload date:
  • Size: 24.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_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 018f869451e92f5c53c19401d4b63d0148c98fd6e0da918ecb0f41d9786bfce7
MD5 a390601a1f07f4a39ea9ec585ac65975
BLAKE2b-256 ac579adb8144514776887214de867d7ac365a37856e0f0f11293b462e018dbb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_einvoicing_core-0.1.0.tar.gz:

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

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_core-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_einvoicing_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49491a2a5cc58e6f765eb35a72045d49c20c75d0f34bde557e08ab2b5b236f95
MD5 6fa952d360078288b6e5494bdcd09d6a
BLAKE2b-256 b2eb0e95a41d75927d639196efcfcfc988cc086c1a87626f4e634f405d607c19

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_einvoicing_core-0.1.0-py3-none-any.whl:

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

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