About mcp-facturapi
mcp-facturapi is an MCP server for FacturAPI, a Mexican CFDI e-invoicing platform. It supports issuing, cancelling and emailing invoices, and managing customers and products. The server runs over both stdio and HTTP transports.
Key features
- 01CFDI invoice creation, lookup and cancellation
- 02PDF and XML invoice download links
- 03Invoice delivery by email
- 04Customer and product create, read, update and delete
- 05Receipt creation and listing
Use cases
- 01Issuing CFDI invoices for Mexican customers from an AI agent
- 02Listing invoices and retrieving PDF or XML files
- 03Maintaining customer and product records used for invoicing
MCP support
The server exposes 20 tools over MCP that call FacturAPI's invoice, customer, product and receipt endpoints.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
npx -y @codespar/mcp-facturapiFACTURAPI_API_KEYSecretAPI key for FacturAPILocal servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
20Saved tool list · updated 2w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| use | string | No | CFDI use code (e.g. G01=acquisition, G03=expenses, P01=to_be_defined) |
| items | array | Yes | Invoice line items |
| series | string | No | Invoice series |
| customer | string | Yes | Customer ID |
| folio_number | number | No | Invoice folio number |
| payment_form | string | Yes | SAT payment form code (e.g. 01=cash, 03=transfer, 04=credit_card) |
| payment_method | string | No | PUE (single payment) or PPD (deferred) |
Details
From the project READMEMCP FacturAPI
MCP server for FacturAPI — Mexican CFDI e-invoicing platform (equivalent to Brazil's NFe).
Quick Start
# Set your API key
export FACTURAPI_API_KEY="sk_..."
# Run via stdio
npx tsx packages/mexico/facturapi/src/index.ts
# Run via HTTP
npx tsx packages/mexico/facturapi/src/index.ts --http
Environment Variables
| Variable | Required | Description |
|---|---|---|
FACTURAPI_API_KEY | Yes | API key from FacturAPI dashboard |
MCP_HTTP | No | Set to "true" to enable HTTP transport |
MCP_PORT | No | HTTP port (default: 3000) |
Tools (20)
| Tool | Purpose |
|---|---|
create_invoice | Create a CFDI invoice |
get_invoice | Get invoice by ID |
list_invoices | List invoices with filters |
cancel_invoice | Cancel an invoice |
download_invoice_pdf | Download invoice as PDF (returns download URL) |
download_invoice_xml | Download invoice as XML (returns download URL) |
send_invoice_email | Send invoice (PDF + XML) by email to the customer or to specific recipients |
create_customer | Create a customer for invoicing |
get_customer | Get customer by ID |
list_customers | List customers with optional filters |
update_customer | Update an existing customer (partial update) |
delete_customer | Delete a customer |
create_product | Create a product for invoicing |
get_product | Get product by ID |
list_products | List products |
update_product | Update an existing product (partial update) |
delete_product | Delete a product |
create_receipt | Create a receipt (recibo de venta) — the customer can later self-invoice it from the receipt's folio |
list_receipts | List receipts with filters |
list_webhooks | List configured webhooks |
Auth
Uses Bearer token authentication. Obtain your API key from the FacturAPI Dashboard.
API Reference
Enterprise
Need governance, budget limits, and audit trails for agent payments? CodeSpar Enterprise adds policy engine, payment routing, and compliance templates on top of these MCP servers.
Authentication
Set these environment variables before launching the server:
FACTURAPI_API_KEY(required, secret) — API key for FacturAPI
Issue credentials at the provider's developer portal: https://docs.facturapi.io.
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.