mcp-einvoicing-core
Base library for building MCP e-invoicing servers: abstract base classes, shared Pydantic models, XML utilities, and OAuth2-capable async HTTP client.
README
mcp-einvoicing-core
<!-- mcp-name: io.github.cmendezs/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 | Status | Standard | Transport | Inherits | Overrides | Known gaps |
|---|---|---|---|---|---|---|
| 🇫🇷 FR | ✅ Done | XP Z12-013 | Hybrid / PPF hub | BaseEInvoicingClient, BaseLifecycleManager |
submit_lifecycle_status, healthcheck |
None |
| 🇮🇹 IT | ✅ Done | FatturaPA v1.6.1 | Direct / SDI | BaseDocumentGenerator, BaseDocumentValidator, BaseDocumentParser, BasePartyValidator |
all abstract methods | to_invoice_document() not yet implemented |
| 🇧🇪 BE | ✅ Done | Peppol BIS 3.0 | AS4 / Peppol | all base classes | generate() → UBL 2.1, validate() → Schematron EN16931 |
None |
| 🇵🇱 PL | 🔄 In progress | KSeF FA(2) | Direct API | BaseDocumentGenerator, BaseDocumentValidator, BaseLifecycleManager |
KSeF session auth flow | MTLS auth mode not yet implemented |
| 🇩🇪 DE | 🔄 In progress | ZUGFeRD / XRechnung | AS4 / Peppol | all base classes | generate() returns PDF bytes (base64) |
generate() return type: str vs bytes ambiguity |
| 🇪🇸 ES | 🔄 In progress | FACeB2B / FacturaE | Direct API | all base classes | mTLS auth | MTLS auth mode not yet implemented |
| 🇷🇴 RO | 📋 Backlog | RO-UBL (EN 16931) | Direct API / clearance | BaseDocumentGenerator, BaseLifecycleManager |
ANAF clearance flow | BaseSchematronValidator variant needed |
| 🇬🇷 GR | 📋 Backlog | myDATA XML | Direct API / reporting | BaseEInvoicingClient, BaseLifecycleManager |
myDATA auth + reporting flow | myDATA API client not yet designed |
| 🇳🇱🇸🇪🇩🇰🇳🇴 Nordics/NL | 📋 Backlog | Peppol BIS 3.0 / UBL | AS4 / Peppol | all base classes | generate() → UBL 2.1, validate() → Schematron |
Reuses BE AS4 transport layer |
| 🇵🇹 PT | 📋 Backlog | CIUS-PT + QR Code | Signature / direct | BaseDocumentGenerator, BaseDocumentValidator |
Qualified signature + QR injection | Qualified signature integration not designed |
Architectural notes
Transport interface
As the adapter count grows, a TransportInterface abstraction in core will prevent duplication across countries that share the same transport layer:
| Transport | Countries |
|---|---|
| Direct API (clearance / reporting) | FR, RO, GR, HU |
| AS4 / Peppol network | BE, DE, Nordics/NL |
| Hybrid / hub | FR (PPF/PDP dual path) |
Germany: 80% reuse from FR
Germany's mandate (active since Jan 2025 for B2B receiving) heavily favors ZUGFeRD/Factur-X — the same PDF-embedded XML model as the French Factur-X profile. The mcp-facture-electronique-fr XML generation and validation logic can be reused with minimal changes, making DE the lowest-effort next adapter after BE.
ViDA / DRR (2030)
By July 2030, all national systems must align with the EU Digital Reporting Requirement for cross-border transactions. Using EN 16931 as the internal InvoiceDocument data model in this core package already future-proofs the project: country adapters translate EN 16931 → local format, not the other way around.
License
Apache 2.0 — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。