fatturapa-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@fatturapa-mcp-serverextract supplier and total from invoice.xml"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
fatturapa-mcp-server
English
The problem
Every project integrating FatturaPA reimplements the same validation, parsing and SDI error handling from scratch. The result: weeks of repeated work, hidden bugs and no standardization.
Related MCP server: eleata e-invoice MCP server
The solution
Seven AI tools installable in one line — document parsing, anomaly detection on received invoices, multi-invoice reporting, Italian and EU VAT verification via VIES, structural XML checks and offline SDI error lookup.
Status: beta. See Known limitations before relying on validation results.
Who is it for
Python developers and AI teams working on Italian electronic invoicing systems who want to integrate Claude without reimplementing FatturaPA compliance from scratch on every project.
What is this?
An MCP (Model Context Protocol) server that gives AI assistants seven ready-to-use tools for working with Italian electronic invoices (FatturaPA) and the SDI (Sistema di Interscambio) system — no plumbing required.
Tools
Tool | Input | What it does |
|
| Checks that the XML is well-formed and has the FatturaPA root structure. ⚠️ Not yet a full schema validation — see Known limitations |
|
| Extracts supplier, customer, amounts, line items and metadata from a valid FatturaPA document |
|
| Returns description, category and resolution hint for SDI error codes (offline). ⚠️ The table is being realigned with the official list — see Known limitations |
|
| Validates an Italian P.IVA (VAT number) using the official MEF checksum algorithm — no network call |
|
| Verifies any EU VAT number against the live VIES REST API; degrades gracefully when the service is down |
|
| Detects anomalies in a FatturaPA XML document: inconsistent totals, wrong VAT, future dates, invalid P.IVA, missing recipient, incomplete line items, negative amounts, missing payment info |
|
| Aggregates multiple FatturaPA XML documents into a single report with statistics, supplier/customer breakdown and anomaly summary |
Quick start
Option A — uvx (no install required)
uvx fatturapa-mcp-serverOption B — pip
pip install fatturapa-mcp-server
fatturapa-mcp-serverClaude Desktop configuration
Add the following block to your Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"fatturapa": {
"command": "uvx",
"args": ["fatturapa-mcp-server"],
"env": { "FATTURAPA_ALLOWED_ROOTS": "/path/to/your/invoices" }
}
}
}FATTURAPA_ALLOWED_ROOTS lists the only folders the server may read (: separated
on macOS/Linux, ; on Windows). Without it every file_path read is refused and
documents must be passed as xml_content. This is deliberate: the server is driven
by an AI agent reading untrusted documents.
After restarting Claude Desktop you will see seven new tools in the tool panel.
Known limitations (v0.3.2)
An audit against the official AdE schema (FatturaPA v1.2.3) with synthetic invoices found the following. They are being fixed in the next releases; until then:
validate_invoiceis structural only. The bundled XSD files are stubs: an invoice with an unknown document type (TD99), an invalid currency (EURO) or missing mandatory blocks is reported asvalid: true. Do not use it as a substitute for SDI validation.lookup_sdi_error: several codes have descriptions that differ from the official list (e.g.00001is "invalid file name"), and some codes are missing.Batches (lots): when a file contains more than one invoice, only the first one is fully analysed.
Encoding: XML declared as ISO-8859-1 / windows-1252 may be decoded incorrectly.
.p7msigned files are not supported yet: extract the XML first.Report: credit notes (TD04) are added instead of subtracted; totals across different currencies are summed.
Amounts are returned as floats.
What is solid today: coherence checks (totals, VAT, P.IVA checksum, dates), fail-closed file access, XXE protection, VIES degradation when the service is down.
Changelog / Release history
Wave | Tools / Features | Release |
Wave 1 |
| v0.1.0 |
Wave 2 | PyPI publication, CI/CD, security audit, full coverage | v0.1.0 |
Wave 3 | Context propagation, structured logging, progress reporting, roots-based secure file access | v0.1.x |
Wave 4 |
| v0.2.0 |
v0.3.2 stats: 7 tools · 181 tests · 95% coverage, including server startup
What it demonstrates
MCP server with strict mypy typing, tested on Python 3.11, 3.12 and 3.13
Automated security audit — bandit + pip-audit
Guaranteed 80% minimum coverage (currently 95% across 181 tests)
Fail-closed file-system access: reads are refused unless explicitly configured
Published on PyPI — installable anywhere in one line
Bilingual IT/EN — built for Italian and international market
Auditable by design
Every feature in this repository was built through a governed multi-agent pipeline — planner, executor and reviewer as separate roles, each with declared authority and hard quality gates between them.
The coord/ directory is the audit trail. One handoff per task, recording the
files changed and why, the commands run with their PASS/FAIL output, the
assumptions made and how they were verified, and the risks left open. Fifteen
handoffs cover the four development waves listed above.
For regulated work — e-invoicing, tax data, compliance — being able to show how a system was built matters as much as showing that it works. The methodology is documented separately in agentic-dev-pipeline.
Project status
Beta. Tested with synthetic FatturaPA documents checked against the official schema; not yet used in production. See Known limitations. Part of a broader ecosystem: fatturapa-mcp-server → sdi-ops-monitor
Development setup
git clone https://github.com/MaurizioLisanti/fatturapa-mcp-server
cd fatturapa-mcp-server
# Install the package and all dev dependencies
make install # pip install -e ".[dev]"
# Run the full quality gate (lint + typecheck + tests + security)
make checkIndividual targets:
make test # pytest with coverage (fail-under 80 %)
make lint # ruff check + ruff format --check
make typecheck # mypy --strict
make security # bandit -ll + pip-audit
make format # auto-fix formatting and importsMCP Inspector
MCP Inspector lets you call tools interactively from a local web UI — useful during development:
npx @modelcontextprotocol/inspector uvx fatturapa-mcp-server
# Open http://localhost:5173 in your browserRelated projects
sdi-ops-monitor — AWS-based pipeline that receives, stores and routes FatturaPA files from/to SDI. Use together with this MCP server to give Claude end-to-end visibility into your Italian e-invoicing operations.
agentic-dev-pipeline — The governed multi-agent development pipeline this project was built with. The handoffs in
coord/are its output.
Italiano
Il problema
Ogni progetto che integra FatturaPA reimplementa da zero la stessa logica di validazione, parsing e gestione errori SDI. Il risultato: settimane di lavoro ripetuto, bug nascosti e nessuna standardizzazione.
La soluzione
Sette tool AI installabili in una riga — parsing del documento, rilevamento anomalie sulle fatture ricevute, report multi-fattura, verifica P.IVA italiana ed europea via VIES, controlli strutturali dell'XML e lookup errori SDI offline.
Stato: beta. Leggere i Limiti noti prima di fare affidamento sui risultati della validazione.
Per chi è
Developer Python e team AI che lavorano su sistemi di fatturazione elettronica italiana e vogliono integrare Claude senza reimplementare la compliance FatturaPA da zero ad ogni progetto.
Cos'è questo progetto?
Un server MCP (Model Context Protocol) che fornisce agli assistenti AI sette strumenti pronti all'uso per lavorare con le fatture elettroniche italiane (FatturaPA) e il Sistema di Interscambio (SDI).
Strumenti disponibili
Strumento | Input | Cosa fa |
|
| Controlla che l'XML sia ben formato e abbia la struttura radice FatturaPA. ⚠️ Non è ancora una validazione completa contro lo schema — vedi Limiti noti |
|
| Estrae fornitore, cliente, importi, righe dettaglio e metadati da un documento FatturaPA valido |
|
| Restituisce descrizione, categoria e suggerimento di risoluzione per i codici errore SDI (offline). ⚠️ La tabella è in fase di riallineamento con l'elenco ufficiale — vedi Limiti noti |
|
| Valida una P.IVA italiana tramite l'algoritmo di checksum ufficiale MEF — nessuna chiamata di rete |
|
| Verifica qualsiasi partita IVA UE contro l'API REST VIES in tempo reale; risponde in modo degradato se il servizio è irraggiungibile |
|
| Rileva anomalie in un documento FatturaPA XML: totale incoerente, IVA errata, data futura, P.IVA invalida, destinatario mancante, righe incomplete, importo negativo, pagamento mancante |
|
| Aggrega più documenti FatturaPA XML in un unico report con statistiche, riepilogo fornitori/clienti e analisi delle anomalie |
Avvio rapido
Opzione A — uvx (nessuna installazione necessaria)
uvx fatturapa-mcp-serverOpzione B — pip
pip install fatturapa-mcp-server
fatturapa-mcp-serverConfigurazione Claude Desktop
Aggiungere il seguente blocco al file di configurazione di Claude Desktop:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"fatturapa": {
"command": "uvx",
"args": ["fatturapa-mcp-server"],
"env": { "FATTURAPA_ALLOWED_ROOTS": "C:\\percorso\\delle\\fatture" }
}
}
}FATTURAPA_ALLOWED_ROOTS indica le sole cartelle che il server può leggere (separate
da ; su Windows, da : su macOS/Linux). Senza questa variabile ogni lettura da
file_path viene rifiutata e le fatture vanno passate come xml_content. È una
scelta voluta: il server è pilotato da un agente AI che legge documenti non fidati.
Dopo il riavvio di Claude Desktop, i sette strumenti compariranno nel pannello degli strumenti.
Limiti noti (v0.3.2)
Un audit contro lo schema ufficiale AdE (FatturaPA v1.2.3) con fatture sintetiche ha evidenziato i punti seguenti, in correzione nelle prossime release:
validate_invoiceè solo strutturale. Gli XSD inclusi sono stub: una fattura con tipo documento inesistente (TD99), divisa non valida (EURO) o blocchi obbligatori mancanti risultavalid: true. Non sostituisce la validazione dello SDI.lookup_sdi_error: alcune descrizioni non corrispondono all'elenco ufficiale (es.00001è "nome file non valido") e alcuni codici mancano.Lotti: se un file contiene più fatture, solo la prima viene analizzata del tutto.
Encoding: XML dichiarati ISO-8859-1 / windows-1252 possono essere decodificati male.
.p7m: i file firmati non sono ancora supportati; estrarre prima l'XML.Report: le note di credito (TD04) vengono sommate invece che sottratte; totali in valute diverse vengono sommati.
Gli importi sono restituiti come float.
Già solido oggi: controlli di coerenza (totali, IVA, checksum P.IVA, date), accesso ai file fail-closed, protezione XXE, gestione di VIES quando il servizio non risponde.
Changelog / Storico release
Wave | Tool / Funzionalità | Release |
Wave 1 |
| v0.1.0 |
Wave 2 | Pubblicazione PyPI, CI/CD, security audit, coverage completa | v0.1.0 |
Wave 3 | Propagazione contesto, logging strutturato, progress reporting, accesso file sicuro via roots | v0.1.x |
Wave 4 |
| v0.2.0 |
Statistiche v0.3.2: 7 tool · 181 test · 95% di coverage, avvio del server incluso
Cosa dimostra tecnicamente
MCP server con strict typing mypy, testato su Python 3.11, 3.12 e 3.13
Security audit automatico — bandit + pip-audit
Coverage minima garantita all'80% (attualmente 95% su 181 test)
Accesso al filesystem fail-closed: le letture sono negate salvo configurazione esplicita
Pubblicato su PyPI — installabile ovunque con una riga
Bilingue IT/EN — pensato per mercato italiano e internazionale
Tracciabilita by design
Ogni funzionalita di questo repository e stata costruita con una pipeline multi-agente governata — planner, executor e reviewer come ruoli distinti, ciascuno con autorita dichiarata e quality gate obbligatori tra una fase e l'altra.
La cartella coord/ e la pista di controllo. Un handoff per task, con i file
modificati e il motivo, i comandi eseguiti con esito PASS/FAIL, le assunzioni
fatte e come sono state verificate, i rischi lasciati aperti. Quindici handoff
coprono le quattro wave di sviluppo elencate sopra.
Nel lavoro su ambiti regolati — fatturazione elettronica, dati fiscali, compliance — poter mostrare come un sistema e stato costruito conta quanto mostrare che funziona. La metodologia e documentata separatamente in agentic-dev-pipeline.
Stato del progetto
Beta. Testato con fatture FatturaPA sintetiche verificate contro lo schema ufficiale; non ancora usato in produzione. Vedi Limiti noti. Parte di un ecosistema più ampio: fatturapa-mcp-server → sdi-ops-monitor
Setup per lo sviluppo
git clone https://github.com/MaurizioLisanti/fatturapa-mcp-server
cd fatturapa-mcp-server
# Installa il pacchetto e tutte le dipendenze di sviluppo
make install # pip install -e ".[dev]"
# Esegui il quality gate completo (lint + typecheck + test + security)
make checkTarget individuali:
make test # pytest con coverage (fail-under 80 %)
make lint # ruff check + ruff format --check
make typecheck # mypy --strict
make security # bandit -ll + pip-audit
make format # correzione automatica formattazione e importMCP Inspector
MCP Inspector permette di invocare gli strumenti in modo interattivo da una web UI locale — utile durante lo sviluppo:
npx @modelcontextprotocol/inspector uvx fatturapa-mcp-server
# Aprire http://localhost:5173 nel browserProgetti correlati
sdi-ops-monitor — Pipeline AWS per ricevere, archiviare e instradare i file FatturaPA da/verso il SDI. Da usare insieme a questo server MCP per dare a Claude visibilità end-to-end sulle operazioni di fatturazione elettronica italiana.
agentic-dev-pipeline — La pipeline di sviluppo multi-agente governata con cui questo progetto è stato costruito. Gli handoff in
coord/ne sono l'output.
License / Licenza
Available Tools
7 toolscheck_pivaA
Validate an Italian VAT number using the official MEF checksum algorithm.
Performs format validation and the Ministry of Economy checksum algorithm. No network call — fully local computation.
Args: piva: Italian VAT number string. May include or omit the "IT" prefix. Expected: 11 digits after stripping prefix and whitespace. ctx: Optional MCP context for structured log emission.
Returns: A CheckPivaResult with keys: valid (bool): Whether the P.IVA passes format and checksum checks. piva (str): Normalised P.IVA (11 digits, no prefix). reason (str | None): Failure reason if valid is False, else None.
| Name | Required | Description | Default |
|---|---|---|---|
| piva | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| piva | Yes | |
| valid | Yes | |
| reason | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does well: it discloses the two validation phases (format + checksum), the offline/no-network behavior, and the exact shape of the result including the failure `reason` field. Minor gaps remain (e.g., error/exception behavior is unspecified), but the safety-relevant profile is covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The one-line purpose is front-loaded before the Args/Returns blocks, and every sentence carries information. The docstring-style Args/Returns formatting is somewhat verbose for a single-parameter tool but not wasteful.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a one-parameter, deterministic, offline validator, the description covers purpose, mechanism, input normalization rules, and output semantics; an output schema also exists. Nothing needed for correct invocation is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% and the bare `piva: string` schema says nothing, so the description must compensate — and it does, spelling out that the 'IT' prefix may be present or omitted and that 11 digits are expected after stripping prefix and whitespace. It even documents the optional `ctx` parameter that is absent from the input schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource ('Validate an Italian VAT number') and adds the distinguishing mechanism (official MEF checksum, fully local computation), which separates it from the network-based verify_piva_vies sibling. It stops short of naming the sibling explicitly, so it is clear but not maximally differentiated.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
'No network call — fully local computation' implies this is the offline/format-check path as opposed to a VIES lookup, which is genuine usage signal. However, it never states when to prefer this tool over verify_piva_vies or the other siblings, nor any exclusion conditions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
extract_invoice_dataA
Extract key fields from a validated FatturaPA XML document.
Parses the header and first body section to return structured invoice metadata. Never logs or persists XML content — only derived values are returned. Missing fields yield None rather than raising KeyError.
When file_path is given the document is read from disk; the path is
checked against the roots configured in FATTURAPA_ALLOWED_ROOTS before
any read is attempted. Pass xml_content directly to skip file I/O.
Args: xml_content: Raw XML string of a validated FatturaPA document. ctx: Optional MCP context for structured log emission. file_path: Optional filesystem path to read the document from. Checked against allowed roots before reading.
Returns: An ExtractResult TypedDict with supplier, customer, invoice header fields, and aggregated line_items from all body sections.
Raises: PermissionError: If file_path is outside the configured allowed roots. ValueError: If neither xml_content nor file_path is provided. lxml.etree.XMLSyntaxError: If the XML is not well-formed.
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | ||
| xml_content | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| currency | Yes | |
| line_items | Yes | |
| invoice_date | Yes | |
| total_amount | Yes | |
| customer_name | Yes | |
| customer_piva | Yes | |
| document_type | Yes | |
| supplier_name | Yes | |
| supplier_piva | Yes | |
| invoice_number | Yes | |
| customer_tax_code | Yes | |
| supplier_tax_code | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does so well: it discloses that XML content is never logged or persisted, that missing fields return None instead of raising, that file_path is checked against FATTURAPA_ALLOWED_ROOTS before any read, and it enumerates the exact exception types. This is materially richer than a bare 'extract' claim.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loads the one-line purpose, then uses conventional Args/Returns/Raises sections, so it is skimmable. The Raises block is slightly heavy for a read-only parse, but every sentence conveys contract detail rather than filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a two-parameter parse tool with an output schema, the description covers input sourcing, the allow-roots security gate, None-on-missing semantics, and all failure modes. An agent has everything needed to call it correctly; only the dual-input precedence edge case is unaddressed, and the output schema handles the return shape.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, and it defines both parameters (raw validated XML string; optional path validated against allowed roots) plus a ctx argument that appears only in the prose. It stops short of stating precedence when both xml_content and file_path are supplied.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource: 'Extract key fields from a validated FatturaPA XML document,' scoping output to header + first body section. The word 'validated' hints that validate_invoice is a prerequisite, but no sibling is named explicitly, so the agent must infer the pipeline position.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives a real usage fork: pass xml_content to skip file I/O, or file_path to read from disk. However it never states when to prefer this tool over find_invoice_anomalies or generate_invoice_report, and the validation prerequisite is only implied by the adjective 'validated' rather than stated as a condition.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
find_invoice_anomaliesA
Detect inconsistencies and anomalies in a FatturaPA XML document.
Checks eight anomaly categories: document total mismatch, VAT calculation error, future invoice date, invalid Italian P.IVA checksum, missing or suspicious destination code, incomplete line items, unjustified negative amount, and missing payment data. Never logs or persists XML content.
When file_path is given the document is read from disk; the path is
checked against the roots configured in FATTURAPA_ALLOWED_ROOTS before
any read is attempted. Pass xml_content directly to skip file I/O.
Args: xml_content: Raw XML string of the FatturaPA document. ctx: Optional MCP context for structured log emission. file_path: Optional filesystem path to read the document from. Checked against allowed roots before reading.
Returns: A FindAnomaliesResult with keys: anomalies_found (int): Total number of anomalies detected. anomalies (list): All anomaly records. warnings (list): Only warning-severity anomalies. errors (list): Only error-severity anomalies. is_clean (bool): True when no anomalies are found.
Raises: PermissionError: If file_path is outside the configured allowed roots. ValueError: If neither xml_content nor file_path is provided. lxml.etree.XMLSyntaxError: If the XML is not well-formed.
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | ||
| xml_content | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| errors | Yes | |
| is_clean | Yes | |
| warnings | Yes | |
| anomalies | Yes | |
| anomalies_found | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that XML is never logged or persisted, that file_path is checked against FATTURAPA_ALLOWED_ROOTS, and it lists PermissionError, ValueError, and XMLSyntaxError, which is valuable operational context. It does not explicitly state read-only semantics, but the behavioral body is strong.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loads purpose, then uses Args/Returns/Raises sections efficiently. The Returns block duplicates the existing output schema, and the Args block includes a non-schema ctx parameter, but the description is well organized and not bloated relative to the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers purpose, parameter usage, security constraints, error cases, and a return summary, which is sufficient for correct invocation. The main gap is sibling routing: nothing tells the agent when this tool is preferable to validate_invoice or check_piva.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It explains xml_content as a raw XML string and file_path as an optional path checked against allowed roots and skippable by passing XML directly, adding real meaning beyond the bare schema. It also lists a 'ctx' parameter that is not in the schema, a minor mismatch.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ('Detect') and resource ('inconsistencies and anomalies in a FatturaPA XML document') and enumerates eight anomaly categories, so the agent knows exactly what it does. However, it does not distinguish itself from sibling tools like validate_invoice or check_piva.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to choose this tool over validate_invoice, check_piva, or other siblings. The only usage notes concern file_path versus xml_content input, not tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate_invoice_reportA
Aggregate a batch of FatturaPA XML documents into a structured report.
Processes each invoice through extract_invoice_data and find_invoice_anomalies, then aggregates the results into totals, supplier/customer breakdowns, and an anomaly summary. Documents that cannot be parsed are counted separately in the errors list; they do not affect the monetary totals. Never logs or persists XML content.
Progress notifications: one step per invoice (1..N), then a final step (N+1) for the aggregation phase.
Args:
xml_contents: List of raw FatturaPA XML strings to process.
title: Optional report title; defaults to "Invoice Report".
ctx: Optional MCP context for structured log emission.
Returns: An InvoiceReportResult TypedDict with aggregated statistics, party breakdowns (suppliers/customers), and an anomaly summary.
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | ||
| xml_contents | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| title | Yes | |
| errors | Yes | |
| currency | Yes | |
| customers | Yes | |
| suppliers | Yes | |
| total_vat | Yes | |
| generated_at | Yes | |
| total_amount | Yes | |
| total_invoices | Yes | |
| valid_invoices | Yes | |
| invalid_invoices | Yes | |
| anomalies_summary | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations to lean on, the description carries the full burden and delivers: unparseable documents are counted in an errors list and excluded from monetary totals, XML content is never logged or persisted, and progress notifications follow a defined 1..N plus N+1 sequence. These are exactly the behavioral traits an agent needs and cannot get from structured fields.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with the purpose sentence, followed by behavior, then Args/Returns. The structure is scannable and every section earns its place, though the Args/Returns prose partially repeats what the output schema already conveys.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a two-parameter batch tool with an output schema, the description supplies error semantics, privacy guarantees, progress-notification behavior, and a parameter rundown. Nothing material an agent needs to invoke it correctly is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate, and it does: xml_contents is described as a list of raw XML strings, title is documented as optional with the 'Invoice Report' default, and ctx is explained as an optional MCP context for logging (not even present in the schema). It could add more on expected XML validity or size limits, but coverage is solid.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb (aggregate) and resource (FatturaPA XML documents) and the output (structured report). It distinguishes itself from siblings by explaining it composes extract_invoice_data and find_invoice_anomalies rather than performing those jobs itself.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description makes clear this is the batch aggregation entry point built on top of the extraction and anomaly siblings, so an agent can infer when to reach for it versus the single-invoice tools. It stops short of explicitly naming when NOT to use it or listing alternatives by name.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
lookup_sdi_errorA
Look up an SDI error code and return its human-readable description.
Uses a local static table of official AdE error codes. No network call required.
Args: error_code: SDI error code string (e.g., "00001", "00002"). ctx: Optional MCP context for structured log emission.
Returns: A LookupResult with keys: code (str): The queried error code. description (str): Official Italian description. category (str): Error category (e.g., "STRUTTURA", "CONTENUTO"). resolution (str): Suggested resolution hint.
Raises: ValueError: If error_code is not found in the known error table.
| Name | Required | Description | Default |
|---|---|---|---|
| error_code | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| code | Yes | |
| category | Yes | |
| resolution | Yes | |
| description | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and does well: it discloses the local static data source, that no network call is required, the exact return keys, and that a ValueError is raised when the code is unknown. It stops short of details like case sensitivity or input format constraints, keeping it from a 5.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with purpose and structured into Args, Returns, and Raises sections. It is somewhat verbose, and the Returns section partly duplicates what an output schema already provides, but the structure remains clear and useful.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple one-parameter lookup tool with no annotations and 0% schema description coverage, the description covers the essential behavior, return shape, and failure mode. Minor gaps around error-code formatting and the unexplained ctx parameter prevent a full 5.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It does add meaning for error_code with examples ('00001', '00002'), but it omits format constraints such as exact digit length, and it mentions a 'ctx' parameter that does not appear in the input schema, creating ambiguity.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource: 'Look up an SDI error code and return its human-readable description.' This clearly distinguishes it from all invoice-processing siblings, which perform validation, extraction, or reporting rather than error-code resolution.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use it by specifying the SDI error-code lookup and noting it uses a local static table with no network call. However, it does not state when to prefer alternatives or when this tool would not apply, leaving usage context only implied.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate_invoiceA
Validate a FatturaPA XML document against the appropriate XSD schema.
Auto-detects schema version (v1.2 or v1.3) from the XML namespace. Returns a structured result without logging any XML content.
When file_path is given the document is read from disk; the path is
checked against the roots configured in FATTURAPA_ALLOWED_ROOTS before
any read is attempted. Pass xml_content directly to skip file I/O.
Args: xml_content: Raw XML string of the FatturaPA document. ctx: Optional MCP context for structured log emission. file_path: Optional filesystem path to read the document from. Checked against allowed roots before reading.
Returns: A ValidateResult with keys: valid (bool): Whether the document passed XSD validation. version (str): Detected schema version ("1.2", "1.3", or "unknown"). errors (list[str]): Validation error messages, empty if valid.
Raises: PermissionError: If file_path is outside the configured allowed roots. ValueError: If neither xml_content nor file_path is provided.
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | ||
| xml_content | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| valid | Yes | |
| errors | Yes | |
| version | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does so thoroughly: it discloses auto-detection of the schema version, that no XML content is logged, that file_path is validated against FATTURAPA_ALLOWED_ROOTS before reading, and the exact exceptions (PermissionError, ValueError) and their triggers.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The docstring format is front-loaded with purpose, then behavioral notes, then Args/Returns/Raises. It is slightly verbose and the Returns block partially duplicates the output schema, but every paragraph adds information an agent needs.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a two-parameter validation tool with an output schema present, the description covers the full picture: version detection, error semantics, permission constraints, privacy behavior, and input-source selection. Nothing needed to invoke it correctly is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the prose must compensate, and it largely does: xml_content is described as a raw XML string and file_path as an optional path subject to allowed-root checking. It also documents the mutual-exclusion rule (ValueError when neither is given) that the schema's empty defaults do not convey.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The first sentence gives a precise verb+resource+target: 'Validate a FatturaPA XML document against the appropriate XSD schema.' This clearly separates it from siblings like extract_invoice_data or find_invoice_anomalies, which transform or analyze rather than schema-validate.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It clearly explains the two invocation modes (file_path reads from disk, xml_content skips I/O), but gives no explicit guidance about when to choose this tool over sibling tools such as extract_invoice_data or find_invoice_anomalies. Usage is implied rather than routed.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
verify_piva_viesA
Verify a VAT number against the EU VIES (VAT Information Exchange System).
Calls the official EU VIES REST endpoint with a configurable timeout. On timeout or service unavailability, returns a degraded response with source="unavailable" rather than raising — the caller must handle this case.
Args: country_code: Two-letter ISO 3166-1 alpha-2 country code (e.g., "IT"). vat_number: VAT number without the country prefix (e.g., "12345678901"). ctx: Optional MCP context for structured log emission.
Returns: A VerifyPivaViesResult with keys: valid (bool): Whether VIES confirmed the VAT number as active. name (str | None): Registered business name, if disclosed by VIES. address (str | None): Registered address, if disclosed by VIES. source (str): "vies" if live response, "unavailable" if service down.
| Name | Required | Description | Default |
|---|---|---|---|
| vat_number | Yes | ||
| country_code | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| name | Yes | |
| valid | Yes | |
| source | Yes | |
| address | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full behavioral burden. It discloses that the tool calls the official EU VIES REST endpoint, supports a configurable timeout, and returns a degraded response with source='unavailable' on timeout or service unavailability rather than raising an exception. This is valuable non-obvious behavior. It does not discuss rate limits or authentication requirements, but for a public verification endpoint those are less critical.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with purpose, then behavioral caveats, then Args and Returns sections. The structure is logical and readable. It is slightly verbose because it repeats return-value details that an output schema already provides, but every sentence is informative and there is no filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given that no annotations are provided and output schema exists, the description does a good job of covering purpose, key behavioral traits (timeout, degraded response), and parameter formats. It is nearly complete for an agent to call the tool correctly. The main gap is the lack of routing guidance versus sibling tools like check_piva, which leaves an agent to infer when this tool is preferable.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It documents both real input parameters: country_code as a two-letter ISO 3166-1 alpha-2 code with an example ('IT'), and vat_number as the VAT number without the country prefix with an example ('12345678901'). It also mentions a 'ctx' argument that is not present in the input schema, which is a minor inconsistency, but the semantics for the actual parameters are well covered.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb and resource: 'Verify a VAT number against the EU VIES (VAT Information Exchange System).' It is clear what the tool does. However, it does not distinguish this tool from the similar-sounding sibling 'check_piva', nor does it mention any alternative verification tools, so sibling differentiation is absent.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explains what the tool does and includes behavioral caveats about timeouts, but it gives no explicit guidance on when to use this tool instead of alternatives such as 'check_piva'. There is no when-to-use or when-not-to-use instruction, and no mention of prerequisites or comparison to related tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
7 tool updates
v0.3.2- First observed
check_piva - First observed
extract_invoice_data - First observed
find_invoice_anomalies - First observed
generate_invoice_report - First observed
lookup_sdi_error - First observed
validate_invoice - First observed
verify_piva_vies
TDQS
Scored across 7 tools
Each tool targets a clearly distinct action: schema validation, field extraction, error-code lookup, local VAT checksum, network VIES verification, anomaly detection, and batch reporting. The only superficially similar pair, check_piva vs verify_piva_vies, is explicitly differentiated (local MEF checksum vs live EU VIES call).
All tools follow a consistent snake_case verb_noun pattern (validate_invoice, extract_invoice_data, lookup_sdi_error, check_piva, verify_piva_vies, find_invoice_anomalies, generate_invoice_report). No mixed conventions or vague verbs.
Seven tools is well-scoped for a FatturaPA validation and analysis server, with each tool earning its place covering a distinct stage of the document lifecycle plus supporting VAT/error lookups.
Validation, extraction, anomaly detection, aggregation, and VAT/error lookups cover the analytical surface well. Minor gaps remain around document creation/generation or SDI submission, but the apparent purpose (validation and analysis) is fully supported.
Maintenance
Related MCP Connectors
Italy FatturaPA invoices for AI agents: build FPR12 XML, transmit to the SdI, query status.
Validate, extract, repair and generate French Factur-X / EN16931 invoices via AgentForge API
Italian tax + anti-fraud: CF, P.IVA, IBAN, ATECO, IMU, F24, FatturaPA, NIS2. 23 free + 5 with key.
Validate EU, UK, AU VAT numbers for AI agents. EU ViDA e-invoicing compliance.
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceInvoiceXML brings e-invoice compliance to your AI agent. Create, validate, convert, render, and extract structured invoices across UBL (Peppol BIS Billing 3.0, used worldwide), CII, Factur-X, ZUGFeRD, and XRechnung, all checked against the EN 16931 standard and official Schematron rules. Ask your assistant to generate a compliant invoice, validate one for errors, or convert between formats, with n5MIT- AlicenseAqualityDmaintenanceValidates EU electronic invoices (Peppol, XRechnung, FatturaPA, etc.) and explains validation error codes, enabling AI coding agents to check invoice validity and get fixes before rejection.338 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to issue Poland structured e-invoices (faktura ustrukturyzowana) through KSeF 2.0, handling FA(3) XML building, encrypted session flow, and KSeF number retrieval.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to issue Italian FatturaPA electronic invoices and transmit them to the SdI via Invoicetronic. Supports creating and querying invoices with Italian VAT rates.MIT