Mexican Tax & Banking

v1.1.3
io.github.OrtaMarco/mx-fiscal-mcp-server Checked 2 days ago Published 11 days ago

Validate RFC, CURP, CLABE and NSS, read CFDI 4.0 invoices and check their SAT status.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

validate_rfc Validate RFC

Validate a Mexican RFC (Registro Federal de Contribuyentes) — the SAT taxpayer ID — and break it into its parts. Works for both shapes: 13 characters for a persona física (individual) and 12 for a persona moral (company). The last character is a modulus-11 check digit over the preceding ones, and this checks it. Two SAT-issued generics are special-cased and reported as such: - **XAXX010101000** (público en general) does NOT satisfy the check-digit algorithm — the arithmetic asks for a '4' where the SAT wrote a '0'. It is valid by decree, not by maths, which is exactly why so many h…

ParameterTypeDescription
value *stringThe RFC to validate, e.g. 'GODE561231GR8' (individual) or 'MAB9307148T4' (company).
response_formatstringOutput format: 'markdown' for a human-readable summary (default) or 'json' for the full structured payload.

validate_curp Validate CURP

Validate a Mexican CURP (Clave Única de Registro de Población) — the 18-character population ID issued by RENAPO — and decode everything it encodes: birth date, sex, state of birth and the century marker. The 18th character is a base-37 modulus-10 check digit over the first 17, and this checks it. Two details it gets right that a regex does not: - **The state keys are RENAPO's own.** 'DF' is Ciudad de México, 'MC' is Estado de México, 'NE' means born abroad. They do not match the INEGI or ISO 3166-2:MX codes, so a lookup against those tables silently mislabels people. - **The hom…

ParameterTypeDescription
value *stringThe CURP to validate, e.g. 'BOXW310820HNERXN09'.
response_formatstringOutput format: 'markdown' for a human-readable summary (default) or 'json' for the full structured payload.

validate_clabe Validate CLABE

Validate an 18-digit CLABE (Clave Bancaria Estandarizada, Banxico Circular 3/2012) — the account number every SPEI transfer in Mexico is addressed to — and name the bank behind it. Structure: 3 digits of bank + 3 of plaza (city/branch) + 11 of account + 1 control digit. **The control digit is the part everybody gets wrong.** The weights cycle 3-7-1, and each weighted product counts only its last digit (the product modulo 10): 9 × 7 = 63 counts as 3. Implementations that borrow the Luhn habit of adding the product's digits (6 + 3 = 9) compute a different control digit — for the base 09…

ParameterTypeDescription
value *stringThe CLABE to validate, e.g. '012180012345678903'.
response_formatstringOutput format: 'markdown' for a human-readable summary (default) or 'json' for the full structured payload.

validate_nss Validate NSS (IMSS)

Validate an 11-digit NSS (Número de Seguridad Social) issued by the IMSS, and split it into its fields: 2 digits of subdelegación, 2 of the year the holder was registered, 2 of the year of birth, 4 of serial, and a Luhn check digit over the first ten. The two year fields are informational only. The IMSS has issued numbers whose years do not line up with the holder's records, so a mismatch is not grounds to reject a number — only the check digit is. Args: - value (string): the NSS. Spaces and dashes are normalised away. - response_format ('markdown' | 'json'): output format (default '…

ParameterTypeDescription
value *stringThe NSS to validate, e.g. '92119624722'.
response_formatstringOutput format: 'markdown' for a human-readable summary (default) or 'json' for the full structured payload.

generate_test_data Generate Mexican Test Data

Generate structurally valid Mexican identifiers for fixtures, database seeds and demos — generated, not taken from any real record. For a **person** each record carries a coherent set: the RFC and the CURP are derived from the *same* name, sex, birth date and state, the CLABE's bank code is a real Banxico participant, and the NSS satisfies its Luhn digit. For a **company**, a razón social with a matching persona-moral RFC and a CLABE. Why generated instead of hand-written: an RFC or CURP typed by hand almost never satisfies its check digit, so it fails the first validation your own code r…

