MCP serverAvailable tools
Create CFDI draft
Create a CFDI draft with canonical tax validation. Payment complements accept automatic taxes for known CFDIs or caller-provided taxObject and payment-level tax entries for external CFDIs. This tool never stamps.
MCP tool
create_cfdi_draftPurpose
Create a tax-validated CFDI draft for income, credit note, transfer, payroll, or payment-complement flows.
- Use when
- You need to author a CFDI before SAT stamping.
- Do not use when
- The document is a withholding or sales receipt.
- Required permissions
- Side effects
- External side effect
- Idempotency
- Idempotent
Input schema
JSON Schema{ "type": "object", "properties": { "idempotencyKey": { "type": "string", "minLength": 1, "maxLength": 200, "description": "Unique retry key for this exact operation. Reuse it only when retrying the same request." }, "input": { "oneOf": [ { "type": "object", "properties": { "pdfCustomSection": { "$ref": "#/definitions/__schema0" }, "currency": { "$ref": "#/definitions/__schema1" }, "customerId": { "$ref": "#/definitions/__schema2" }, "items": { "$ref": "#/definitions/__schema3" }, "kind": { "$ref": "#/definitions/__schema7" }, "cfdiUse": { "$ref": "#/definitions/__schema8" }, "payment": { "$ref": "#/definitions/__schema9" } }, "required": [ "customerId", "items", "kind", "cfdiUse", "payment" ], "additionalProperties": false, "title": "CFDI I · income" }, { "type": "object", "properties": { "pdfCustomSection": { "$ref": "#/definitions/__schema0" }, "currency": { "$ref": "#/definitions/__schema1" }, "customerId": { "$ref": "#/definitions/__schema2" }, "items": { "$ref": "#/definitions/__schema3" }, "kind": { "$ref": "#/definitions/__schema12" }, "formCode": { "$ref": "#/definitions/__schema10" }, "methodCode": { "$ref": "#/definitions/__schema13" }, "relatedDocuments": { "$ref": "#/definitions/__schema14" } }, "required": [ "customerId", "items", "kind", "formCode", "relatedDocuments" ], "additionalProperties": false, "title": "CFDI E · credit_note" }, { "type": "object", "properties": { "pdfCustomSection": { "$ref": "#/definitions/__schema0" }, "currency": { "$ref": "#/definitions/__schema1" }, "customerId": { "$ref": "#/definitions/__schema2" }, "items": { "$ref": "#/definitions/__schema3" }, "kind": { "$ref": "#/definitions/__schema17" } }, "required": [ "customerId", "items", "kind" ], "additionalProperties": false, "title": "CFDI T · transfer" }, { "type": "object", "properties": { "pdfCustomSection": { "$ref": "#/definitions/__schema0" }, "currency": { "$ref": "#/definitions/__schema1" }, "kind": { "$ref": "#/definitions/__schema18" }, "employeeId": { "$ref": "#/definitions/__schema19" }, "payroll": { "$ref": "#/definitions/__schema20" } }, "required": [ "kind", "employeeId", "payroll" ], "additionalProperties": false, "title": "CFDI N · payroll" }, { "type": "object", "properties": { "pdfCustomSection": { "$ref": "#/definitions/__schema0" }, "kind": { "$ref": "#/definitions/__schema22" }, "customerId": { "$ref": "#/definitions/__schema23" }, "payment": { "$ref": "#/definitions/__schema24" } }, "required": [ "kind", "customerId", "payment" ], "additionalProperties": false, "title": "CFDI P · payment_complement" } ] } }, "required": [ "idempotencyKey", "input" ], "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { "__schema0": { "type": "string" }, "__schema1": { "type": "string", "minLength": 3, "maxLength": 3 }, "__schema2": { "type": "string", "minLength": 1 }, "__schema3": { "minItems": 1, "type": "array", "items": { "$ref": "#/definitions/__schema4" } }, "__schema4": { "oneOf": [ { "$ref": "#/definitions/__schema5" }, { "$ref": "#/definitions/__schema6" } ] }, "__schema5": { "type": "object", "properties": { "kind": { "type": "string", "const": "product" }, "productId": { "type": "string", "minLength": 1, "description": "Existing Exac product ID" }, "quantity": { "type": "number", "exclusiveMinimum": 0 }, "unitPrice": { "type": "number", "minimum": 0, "description": "Unit price in pesos" }, "discount": { "type": "number", "minimum": 0 }, "taxIncluded": { "type": "boolean" } }, "required": [ "kind", "productId", "quantity", "unitPrice" ], "additionalProperties": false }, "__schema6": { "type": "object", "properties": { "kind": { "type": "string", "const": "custom" }, "description": { "type": "string", "minLength": 1 }, "quantity": { "type": "number", "exclusiveMinimum": 0 }, "unitPrice": { "type": "number", "minimum": 0, "description": "Unit price in pesos" }, "satProductCode": { "type": "string", "minLength": 1, "description": "SAT product/service code" }, "satUnitCode": { "type": "string", "minLength": 1, "description": "SAT unit code" }, "discount": { "type": "number", "minimum": 0 }, "taxIncluded": { "type": "boolean" }, "taxRate": { "type": "number", "minimum": 0, "maximum": 1 }, "taxability": { "type": "string", "enum": [ "standard", "zero", "exempt" ] } }, "required": [ "kind", "description", "quantity", "unitPrice", "satProductCode", "satUnitCode" ], "additionalProperties": false }, "__schema7": { "type": "string", "const": "income" }, "__schema8": { "type": "string", "enum": [ "G01", "D06", "I07", "I06", "I01", "I05", "D09", "G02", "D04", "I04", "I03", "D08", "G03", "D03", "D02", "D01", "D05", "I02", "CN01", "I08", "CP01", "D10", "D07", "S01" ], "description": "Active SAT CFDI-use code.", "x-exac-sat-catalog": "cfdi-uses" }, "__schema9": { "oneOf": [ { "type": "object", "properties": { "timing": { "type": "string", "const": "single_payment" }, "formCode": { "$ref": "#/definitions/__schema10" }, "conditions": { "type": "string", "maxLength": 1000 } }, "required": [ "timing", "formCode" ], "additionalProperties": false }, { "type": "object", "properties": { "timing": { "type": "string", "const": "deferred_or_installments" }, "formCode": { "type": "string", "const": "99" }, "dueDate": { "description": "Calendar date in YYYY-MM-DD format", "allOf": [ { "$ref": "#/definitions/__schema11" } ] }, "settlementTerms": { "type": "object", "properties": { "installmentCount": { "type": "integer", "minimum": 1, "maximum": 60 }, "firstDue": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "transaction_date" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "months_after_transaction" }, "months": { "type": "integer", "minimum": 1, "maximum": 60 } }, "required": [ "kind", "months" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "fixed_date" }, "date": { "type": "string" } }, "required": [ "kind", "date" ], "additionalProperties": false } ] }, "recurrence": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "anchor_day" } }, "required": [ "kind" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "day_of_month" }, "day": { "type": "integer", "minimum": 1, "maximum": 31 } }, "required": [ "kind", "day" ], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "last_day" } }, "required": [ "kind" ], "additionalProperties": false } ] } }, "required": [ "installmentCount", "firstDue", "recurrence" ], "additionalProperties": false }, "conditions": { "type": "string", "maxLength": 1000 } }, "required": [ "timing", "formCode" ], "additionalProperties": false } ] }, "__schema10": { "type": "string", "enum": [ "12", "13", "14", "15", "17", "23", "24", "25", "26", "27", "28", "29", "30", "31", "99", "02", "06", "01", "05", "04", "03", "08" ], "description": "Active SAT payment-form code.", "x-exac-sat-catalog": "payment-forms" }, "__schema11": { "type": "string", "format": "date", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" }, "__schema12": { "type": "string", "const": "credit_note" }, "__schema13": { "type": "string", "enum": [ "PPD", "PUE" ], "description": "Active SAT payment-method code. Defaults to PUE when omitted.", "x-exac-sat-catalog": "payment-methods" }, "__schema14": { "minItems": 1, "type": "array", "items": { "$ref": "#/definitions/__schema15" } }, "__schema15": { "type": "object", "properties": { "relationship": { "type": "string", "enum": [ "07", "03", "06", "01", "02", "04", "05" ], "description": "Active SAT CFDI relationship-type code.", "x-exac-sat-catalog": "relationship-types" }, "documents": { "minItems": 1, "type": "array", "items": { "$ref": "#/definitions/__schema16" }, "description": "Related CFDI UUIDs" } }, "required": [ "relationship", "documents" ], "additionalProperties": false }, "__schema16": { "type": "string", "minLength": 1 }, "__schema17": { "type": "string", "const": "transfer" }, "__schema18": { "type": "string", "const": "payroll" }, "__schema19": { "type": "string", "minLength": 1 }, "__schema20": { "type": "object", "properties": { "paidOn": { "$ref": "#/definitions/__schema11" }, "periodStartedOn": { "allOf": [ { "$ref": "#/definitions/__schema11" } ] }, "periodEndedOn": { "allOf": [ { "$ref": "#/definitions/__schema11" } ] }, "paidDays": { "type": "number", "exclusiveMinimum": 0 }, "employee": { "type": "object", "properties": { "curp": { "type": "string", "minLength": 1 }, "employeeNumber": { "type": "string", "minLength": 1 }, "socialSecurityNumber": { "type": "string", "minLength": 1 }, "employmentStartedOn": { "$ref": "#/definitions/__schema11" }, "contractType": { "type": "string", "enum": [ "10", "99", "01", "02", "03", "04", "05", "06", "07", "08", "09" ], "description": "Active SAT payroll contract-type code.", "x-exac-sat-catalog": "payroll-contract-types" }, "regimeType": { "type": "string", "enum": [ "10", "11", "12", "13", "99", "02", "03", "04", "05", "06", "07", "08", "09" ], "description": "Active SAT payroll regime-type code.", "x-exac-sat-catalog": "payroll-regime-types" }, "paymentFrequency": { "type": "string", "enum": [ "10", "99", "01", "02", "03", "04", "05", "06", "07", "08", "09" ], "description": "Active SAT payroll payment-frequency code.", "x-exac-sat-catalog": "payroll-payment-frequencies" }, "stateCode": { "type": "string", "enum": [ "AGU", "BCN", "BCS", "CAM", "CHP", "CHH", "COA", "COL", "CMX", "DUR", "GUA", "GRO", "HID", "JAL", "MEX", "MIC", "MOR", "NAY", "NLE", "OAX", "PUE", "QUE", "ROO", "SLP", "SIN", "SON", "TAB", "TAM", "TLA", "VER", "YUC", "ZAC" ], "description": "Active SAT federal-entity code.", "x-exac-sat-catalog": "federal-entities" }, "positionRisk": { "type": "string", "enum": [ "1", "2", "3", "4", "5", "99" ], "description": "Active SAT payroll position-risk code.", "x-exac-sat-catalog": "payroll-position-risks" }, "integratedDailySalary": { "type": "number", "exclusiveMinimum": 0 } }, "required": [ "curp", "employeeNumber", "employmentStartedOn", "contractType", "regimeType", "paymentFrequency", "stateCode" ], "additionalProperties": false }, "earnings": { "minItems": 1, "type": "array", "items": { "$ref": "#/definitions/__schema21" } }, "deductions": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1, "description": "SAT deduction type code" }, "amount": { "type": "number", "exclusiveMinimum": 0 } }, "required": [ "type", "amount" ], "additionalProperties": false } }, "otherPayments": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "999", "001", "002", "003", "004", "005", "006", "007", "008", "009" ], "description": "Active SAT payroll other-payment code.", "x-exac-sat-catalog": "payroll-other-payment-types" }, "amount": { "type": "number", "exclusiveMinimum": 0 }, "employmentSubsidy": { "type": "number", "minimum": 0 } }, "required": [ "type", "amount" ], "additionalProperties": false } } }, "required": [ "paidOn", "employee", "earnings" ], "additionalProperties": false }, "__schema21": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "001", "002", "003", "004", "005", "006", "009", "010", "011", "012", "013", "014", "015", "019", "020", "021", "022", "023", "024", "025", "026", "027", "028", "029", "030", "031", "032", "033", "034", "035", "036", "037", "038", "039", "044", "045", "046", "047", "048", "049", "050", "051", "052", "053" ], "description": "Active SAT payroll earning-type code.", "x-exac-sat-catalog": "payroll-earning-types" }, "taxableAmount": { "type": "number", "minimum": 0 }, "exemptAmount": { "type": "number", "minimum": 0 } }, "required": [ "type", "taxableAmount", "exemptAmount" ], "additionalProperties": false }, "__schema22": { "type": "string", "const": "payment_complement" }, "__schema23": { "type": "string", "minLength": 1 }, "__schema24": { "type": "object", "properties": { "formCode": { "$ref": "#/definitions/__schema10" }, "paidLocalDateTime": { "type": "string", "pattern": "^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d{1,9}))?$" }, "documents": { "minItems": 1, "type": "array", "items": { "$ref": "#/definitions/__schema25" } } }, "required": [ "formCode", "documents" ], "additionalProperties": false }, "__schema25": { "type": "object", "properties": { "uuid": { "$ref": "#/definitions/__schema26" }, "amount": { "$ref": "#/definitions/__schema27" }, "installment": { "$ref": "#/definitions/__schema28" }, "previousBalance": { "$ref": "#/definitions/__schema29" }, "series": { "$ref": "#/definitions/__schema30" }, "folio": { "$ref": "#/definitions/__schema31" }, "currency": { "$ref": "#/definitions/__schema32" }, "exchangeRate": { "$ref": "#/definitions/__schema33" }, "taxes": { "$ref": "#/definitions/__schema34" } }, "required": [ "uuid", "amount", "installment", "previousBalance", "taxes" ], "additionalProperties": false }, "__schema26": { "type": "string", "minLength": 1 }, "__schema27": { "type": "number", "exclusiveMinimum": 0 }, "__schema28": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991, "description": "1-based payment sequence" }, "__schema29": { "type": "number", "exclusiveMinimum": 0, "description": "Balance before payment; then use prior remaining balance" }, "__schema30": { "type": "string" }, "__schema31": { "type": "string" }, "__schema32": { "type": "string", "minLength": 3, "maxLength": 3 }, "__schema33": { "type": "number", "exclusiveMinimum": 0 }, "__schema34": { "anyOf": [ { "$ref": "#/definitions/__schema35" }, { "$ref": "#/definitions/__schema36" } ], "description": "Use auto for known CFDIs; otherwise send taxObject and rows" }, "__schema35": { "type": "string", "const": "auto", "description": "Let Exac calculate payment-level taxes from a related CFDI already known to the organization" }, "__schema36": { "type": "object", "properties": { "taxObject": { "$ref": "#/definitions/__schema37" }, "entries": { "$ref": "#/definitions/__schema38" } }, "required": [ "taxObject", "entries" ], "additionalProperties": false, "description": "Taxes for an external CFDI Exac cannot inspect" }, "__schema37": { "type": "string", "enum": [ "01", "02", "03", "04", "05", "06", "07", "08" ], "description": "SAT ObjetoImpDR from the related CFDI" }, "__schema38": { "type": "array", "items": { "$ref": "#/definitions/__schema39" }, "description": "Payment-level tax rows from the related CFDI" }, "__schema39": { "type": "object", "properties": { "base": { "$ref": "#/definitions/__schema40" }, "type": { "$ref": "#/definitions/__schema41" }, "rate": { "$ref": "#/definitions/__schema42" }, "factor": { "$ref": "#/definitions/__schema43" }, "withholding": { "$ref": "#/definitions/__schema44" } }, "required": [ "base", "type", "rate" ], "additionalProperties": false }, "__schema40": { "type": "number", "minimum": 0 }, "__schema41": { "type": "string", "enum": [ "IVA", "ISR", "IEPS" ] }, "__schema42": { "type": "number", "minimum": 0 }, "__schema43": { "type": "string", "enum": [ "Tasa", "Cuota", "Exento" ] }, "__schema44": { "type": "boolean" } }}Output schema
JSON Schema{ "type": "object", "properties": { "data": { "type": "object", "properties": { "documentRef": { "type": "string", "pattern": "^cfdi:.+$" }, "kind": { "type": "string", "enum": [ "income", "credit_note", "transfer", "payroll", "payment_complement" ] }, "status": { "type": "string", "const": "draft" } }, "required": [ "documentRef", "kind", "status" ], "additionalProperties": false }, "error": { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "code": { "type": "string", "enum": [ "validation_error", "unauthenticated", "forbidden", "not_found", "method_not_allowed", "conflict", "idempotency_conflict", "operation_in_progress", "recovery_required", "rate_limited", "provider_unavailable", "internal" ] }, "message": { "type": "string" }, "details": { "type": "object", "properties": { "issues": { "type": "array", "items": { "type": "object", "properties": { "path": { "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "number" } ] } }, "message": { "type": "string" }, "code": { "type": "string" } }, "required": [ "path", "message" ], "additionalProperties": false } }, "retryable": { "type": "boolean" }, "retryAfterSeconds": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 } }, "additionalProperties": false } }, "required": [ "code", "message" ], "additionalProperties": false } }, "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "oneOf": [ { "required": [ "data" ] }, { "required": [ "error" ] } ]}Related workflow
See the canonical workflows in the introductionRelated tools
Create withholding document
Create and immediately stamp a SAT withholding document. Each tax entry uses business names for tax and paymentType; withholdingTypeCode is the explicit SAT catalog code. This operation has no draft mode.
Update CFDI draft
Fully replace the contents of an existing CFDI draft. The semantic kind must match the draft; changing fiscal kind requires archiving the old draft and creating a new draft.