Docs
MCP serverAvailable tools

Get document file

Retrieve one document file as an MCP binary resource. Use preview_pdf to render an unstamped CFDI draft before stamping; the preview has no fiscal validity. CFDIs also support pdf, xml, zip, cancellation_pdf, and cancellation_xml; withholdings support pdf, xml, and zip; sales receipts and quotes support pdf; declarations support pdf, payment_pdf, and full_pdf; opinions support pdf.

MCP toolget_document_file

Purpose

Retrieve one available document file as an MCP binary resource.

Use when
You have a public documentRef and need an available file, including a preview_pdf for an unstamped CFDI draft.
Do not use when
You need document metadata or a file for an unsupported document family.
Required permissions
invoices:read / receipts:read / quotes:read / sat:read
Side effects
None
Idempotency
Idempotent

Input schema

JSON Schema
{  "type": "object",  "$schema": "http://json-schema.org/draft-07/schema#",  "anyOf": [    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^cfdi:.+$",          "description": "CFDI documentRef returned by search_documents"        },        "file": {          "type": "string",          "enum": [            "pdf",            "xml",            "zip",            "preview_pdf",            "cancellation_pdf",            "cancellation_xml"          ]        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    },    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^withholding:.+$",          "description": "Withholding documentRef returned by search_documents"        },        "file": {          "type": "string",          "enum": [            "pdf",            "xml",            "zip"          ]        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    },    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^sales_receipt:.+$"        },        "file": {          "type": "string",          "const": "pdf"        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    },    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^quote:.+$"        },        "file": {          "type": "string",          "const": "pdf"        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    },    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^declaration:.+$"        },        "file": {          "type": "string",          "enum": [            "pdf",            "payment_pdf",            "full_pdf"          ]        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    },    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^tax_compliance_opinion:.+$"        },        "file": {          "type": "string",          "const": "pdf"        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    }  ]}

Related workflow

See the canonical workflows in the introduction

Related tools