ParameterTypeDescription
countintegerHow many records to generate, 1-100.
kindstring'person' for individuals (RFC + CURP + CLABE + NSS), 'company' for personas morales.
response_formatstringOutput format: 'markdown' for a human-readable summary (default) or 'json' for the full structured payload.

parse_cfdi Parse CFDI XML

Turn the XML of a Mexican electronic invoice (CFDI 4.0) into structured JSON: header, issuer, receiver, every line item with its transferred and withheld taxes, the tax totals, and the Timbre Fiscal Digital (UUID, stamp date, SAT certificate number, PAC's RFC) — or `timbre: null` when the document was never stamped. Three things this does beyond reading attributes: 1. **It labels the catalogue codes.** '601' becomes 'General de Ley Personas Morales', 'G03' becomes 'Gastos en general', 'PPD' becomes 'Pago en parcialidades o diferido'. An unknown code is reported as unknown rather than gue…

ParameterTypeDescription
xml *stringThe complete CFDI XML as a string, from '<cfdi:Comprobante' (or '<?xml') to the closing tag.
response_formatstringOutput format: 'markdown' for a human-readable summary (default) or 'json' for the full structured payload.

cfdi_status CFDI Status at the SAT

Ask the SAT whether an invoice actually exists and is still live. This queries the public `ConsultaCFDIService` SOAP endpoint — the same service the QR code printed on every Mexican invoice points at — so it needs **no credentials, no CSD and no PAC contract**. Pass either the four values the SAT keys on (issuer RFC, receiver RFC, total, UUID) or the whole `xml`, in which case they are derived from it with the same reader `parse_cfdi` uses. Deriving them from the XML is the more reliable route: the total must be formatted exactly the way the printed-representation spec demands (six decima…

ParameterTypeDescription
response_formatstringOutput format: 'markdown' for a human-readable summary (default) or 'json' for the full structured payload.
rfc_emisorstringIssuer's RFC. Required unless `xml` is given.
rfc_receptorstringReceiver's RFC. Required unless `xml` is given.
totalstringInvoice total exactly as written in the XML, e.g. '1160.00'. Required unless `xml` is given.
uuidstringThe fiscal folio (UUID) from the Timbre Fiscal Digital. Required unless `xml` is given.
xmlstringThe complete CFDI XML. When given, the four query fields are derived from it and any values passed alongside are ignored.

cfdi_batch_status CFDI Status at the SAT, several invoices

Ask the SAT about up to 25 invoices in one call — same service and same answer per invoice as `cfdi_status`, with the SAT's request for restraint built in: **at most 2 requests in flight**, duplicates asked once, answers remembered in memory for 10 minutes (an outage is never remembered), and once 2 consecutive requests have failed no new one is started (one already in flight still finishes). Use it to reconcile a handful of invoices; it is not a bulk-verification pipeline, and the SAT states its service is sized for up to 2 million queries per hour and asks callers not to raise their volume…

ParameterTypeDescription
items *arrayThe invoices to check, 1-25.
response_formatstringOutput format: 'markdown' for a human-readable summary (default) or 'json' for the full structured payload.

sat_catalog_lookup SAT Catalogue Lookup

Look up the code tables a CFDI is written in, without downloading the SAT's spreadsheet. Nine catalogues, all bundled — this tool never touches the network. - `regimen_fiscal` (c_RegimenFiscal) — tax regime of issuer and receiver - `uso_cfdi` (c_UsoCFDI) — what the receiver does with the invoice - `forma_pago` (c_FormaPago) — cash, transfer, card, … - `metodo_pago` (c_MetodoPago) — PUE vs PPD - `tipo_comprobante` (c_TipoDeComprobante) — I/E/T/N/P - `objeto_imp` (c_ObjetoImp) — whether a line item is subject to tax (CFDI 4.0) - `impuestos` (c_Impuesto) — ISR / I…

ParameterTypeDescription
catalog *stringWhich catalogue to read.
querystringAn exact code ('626', 'G03', '012') or free text to search ('confianza', 'BBVA', 'Oaxaca'). Omit for the whole catalogue.
response_formatstringOutput format: 'markdown' for a human-readable summary (default) or 'json' for the full structured payload.