mcp-fattura-elettronica-it
This server is an MCP implementation for Italian electronic invoicing (FatturaPA XML v1.6.1), offering 21 tools to manage the full lifecycle of electronic invoices — generation, validation, parsing, and analysis — conforming to SDI/Agenzia delle Entrate specifications, with no external API calls required.
Transmission & Header
Build DatiTrasmissione blocks with SDI codes, PEC addresses, and
ProgressivoInvioidentifiersValidate seller (
CedentePrestatore) and buyer (CessionarioCommittente) blocks including VAT numbers, addresses, and fiscal regimesValidate Italian VAT numbers (Partita IVA) with 11-digit format and modulo-10 checksum
Look up and validate
CodiceDestinatario(6-char SDI code) or PEC address format
Invoice Body
Build
DatiGeneraliwith document type (TD01–TD28), date, number, and currencyAdd line items (
DettaglioLinee) with quantity, unit price, VAT rate, and exemption codesAutomatically compute VAT summaries (
DatiRiepilogo) grouped by VAT rate andNaturacodes (N1–N7)Build payment blocks with conditions (TP01–TP03), methods (MP01–MP23), and IBAN
Attach base64-encoded documents (PDF, XML, ZIP, etc.)
Compute withholding tax (
ritenuta d'acconto) with RT01–RT06 type codes
XML Generation & Validation
Assemble all blocks into a complete, standards-compliant FatturaPA XML document
Validate XML against the official XSD schema v1.6.1
Parse existing FatturaPA XML into structured JSON
Export parsed data to clean, indented JSON
Generate the official SDI filename (
IT{PartitaIVA}_{ProgressivoInvio}.xml)
Reference Codes
Retrieve all official code tables:
RegimeFiscale(RF01–RF19),TipoDocumento(TD01–TD28), andNatura(N1–N7) with descriptions and legal references
mcp-fattura-elettronica-it 🇮🇹
Python MCP server for Italian electronic invoicing in FatturaPA XML format (SDI / Agenzia delle Entrate standard, version 1.6.1). It allows AI agents (Claude, IDE) to generate, validate, and analyze B2B, B2G, and cross-border electronic invoices directly compliant with the technical specifications of the Sistema di Interscambio (SDI).
English summary
This is a Model Context Protocol (MCP) server for Italian electronic invoicing. It exposes 21 tools covering the full lifecycle of a FatturaPA XML document: transmission header construction, seller/buyer validation, document type codes (TD01–TD28), line items, VAT summary computation, payment terms, XSD validation against the official Agenzia delle Entrate schema (v1.6.1), XML generation, parsing, JSON export, SDI filename generation, and withholding tax (ritenuta d'acconto) calculation. The server requires no external API calls — all logic runs locally. Licensed under Apache 2.0.
Related MCP server: mcp-einvoicing-be
🚀 Installation
Via PyPI (recommended)
pip install mcp-fattura-elettronica-itmcp-einvoicing-core is installed automatically as a dependency.
lxml is also required and included — no extra steps needed.
Without prior installation using uvx:
uvx mcp-fattura-elettronica-itFrom source
git clone https://github.com/cmendezs/mcp-fattura-elettronica-it.git
cd mcp-fattura-elettronica-it
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
cp .env.example .env⚙️ Configuration
The server does not require external credentials in v0.1.0. The available environment variables are:
Variable | Description | Default |
| Log level ( |
|
| Path to the FatturaPA XSD file |
|
🤖 Claude Desktop Integration
Add to the claude_desktop_config.json file:
{
"mcpServers": {
"fattura-elettronica-it": {
"command": "uvx",
"args": ["mcp-fattura-elettronica-it"]
}
}
}⌨️ Cursor Integration
Configuration file (~/.cursor/mcp.json or .cursor/mcp.json in the project folder):
{
"mcpServers": {
"fattura-elettronica-it": {
"command": "uvx",
"args": ["mcp-fattura-elettronica-it"]
}
}
}🪐 Kiro Integration
{
"mcpServers": {
"fattura-elettronica-it": {
"command": "uvx",
"args": ["mcp-fattura-elettronica-it"],
"disabled": false,
"autoApprove": []
}
}
}🧰 Available MCP Tools
Header — FatturaElettronicaHeader (7 tools)
Tool | Description |
| Build DatiTrasmissione block: ProgressivoInvio, CodiceDestinatario, PECDestinatario |
| Validate seller block: IdFiscaleIVA, Anagrafica, Sede, RegimeFiscale codes |
| Validate buyer block: IdFiscaleIVA or CodiceFiscale, Sede |
| Return all valid RegimeFiscale codes with descriptions (RF01–RF19) |
| Validate Italian VAT number (Partita IVA) format and checksum (11 digits) |
| Generate a unique ProgressivoInvio identifier (max 10 alphanumeric chars) |
| Return info about a CodiceDestinatario (6-char SDI code) or PEC address |
Body — FatturaElettronicaBody (7 tools)
Tool | Description |
| Build DatiGenerali block: TipoDocumento, Divisa, Data, Numero, Causale |
| Return all TD01–TD28 codes with descriptions and use cases (incl. cross-border) |
| Add a DettaglioLinee entry: NumeroLinea, Descrizione, Quantita, PrezzoUnitario |
| Compute DatiRiepilogo: imponibile, imposta, AliquotaIVA from line items |
| Return all Natura codes (N1–N7 and sub-codes) for VAT exemption with legal references |
| Build DatiPagamento: CondizioniPagamento (TP01/02/03), ModalitaPagamento (MP01–MP23) |
| Attach a base64-encoded document to the Allegati block with name and format |
Global — generation and validation (7 tools)
Tool | Description |
| Generate a complete FatturaPA XML file from structured input data |
| Validate a FatturaPA XML string against the official XSD schema v1.6.1 |
| Parse an existing FatturaPA XML string and return a structured JSON dict |
| Export a parsed FatturaPA structure to clean JSON format |
| Validate Partita IVA format and Luhn-like checksum (11-digit Italian VAT) |
| Generate the official SDI filename: IT{PartitaIVA}_{ProgressivoInvio}.xml |
| Check and compute ritenuta d'acconto (withholding tax) for professional invoices |
Usage examples
Example 1 — Generate a complete B2B invoice
1. validate_partita_iva_format("01234567897")
→ { "valid": true }
2. generate_progressivo_invio(sequence=1)
→ { "progressivo_invio": "00001" }
3. build_transmission_header(id_paese="IT", id_codice="01234567897",
progressivo_invio="00001", formato_trasmissione="FPR12",
codice_destinatario="ABC123")
4. validate_cedente_prestatore(id_paese="IT", id_codice="01234567897",
denominazione="ACME Srl", regime_fiscale="RF01",
indirizzo="Via Roma 1", cap="00100", comune="Roma", nazione="IT")
5. validate_cessionario(denominazione="Buyer Srl",
id_paese="IT", id_codice="98765432109",
indirizzo="Via Verdi 2", cap="20100", comune="Milano")
6. build_dati_generali(tipo_documento="TD01", data="2026-01-15",
numero="2026/001", divisa="EUR")
7. add_linea_dettaglio(numero_linea=1, descrizione="Consulenza informatica",
quantita=8, unita_misura="ORE", prezzo_unitario=100.0,
prezzo_totale=800.0, aliquota_iva=22.0)
8. compute_totali(linee=[{"prezzo_totale": 800.0, "aliquota_iva": 22.0}])
→ { "totale_fattura": "976.00" }
9. build_dati_pagamento(condizioni_pagamento="TP02", modalita_pagamento="MP05",
importo_pagamento=976.0, iban="IT60X0542811101000000123456")
10. generate_fattura_xml(...tutti i blocchi precedenti...)
→ { "xml": "<?xml ...", "filename": "IT01234567897_00001.xml" }
11. validate_fattura_xsd(xml_string=...)
→ { "valid": true }Example 2 — Professional invoice with withholding tax (ritenuta d'acconto)
check_ritenuta_acconto(imponibile=1000.0, tipo_ritenuta="RT02",
causale_pagamento="A")
→ {
"DatiRitenuta": {
"TipoRitenuta": "RT02",
"ImportoRitenuta": "200.00",
"AliquotaRitenuta": "20.00",
"CausalePagamento": "A"
},
"importo_ritenuta": "200.00"
}Example 3 — Consult VAT exemption codes
get_natura_codes()
→ codes: [
{ "code": "N3.1", "description": "Non imponibili — esportazioni",
"legal_ref": "Art. 8 DPR 633/72" },
{ "code": "N6.1", "description": "Inversione contabile — rottami",
"legal_ref": "Art. 74 c. 7-8 DPR 633/72" },
...
]Architecture
mcp-fattura-elettronica-it (this package — standalone MCP server)
├── ItalyPartyValidator(BasePartyValidator) ← Partita IVA modulo-10
├── FatturaGenerator(BaseDocumentGenerator) ← FatturaPA XML v1.6.1
├── FatturaValidator(BaseDocumentValidator) ← lxml XSD v1.6.1
└── FatturaParser(BaseDocumentParser) ← lxml xpath
↑ extends
mcp-einvoicing-core (shared foundation, installed as dependency)
├── BaseDocumentGenerator / Validator / Parser / PartyValidator
├── InvoiceDocument, InvoiceParty, InvoiceLineItem … (Pydantic)
├── xml_utils, logging_utils, exceptions
└── EInvoicingMCPServer (optional multi-country aggregator)📚 Reference Standards
Resource | Link |
FatturaPA Specifications | |
Official XSD v1.6.1 | |
XML Namespace |
|
SDI — Sistema di Interscambio | |
Withholding tax | Art. 25 DPR 600/73 — Modello 770 |
🧪 Tests
# Installare le dipendenze di sviluppo
pip install -e ".[dev]"
# Eseguire tutti i test
pytest tests/ -v
# Eseguire solo i test di integrazione MCP
pytest tests/test_mcp_integration.py -vRoadmap
Version | Features |
v0.1.0 (current) | XML generation, XSD validation, parsing, 21 MCP tools, withholding tax |
v0.2 | Digital signature CAdES-BES and XAdES (smart card, HSM, P12) |
v0.3 | Direct SDI integration via SDICoop SOAP and SFTP — sending and receiving |
v0.4 | Simplified Invoice (TD07/TD08/TD09) — amounts ≤ 400 EUR |
v0.5 | Compliant archiving — integration with AgID accredited providers |
Other e-invoicing MCP servers
Country | Server |
🌍 Global | |
🇧🇪 Belgium | |
🇫🇷 France | |
🇮🇹 Italy |
📄 License
This project is distributed under the Apache 2.0 license. See the LICENSE file for full details.
Copyright 2026 cmendezs
Project maintained by cmendezs. For questions regarding the implementation of the FatturaPA standard, please open an Issue.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceModel Context Protocol (MCP) server for French Electronic Invoicing (NF XP Z12-013). Provide tools to validate, generate, and explore API specifications for PDP/OD interoperability.34Apache 2.0
- AlicenseAqualityAmaintenanceModel Context Protocol (MCP) server for Belgian Electronic Invoicing (Peppol BIS 3.0 / PINT-BE / Mercurius). Provides tools to validate, generate, and transform UBL 2.1 e-invoices, and look up BCE/KBO enterprise data and Peppol participants.50Apache 2.0
- AlicenseAqualityAmaintenanceModel Context Protocol (MCP) server for German Electronic Invoicing (ZUGFeRD 2.x / XRechnung 3.x). Provides tools to validate, generate, parse, and convert invoices compliant with EN 16931 and KoSIT.81Apache 2.0
- AlicenseAqualityBmaintenanceModel Context Protocol (MCP) server for Polish Electronic Invoicing (KSeF / FA(2)). Provides tools to validate, generate, and explore API specifications for KSeF interoperability.102Apache 2.0
Related MCP Connectors
MCP server for the PDFGate API. Generate PDFs, manage documents and handle e-signatures.
The official MCP Server from Mia-Platform to interact with Mia-Platform Console
Italy FatturaPA invoices for AI agents: build FPR12 XML, transmit to the SdI, query status.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cmendezs/mcp-fattura-elettronica-it'
If you have feedback or need assistance with the MCP directory API, please join our Discord server