
Mcp Cfdi Mx
io.github.cmendezs由 GitHub 账号 cmendezs 发布v0.4.1更新于 Oct 27, 2026
MCP server for Mexican electronic invoicing (CFDI 4.0, Pagos 2.0)
概览
本地 MCP 服务器,让助手构建、按 XSD 校验并数字签署墨西哥 CFDI 4.0 发票与 Pagos 2.0 付款补充件。
- 可以做什么
- 根据结构化输入生成 CFDI 4.0 的 Ingreso 或 Egreso 凭证 XML,以及 Pagos 2.0 付款补充件
- 按 SAT 的 XSD 架构校验文档,包括 TFD 与 Pagos 补充件
- 使用开票方的 CSD 计算数字签章,可选择本地签署或交由 PAC 签署
- 解析 PAC 返回的 Timbre Fiscal Digital 印章,并在提供 PAC 证书时进行加密验证
- 查询当前支持的文档类型、补充件与签署模式
- 适用场景
- 适用于处理墨西哥电子发票的场景:希望助手在把 CFDI 4.0 文档交给 PAC 之前,先在本地起草、校验或签署。适合开发者和财务团队搭建开票流程,不适合需要端到端盖章或提交的用户。
- 运行要求
- 以 Python 包形式在本地运行(pip install mcp-cfdi-mx 或 uvx mcp-cfdi-mx),通过 stdio 通信;需要 Claude Desktop、Cursor、Kiro 等桌面客户端。无需环境变量。CSD 证书与私钥路径及其密码通过工具参数传入。
安装
在 SourceWeft 中
- 打开 控制台中的 Mcp Cfdi Mx,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
mcp-cfdi-mx 🇲🇽
[License] [PyPI version] [Python] [mcp-cfdi-mx MCP server]
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.
Installation
Via PyPI (recommended)
Or without prior installation using uvx:
From source
Configuration (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:
Cursor integration
Cursor supports MCP servers via stdio. Add the configuration to:
- Globally (all projects):
~/.cursor/mcp.json - Per project (this repository only):
.cursor/mcp.json
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.json - Workspace:
.kiro/settings/mcp.json
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
Validate and seal
Scope
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).
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.
Vendor neutrality
This server implements the standard itself: it builds, validates, and signs the document locally. It is not a client for a commercial invoicing platform, and your signing keys and credentials never leave your own infrastructure.
A PAC (Proveedor Autorizado de Certificación) must stamp the CFDI; this server seals it locally with your own CSD and hands any PAC an already-sealed document.
Supported standards
See specs/README.md for the full source bundle and retrieval dates.
Tests
Contributing
Contributions are welcome — see CONTRIBUTING.md for guidelines.
Other e-invoicing MCP servers
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.
来源:README.md,提交 477ab53
工具
0版本历史
1- v0.4.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分