{
  "markdown": "# mcp-cfdi-mx 🇲🇽\n\n[English](README.md) | [Español](README.es-MX.md)\n\n<!-- mcp-name: io.github.cmendezs/mcp-cfdi-mx -->\n\n![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)\n[![PyPI version](https://img.shields.io/pypi/v/mcp-cfdi-mx.svg)](https://pypi.org/project/mcp-cfdi-mx/)\n[![Python](https://img.shields.io/pypi/pyversions/mcp-cfdi-mx.svg)](https://pypi.org/project/mcp-cfdi-mx/) [![mcp-cfdi-mx MCP server](https://glama.ai/mcp/servers/cmendezs/mcp-cfdi-mx/badges/score.svg)](https://glama.ai/mcp/servers/cmendezs/mcp-cfdi-mx)\n\nA 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.\n\n**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](#available-tools) for exactly what is implemented today.\n\n---\n\n## Introduction\n\nThis package is built on [**mcp-einvoicing-core**](https://github.com/cmendezs/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).\n\n`mcp-einvoicing-core` is installed automatically as a dependency, no additional step is required.\n\nCFDI 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.\n\n## Installation\n\n### Via PyPI (recommended)\n\n```bash\npip install mcp-cfdi-mx\n```\n\nOr without prior installation using `uvx`:\n\n```bash\nuvx mcp-cfdi-mx\n```\n\n### From source\n\n```bash\ngit clone https://github.com/cmendezs/mcp-cfdi-mx.git\ncd mcp-cfdi-mx\nuv sync --all-extras\n```\n\n## Configuration (environment variables)\n\nThis package has no required environment variables. CSD certificate/key paths and passwords\nare passed as tool arguments (file paths or environment references — never plaintext key\nmaterial embedded in a request), not read from a fixed environment variable name.\n\n## Claude Desktop integration\n\nAdd the following configuration to your `claude_desktop_config.json` file:\n\n```json\n{\n  \"mcpServers\": {\n    \"cfdi-mx\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-cfdi-mx\"]\n    }\n  }\n}\n```\n\n## Cursor integration\n\nCursor supports MCP servers via stdio. Add the configuration to:\n- **Globally** (all projects): `~/.cursor/mcp.json`\n- **Per project** (this repository only): `.cursor/mcp.json`\n\n```json\n{\n  \"mcpServers\": {\n    \"cfdi-mx\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-cfdi-mx\"]\n    }\n  }\n}\n```\n\nReload the Cursor window (`Ctrl+Shift+P` → *Reload Window*) after saving changes.\n\n## Kiro integration\n\nKiro supports MCP servers through a dedicated configuration file:\n- **Globally**: `~/.kiro/settings/mcp.json`\n- **Workspace**: `.kiro/settings/mcp.json`\n\n```json\n{\n  \"mcpServers\": {\n    \"cfdi-mx\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-cfdi-mx\"],\n      \"disabled\": false,\n      \"autoApprove\": []\n    }\n  }\n}\n```\n\n> **Security tip**: if a future tool version accepts credentials via environment reference,\n> use the syntax `\"VAR_NAME\": \"${VAR_NAME}\"` so Kiro resolves it from the shell rather than\n> storing it in plaintext.\n\n## Available tools\n\n### Build\n\n| Tool | Description |\n|------|-------------|\n| `mx__build_cfdi` | Build a well-formed, unsealed CFDI 4.0 `Comprobante` XML (Ingreso or Egreso) from structured input |\n| `mx__build_pago` | Build a Complemento de Pagos 2.0 CFDI (`TipoDeComprobante=\"P\"`), composing the fixed single-`Concepto` wrapper SAT's guide mandates |\n\n### Validate and seal\n\n| Tool | Description |\n|------|-------------|\n| `mx__validate_cfdi` | Full XSD validation against `cfdv40.xsd`, plus `TimbreFiscalDigitalv11.xsd.xml` and/or `Pagos20.xsd.xml` when those complements are present |\n| `mx__seal_cfdi` | Compute the Sello Digital via `SelloDigitalSigner`, `sealing_mode`-aware (`\"local\"` \\| `\"pac\"`) |\n| `mx__verify_tfd` | Parse a PAC-returned Timbre Fiscal Digital 1.1 stamp, and cryptographically verify `SelloSAT` when the PAC's certificate is supplied |\n\n### Scope\n\n| Tool | Description |\n|------|-------------|\n| `mx__get_supported_scope` | Returns the CFDI document types, complementos, and sealing modes this package currently supports |\n\nSee [`docs/TOOLS.md`](docs/TOOLS.md) for the full parameter reference of every tool, generated from the live tool registry.\n\n### Not yet implemented\n\nPAC 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).\n\n## Architecture\n\n`mcp_cfdi_mx.models.CFDIComprobante` extends `mcp_einvoicing_core.models.InvoiceDocument` (the\nnon-EN 16931 pathway — CFDI predates and has no lineage to CEN TC 434, the same determination\nas `mcp-nfe-br`). RFC validation for both Emisor and Receptor routes through\n`TaxIdentifier.validate_mx_rfc` (core). Sealing routes through\n`mcp_einvoicing_core.digital_signature.SelloDigitalSigner`, the MX-specific concrete\nimplementation of core's `BaseDocumentSigner` — the same pattern ES (XAdES), BR (XML-DSig),\nand IT (CAdES) use for their own signature standards.\n\n```text\n[ ERP System / Application ] <--> [ MCP Server ] <--> [ PAC (any, PAC-agnostic) / SAT ]\n          ^                           |\n          |                           v\n   [ AI Agent (Claude) ] <--- (CFDI 4.0 / Pagos 2.0)\n```\n\n## Supported standards\n\n| Standard | Version | Source |\n|---|---|---|\n| CFDI (Comprobante Fiscal Digital por Internet) | 4.0 | SAT Anexo 20, DOF 2022-01-13 |\n| Timbre Fiscal Digital | 1.1 | SAT |\n| Complemento de Pagos | 2.0 | SAT |\n\nSee [`specs/README.md`](specs/README.md) for the full source bundle and retrieval dates, and\n[`context-library/countries/mx.md`](https://github.com/cmendezs/mcp-einvoicing/blob/main/context-library/countries/mx.md)\nin the workspace root repo for the verified compliance reference.\n\n## Tests\n\n```bash\nuv run pytest tests/ -v\n```\n\n## Contributing\n\nContributions are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## Other e-invoicing MCP servers\n\n| Country | Server |\n|---------|--------|\n| 🌍 Global | [mcp-einvoicing-core](https://github.com/cmendezs/mcp-einvoicing-core) |\n| 🇦🇪 United Arab Emirates | [mcp-einvoicing-ae](https://github.com/cmendezs/mcp-einvoicing-ae) |\n| 🇧🇪 Belgium | [mcp-einvoicing-be](https://github.com/cmendezs/mcp-einvoicing-be) |\n| 🇧🇷 Brazil | [mcp-nfe-br](https://github.com/cmendezs/mcp-nfe-br) |\n| 🇫🇷 France | [mcp-facture-electronique-fr](https://github.com/cmendezs/mcp-facture-electronique-fr) |\n| 🇩🇪 Germany | [mcp-einvoicing-de](https://github.com/cmendezs/mcp-einvoicing-de) |\n| 🇮🇹 Italy | [mcp-fattura-elettronica-it](https://github.com/cmendezs/mcp-fattura-elettronica-it) |\n| 🇲🇽 Mexico | [mcp-cfdi-mx](https://github.com/cmendezs/mcp-cfdi-mx) |\n| 🇵🇱 Poland | [mcp-ksef-pl](https://github.com/cmendezs/mcp-ksef-pl) |\n| 🇸🇬 Singapore | [mcp-invoicenow-sg](https://github.com/cmendezs/mcp-invoicenow-sg) |\n| 🇪🇸 Spain | [mcp-facturacion-electronica-es](https://github.com/cmendezs/mcp-facturacion-electronica-es) |\n\n## License\n\nThis project is distributed under the **Apache 2.0** license.\nSee the [LICENSE](LICENSE) file for details. For the full version history, see [CHANGELOG.md](CHANGELOG.md).\n",
  "bytes": 8260,
  "sha": "f04afae04f93c2d6b31db12dd74cb25439677787edfc1efc2236b4aec15454e0",
  "repo_slug": "cmendezs/mcp-cfdi-mx",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cmendezs_mcp_cfdi_mx_992f81fb/readme"
}