mcp-cfdi-mx
This server provides Mexican CFDI 4.0 e-invoicing capabilities: build, validate, seal, and verify CFDI documents, complementos, and TFD stamps in a PAC-agnostic way.
Build CFDI 4.0 documents — Generate well-formed, unsealed Ingreso or Egreso
ComprobanteXML withmx__build_cfdi.Build Complemento de Pagos 2.0 — Create
TipoDeComprobante="P"CFDI XML with the Pagos complement usingmx__build_pago.Validate against SAT XSD schemas — Run full XSD validation for CFDI 4.0, and additionally validate TFD 1.1 and Pagos 2.0 complements when present with
mx__validate_cfdi.Seal CFDI documents — Compute the Sello Digital locally using the emisor's CSD, or return the XML unchanged for PAC-side sealing, via
mx__seal_cfdi.Verify PAC TFD stamps — Parse a Timbre Fiscal Digital 1.1 stamp, recompute its cadena original, and optionally cryptographically verify
SelloSATwithmx__verify_tfd.Inspect supported scope — Return the current document types, complementos, sealing modes, and out-of-scope items with
mx__get_supported_scope.Validate Mexican RFCs — RFC fields are validated through
TaxIdentifier.validate_mx_rfcas part of document building.PAC-agnostic design — No PAC submission; the server only prepares, seals, validates, and verifies documents.
mcp-cfdi-mx 🇲🇽
A Python MCP server providing tools for Mexican electronic invoicing compliant with CFDI 4.0 and Complemento de Pagos 2.0, per SAT's Anexo 20 technical standard. It enables AI agents (Claude, IDEs) to build, XSD-validate, and seal CFDI 4.0 documents (Ingreso, Egreso, and Complemento de Pagos 2.0), verify a PAC-returned Timbre Fiscal Digital stamp, and validate Mexican RFC tax identifiers.
Phase 1 scope. This package covers CFDI 4.0 Ingreso, Egreso, and Complemento de Pagos 2.0 only — Carta Porte, Complemento de Nómina, Retenciones, and Comercio Exterior are not yet supported, and it does not submit to any PAC. See Available tools for exactly what is implemented today.
Introduction
This package is built on mcp-einvoicing-core, the shared base library for e-invoicing MCP servers. It provides the InvoiceDocument model base, the TaxIdentifier.validate_mx_rfc RFC validator, and SelloDigitalSigner — the MX-specific concrete implementation of core's document-signing abstraction (SHA-256 digest of the cadena original, RSA-PKCS#1v1.5-signed with the emisor's CSD, per SAT's Anexo 20).
mcp-einvoicing-core is installed automatically as a dependency, no additional step is required.
CFDI is a clearance-model standard: a CFDI becomes legally valid only once a PAC (Proveedor Autorizado de Certificación) certifies it and returns a Timbre Fiscal Digital (TFD). This package does not submit to a PAC — it is PAC-agnostic, producing either a locally-sealed CFDI (ready to hand to any PAC that accepts pre-sealed documents) or an unsealed, schema-valid CFDI (for a PAC that seals on the emisor's behalf), selected via a sealing_mode parameter.
Related MCP server: mcp-fattura-elettronica-it
Installation
Via PyPI (recommended)
pip install mcp-cfdi-mxOr without prior installation using uvx:
uvx mcp-cfdi-mxFrom source
git clone https://github.com/cmendezs/mcp-cfdi-mx.git
cd mcp-cfdi-mx
uv sync --all-extrasConfiguration (environment variables)
This package has no required environment variables. CSD certificate/key paths and passwords are passed as tool arguments (file paths or environment references — never plaintext key material embedded in a request), not read from a fixed environment variable name.
Claude Desktop integration
Add the following configuration to your claude_desktop_config.json file:
{
"mcpServers": {
"cfdi-mx": {
"command": "uvx",
"args": ["mcp-cfdi-mx"]
}
}
}Cursor integration
Cursor supports MCP servers via stdio. Add the configuration to:
Globally (all projects):
~/.cursor/mcp.jsonPer project (this repository only):
.cursor/mcp.json
{
"mcpServers": {
"cfdi-mx": {
"command": "uvx",
"args": ["mcp-cfdi-mx"]
}
}
}Reload the Cursor window (Ctrl+Shift+P → Reload Window) after saving changes.
Kiro integration
Kiro supports MCP servers through a dedicated configuration file:
Globally:
~/.kiro/settings/mcp.jsonWorkspace:
.kiro/settings/mcp.json
{
"mcpServers": {
"cfdi-mx": {
"command": "uvx",
"args": ["mcp-cfdi-mx"],
"disabled": false,
"autoApprove": []
}
}
}Security tip: if a future tool version accepts credentials via environment reference, use the syntax
"VAR_NAME": "${VAR_NAME}"so Kiro resolves it from the shell rather than storing it in plaintext.
Available tools
Build
Tool | Description |
| Build a well-formed, unsealed CFDI 4.0 |
| Build a Complemento de Pagos 2.0 CFDI ( |
Validate and seal
Tool | Description |
| Full XSD validation against |
| Compute the Sello Digital via |
| Parse a PAC-returned Timbre Fiscal Digital 1.1 stamp, and cryptographically verify |
Scope
Tool | Description |
| Returns the CFDI document types, complementos, and sealing modes this package currently supports |
See docs/TOOLS.md for the full parameter reference of every tool, generated from the live tool registry.
Not yet implemented
PAC submission transport (this package is PAC-agnostic and does not submit to any specific PAC), and later-phase complementos (Carta Porte, Complemento de Nómina, Retenciones, Comercio Exterior) — tracked in context-library/roadmap-2026.md (workspace root repo).
Architecture
mcp_cfdi_mx.models.CFDIComprobante extends mcp_einvoicing_core.models.InvoiceDocument (the
non-EN 16931 pathway — CFDI predates and has no lineage to CEN TC 434, the same determination
as mcp-nfe-br). RFC validation for both Emisor and Receptor routes through
TaxIdentifier.validate_mx_rfc (core). Sealing routes through
mcp_einvoicing_core.digital_signature.SelloDigitalSigner, the MX-specific concrete
implementation of core's BaseDocumentSigner — the same pattern ES (XAdES), BR (XML-DSig),
and IT (CAdES) use for their own signature standards.
[ ERP System / Application ] <--> [ MCP Server ] <--> [ PAC (any, PAC-agnostic) / SAT ]
^ |
| v
[ AI Agent (Claude) ] <--- (CFDI 4.0 / Pagos 2.0)Supported standards
Standard | Version | Source |
CFDI (Comprobante Fiscal Digital por Internet) | 4.0 | SAT Anexo 20, DOF 2022-01-13 |
Timbre Fiscal Digital | 1.1 | SAT |
Complemento de Pagos | 2.0 | SAT |
See specs/README.md for the full source bundle and retrieval dates, and
context-library/countries/mx.md
in the workspace root repo for the verified compliance reference.
Tests
uv run pytest tests/ -vContributing
Contributions are welcome — see CONTRIBUTING.md for guidelines.
Other e-invoicing MCP servers
Country | Server |
🌍 Global | |
🇦🇪 United Arab Emirates | |
🇧🇪 Belgium | |
🇧🇷 Brazil | |
🇫🇷 France | |
🇩🇪 Germany | |
🇮🇹 Italy | |
🇲🇽 Mexico | |
🇵🇱 Poland | |
🇸🇬 Singapore | |
🇪🇸 Spain |
License
This project is distributed under the Apache 2.0 license. See the LICENSE file for details. For the full version history, see CHANGELOG.md.
Available Tools
6 toolsmx__build_cfdiMx Build CfdiA
Build a well-formed, unsealed CFDI 4.0 Comprobante XML (Ingreso or Egreso).
comprobante_data is validated against CFDIComprobante — see that
model for the full field list (seller/buyer as MXEmisor/
MXReceptor, lines as CFDIConcepto, tipo_de_comprobante, etc.).
RFC fields are validated via TaxIdentifier.validate_mx_rfc as part of
model construction; a malformed RFC is reported as a validation error,
not a generated document.
The output XML omits Sello/NoCertificado/Certificado — those three
schema-required attributes are populated by mx__seal_cfdi, run
afterward. mx__validate_cfdi run on this output is expected to report
exactly those three attributes missing; that is not a bug in this tool.
For TipoDeComprobante="P" (Complemento de Pagos), use mx__build_pago
instead — this tool only builds Ingreso/Egreso Comprobantes.
Returns a dict with:
xml: the generated, unsealed CFDI 4.0 XML stringtotal: the computedTotalattribute (SubTotal - Descuento + traslados - retenciones)
| Name | Required | Description | Default |
|---|---|---|---|
| comprobante_data | Yes | Fields matching the CFDIComprobante schema (Ingreso or Egreso only) |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It honestly states that the output is unsealed, omits Sello/NoCertificado/Certificado, and that validation on the output should report exactly those three missing attributes. It also documents RFC validation behavior as a validation error rather than a generated document.
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 dense but every sentence earns its place. It is front-loaded with the core purpose, then adds exclusions, validation behavior, workflow, and return shape without unnecessary filler. Code formatting and structured bullets improve scannability.
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 complex nested-object tool with no annotations, the description is remarkably complete. It covers model validation, RFC validation behavior, sealed vs unsealed output, expected downstream validation results, and the return dict including the total computation formula. An agent can select and invoke this tool correctly with confidence.
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?
The input schema only describes comprobante_data as an object matching a schema, but the description adds substantial meaning: full field list reference, seller/buyer as MXEmisor/MXReceptor, lines as CFDIConcepto, and RFC validation via TaxIdentifier.validate_mx_rfc. This is critical because the schema uses additionalProperties: true and does not enumerate fields.
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 ('Build'), a specific resource ('CFDI 4.0 Comprobante XML'), and a clear scope ('Ingreso or Egreso'). It also distinguishes itself from the sibling mx__build_pago by explicitly excluding Pago documents, making tool selection unambiguous.
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 explicitly says when not to use this tool ('For tipo_de_comprobante="P" (Pago), use mx__build_pago instead'), and it names the follow-up tool mx__seal_cfdi for sealing. It also explains what mx__validate_cfdi should report, giving clear workflow guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mx__build_pagoMx Build PagoA
Build a well-formed, unsealed Complemento de Pagos 2.0 CFDI.
Composes the fixed single-Concepto wrapper SAT's Guía de llenado de
pagos mandates for a Pago-type Comprobante (ClaveProdServ,
ClaveUnidad, Descripcion, ValorUnitario, Importe, ObjetoImp are
all fixed conventional values — see this module's docstring constants)
with the Pagos20 complement built from pagos_data, and attaches the
complement under cfdi:Complemento.
buyer.uso_cfdi is forced to "CP01" (the schema requires it for every
Pagos CFDI per the same guide, regardless of what the caller passes) —
mirrors how this tool already forces SubTotal/Moneda/etc.
The output XML omits Sello/NoCertificado/Certificado, same as
mx__build_cfdi — seal afterward with mx__seal_cfdi.
Returns a dict with:
xml: the generated, unsealed CFDI XML string (with the Pagos complement attached)
| Name | Required | Description | Default |
|---|---|---|---|
| pagos_data | Yes | Fields matching the Pagos20 schema | |
| comprobante_data | Yes | Fields matching CFDIComprobante, minus SubTotal/Moneda/FormaPago/MetodoPago/CondicionesDePago/lines/TipoDeComprobante — all fixed or derived for a Pagos CFDI, do not supply them |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full behavioral burde. It discloses that the output is unsealed, omits Sello/NoCertificadao/Certificado, forces buyer.uso_cfdi to CP01 'regardless of what the caller passes,' and returns a dict with an xml key. It also explains that the tool mirrors mx__build_cfdi and that sealing must happen afterward.
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 dense but every sentence earns its place: scope, fixed-value behavior, sealing expectations, and return shape. It is front-loaded with the purpose and organized so that technical details follow naturally, without repetition or fluff.
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 the tool's complexity, the descriptions fully covers what an agent needs: input responsibilities, forced schema values, output structure, the unsealed state, and the next step to use mx__seal_cfdi. The output schema signal also relieves the description from needing to enumerate every return field beyond the xml key.
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 100%, so the baseline is 3. The description adds value beyond the schema by explaining that comprobante_data fields like SubTotal/Moneda are fixed or derived, that buyer.uso_cfdi is forced to CP01, and that pagos_data drives the Pagos20 complement. This helps the agent understand why certain fields must not be 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?
The description opens with a specific verb and resource: 'Build a well-formed, unsealed Complemento de Pagos 2.0 CFDI.' It immediately distinguishes itself from mx__build_cfdi by scoping to a Pagos-type comprobante and mentions the Pagos20 complement and fixed Concepto wrapper.
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 the intended context clear through the phrase 'Pagos-type Comprobante' and refers to mx__build_cfdi and mx__seal_cfdi as related steps. However, it does not explicitly state 'use this instead of mx__build_cfdi for Pagos' or list when-not-to-use conditions, so it falls short of the highest explicitness bar.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mx__get_supported_scopeMx Get Supported ScopeA
Return the CFDI document types, complementos, and sealing modes this package supports.
Reflects Phase 1 scope locked in context-library/countries/mx.md
(workspace root repo): CFDI 4.0 Ingreso + Egreso + Complemento de Pagos
2.0, PAC-agnostic sealing. Build (mx__build_cfdi/mx__build_pago),
XSD validation (mx__validate_cfdi), sealing (mx__seal_cfdi), and TFD
verification (mx__verify_tfd) are all implemented. PAC submission
transport and later-phase complementos are not — see roadmap-2026.md.
Returns:
A ScopeInfo describing current scope, for callers to check before
assuming a document type or complemento is supported.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| phase | Yes | |
| version | Yes | |
| out_of_scope | Yes | |
| sealing_modes | Yes | |
| supported_complementos | Yes | |
| supported_document_types | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full disclosure duty and excels: it states the tool returns scope information, lists exact supported CFDI versions and complementos, names the implemented operations, and explicitly calls out what is not implemented ('PAC submission transport and later-phase complementos are not'). This gives a transparent view of behavior and limitations.
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 the purpose, then layers supporting details: scope source, implemented operations, excluded features, and return value. Every sentence adds useful context and none is redundant with the schema or annotations.
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 zero-parameter introspection tool with an output schema, this description is complete. It tells the agent exactly what scope information is returned, what is covered, what is not covered, and where the authoritative context lives, so there is no ambiguity about calling it correctly.
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?
The tool accepts zero parameters, so the baseline is 4. The description adds useful meaning by explaining that the returned ScopeInfo describes current scope, which is about as much parameter semantics as an empty schema needs.
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 opens with a specific verb and resource: 'Return the CFDI document types, complementos, and sealing modes this package supports.' It clearly identifies this as an introspection capability and distinguishes it from the operational siblings by describing what it reports.
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 explicitly tells callers when to use it: 'for callers to check before assuming a document type or complemento is supported.' It also names the sibling tools and notes which are implemented versus not, but it does not explicitly say when not to use it or directly route to an alternative tool, so it stops short of full when/ when-not guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mx__seal_cfdiMx Seal CfdiA
Seal (or deliberately not seal) a CFDI 4.0 Comprobante, PAC-agnostic.
sealing_mode="local" computes the cadena original via the actual SAT
XSLT transform (specs/cadenaoriginal_4_0.xslt, with its utilerias.xslt
and Pagos20.xslt includes resolved from specs/; any other complemento
include a document might reference is not in Phase-1 scope and stubs to
a no-op template — see SelloDigitalSigner's docstring), then computes
Sello/NoCertificado/Certificado via
mcp_einvoicing_core.digital_signature.SelloDigitalSigner — no local
reimplementation of the signing algorithm.
sealing_mode="pac" returns xml unchanged: some PACs accept an
unsealed, schema-valid CFDI and seal it on the emisor's behalf. This
tool does not submit to any PAC — see the package README for the
PAC-agnostic design.
CSD key material is always a file path, never accepted as plaintext key content in a tool argument.
Returns a dict with:
xml: the sealed (or, for"pac", unchanged) XML stringsealing_mode: echoes the mode used
| Name | Required | Description | Default |
|---|---|---|---|
| xml | Yes | The unsealed CFDI 4.0 Comprobante XML, as returned by mx__build_cfdi/mx__build_pago | |
| key_path | No | Path to the CSD's encrypted PKCS#8 DER private key (.key). Required when sealing_mode='local'. | |
| cert_path | No | Path to the CSD's DER-encoded certificate (.cer). Required when sealing_mode='local'. | |
| key_password | No | Passphrase for the private key. Required when sealing_mode='local'. This is a secret that transits the tool call as plain text — callers should source it from an environment variable or secrets manager reference on their side rather than hardcoding it, the same as cert_path/key_path are file references rather than inline key material. | |
| sealing_mode | Yes | 'local': compute Sello/NoCertificado/Certificado from the supplied CSD. 'pac': return the XML unchanged, for a PAC that seals on the emisor's behalf. | |
| no_certificado | No | The CSD's 20-digit serial number from the SAT enrollment acknowledgment (acuse). Not derived from the certificate bytes — no confirmed algorithm exists for that derivation, see SelloDigitalSigner's docstring. Required when sealing_mode='local'. |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden, and it does extensively: it explains that local sealing uses an actual SAT XSLT transform, that out-of-scope complementos are stubbed to no-op templates, that key material is only accepted as file paths and never plaintext, that PAC mode returns the XML unchanged, and that the tool does not submit to any PAC. It also explicitly warns that no_certificado is not derived from certificate bytes. This is a highly transparent behavioral disclosure.
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 organized with clear paragraphs per mode and a concise return-value summary. It is longer than minimal, but every section adds necessary operational detail: mode behavior, XSLT internals, security constraints, and return shape. Minor deduction because the implementation detail about spec files and SelloDigitalSigner's docstring could arguably be condensed, but it earns its place for transparency.
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 the tool's overall complexity (6 params, two modes, file-path dependencies, security considerations) and the fact that no annotations are present, the description covers all essential calling context: mode selection, required parameters per mode, security convention, return format, and what the tool does not do. The presence of an output schema further confirms the return dict, and the description already enumerates its keys. Nothing critical 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 100%, so the baseline is 3, but the description adds substantial value beyond the schema. It explains the relationship between key_path/cert_path/key_password/no_certificado and sealing_mode, clarifies the security convention for key material, documents the no_certificado derivation caveat, and maps the sealing_mode enum values to their concrete behavior. This is auxesis rather than mere repetition.
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 opens with a specific verb ('Seal'), a precise resource ('a CFDI 4.0 Comprobante'), and an explicit scope qualifier ('PAC-agnostic'). It clearly distinguishes the two modes of operation. It also differentiates the tool from siblings by stating that it does not submit to any PAC, which is a key distinguishing trait among the cfdi-related tools.
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 explicitly explains when each sealing_mode should be used: 'local' computes the cadena original and signature, 'pac' returns the XML unchanged for PACs that seal on the emisor's behalf. It also states what this tool does not do ('does not submit to any PAC') and where to find the PAC-agnostic design context (package README). This is strong guidance for selecting the right mode and avoiding misuse.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mx__validate_cfdiMx Validate CfdiA
Validate a CFDI 4.0 document against the official SAT XSD schemas.
Always validates the root Comprobante against cfdv40.xsd. If a
TimbreFiscalDigital complement is present (i.e. the document has been
stamped by a PAC), it is additionally validated against
TimbreFiscalDigitalv11.xsd.xml. If a Pagos complement is present
(TipoDeComprobante="P"), it is additionally validated against
Pagos20.xsd.xml.
This is XSD-only — business-rule checks from SAT's Matriz de errores
(specs/MatrizDeErrores_CFDI_v40_20260325.xls) are not run, mirroring
mcp-nfe-br's br__validate_nfe_xml precedent (XSD-first, business
rules deferred). A document that passes this validator is structurally
conformant but not guaranteed to pass PAC certification.
Returns a dict with:
valid: True only if every schema that applies passedcomprobante: thecfdv40.xsdvalidation resulttfd: the TFD validation result, present only if aTimbreFiscalDigitalelement was foundpagos: the Pagos 2.0 validation result, present only if aPagoselement was found
| Name | Required | Description | Default |
|---|---|---|---|
| xml | Yes | The CFDI 4.0 Comprobante XML to validate, as a string |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations are absent, so the description carries the full burden and meets it thoroughly. It discloses the always-run root Comprobante check, the conditional TFD and Pagos validations with their trigger conditions, the XSD-only limitation, and the precise semantics of 'valid' (True only if every applicable schema passed). This depth goes far beyond what the annotations could have provided.
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 long but every section earns its place: purpose sentence, conditional validation logic, scope limitation, and a scannable bulleted return-dict breakdown. The core purpose is front-loaded, and the length is proportionate to the real complexity of three schemas and conditional validation paths.
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?
An agent can invoke this correctly from the description alone: one fully documented parameter, explicit conditional behavior, documented return keys, and an existing output schema. The only real gap is that the description never positions itself against the adjacent sibling mx__verify_tfd, so an agent must infer which tool covers verification of the TFD seal.
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 100% — the single 'xml' parameter is already documented as 'The CFDI 4.0 Comprobante XML to validate, as a string.' The description confirms this but adds no syntax, format, or encoding detail beyond the schema; the conditional behavior based on document contents is better credited under behavioral transparency.
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?
Opens with a specific verb+resource+method: 'Validate a CFDI 4.0 document against the official SAT XSD schemas.' It further names the exact schemas (cfdv40.xsd, TimbreFiscalDigitalv11.xsd.xml, Pagos20.xsd.xml) and its structural-validation scope clearly differentiates it from the build/seal siblings and from mx__verify_tfd's verification role.
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?
Explicitly states the negative space: business-rule checks from SAT's Matriz de errores are not run, and 'a document that passes this validator is structurally conformant but not guaranteed to pass PAC certification.' However, it never names a concrete alternative for those excluded cases, leaving the validate-vs-verify boundary with mx__verify_tfd implicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mx__verify_tfdMx Verify TfdA
Parse a Timbre Fiscal Digital 1.1 stamp and, optionally, verify SelloSAT.
Always returns the TFD's own attributes (UUID, FechaTimbrado,
RfcProvCertif, SelloCFD, NoCertificadoSAT, SelloSAT, ...) and the
recomputed cadena original (via cadenaoriginal_TFD_1_1.xslt, per
Anexo 20 Rubro III.B). If pac_certificado_der_b64 is supplied,
additionally verifies SelloSAT (SHA-256 + RSA-PKCS#1v1.5, the same
algorithm as the emisor's own Sello) against that certificate's public
key. Without it, sello_sat_verified is null — parsing succeeded but
cryptographic verification was not attempted, not "passed".
Returns a dict with:
found: False if noTimbreFiscalDigitalelement exists in xmlfields: the TFD's own attributescadena_original: the recomputed cadena original stringsello_sat_verified: True/False ifpac_certificado_der_b64was supplied, else null
| Name | Required | Description | Default |
|---|---|---|---|
| xml | Yes | The sealed, PAC-stamped CFDI XML (with a TimbreFiscalDigital complement) | |
| pac_certificado_der_b64 | No | Base64-encoded DER certificate of the PAC/SAT that stamped this TFD, used to cryptographically verify SelloSAT. SAT does not embed this certificate in the TFD itself, so it is not available without the caller supplying it. Omit to parse fields and compute the cadena original without verifying SelloSAT. |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description fully carries the burden of behavioral disclosure. It exposes the always-returned attributes, the XSLT-based cadena original computation, the exact cryptographic algorithm (SHA-256 + RSA-PKCS#1v1.5), and the important null-vs-false semantics for `sello_sat_verified`.
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 dense but well-structured: core purpose first, then the optional verification mode, then a bulleted return dict. There is no filler; every sentence provides operational or semantic detail needed to invoke the tool correctly.
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?
Even though an output schema exists, the description usefully covers runtime behavior, the verification algorithm, the optional certificate path, and the null semantics. An agent can correctly decide whether to call this tool and know what to expect in return.
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?
The input schema already documents both parameters with 100% coverage, so the baseline is 3. The description reinforces the optional certificate behavior and adds the 'same algorithm as the emisor's own Sello' detail, but it does not add substantial new parameter meaning beyond what the schema already states.
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 opens with a precise verb and object: 'Parse a Timbre Fiscal Digital 1.1 stamp and, optionally, verify SelloSAT.' This clearly identifies the resource (TFD 1.1) and the tool's distinguishing verification behavior, setting it apart from the CFDI build/validate/seal sibling tools even without naming them.
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 provides clear conditional usage guidance: supply `pac_certificado_der_b64` to verify SelloSAT, or omit it to parse fields and compute the cadena original without verification. It also clarifies that a null `sello_sat_verified` means verification was not attempted, not that it failed. It stops short of explicitly naming alternatives or exclusions.
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. Dates show when Glama detected each change.
6 tool updates
v0.3.0- First observed
mx__build_cfdi - First observed
mx__build_pago - First observed
mx__get_supported_scope - First observed
mx__seal_cfdi - First observed
mx__validate_cfdi - First observed
mx__verify_tfd
TDQS
Each tool covers a distinct stage or artifact: scope discovery, CFDI building for ingreso/egreso, pago building, validation, sealing, and TFD verification. The two build tools are explicitly separated by document type with cross-references, removing ambiguity.
All tools follow the same mx__verb_noun snake_case pattern: get_supported_scope, build_cfdi, build_pago, validate_cfdi, seal_cfdi, verify_tfd. The verb prefixes are regular and the objects map directly to CFDI concepts.
Six tools form a focused, non-redundant pipeline covering discovery, two document variants, validation, sealing, and TFD verification. The count is well within the ideal range for a specialized server.
The tool surface covers the declared Phase 1 lifecycle end-to-end: build, validate, seal, and verify TFD, plus a scope-discovery guard. PAC submission, cancellation, and additional complementos are explicitly documented as out of scope rather than missing, so agents are not led into a dead end.
Maintenance
Related MCP Connectors
Brazilian fiscal MCP server - issue NF-e, NFC-e, NFS-e, CT-e, MDF-e and DC-e via SEFAZ.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
MCP server for Codat — companies, connections, invoices, bills and financial statements.
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 Italian Electronic Invoicing (FatturaPA / SDI). Provide tools to validate, generate, and explore API specifications for Sistema di Interscambio (SDI) interoperability.431Apache 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.103Apache 2.0
- AlicenseBqualityAmaintenanceModel Context Protocol (MCP) server for Spanish Electronic Invoicing. Provides tools to generate, validate, and submit invoices across VERI\*FACTU, Facturae/FACe, SII, TicketBAI, and Crea y Crece B2B.202Apache 2.0
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-cfdi-mx'
If you have feedback or need assistance with the MCP directory API, please join our Discord server