MCP Server
Give Claude, Cursor or any MCP-capable AI agent direct access to e-invoicing — validate, repair, generate and convert EU invoices from inside a conversation, with no separate integration to write.
What it is
CrateAPI ships a Model Context Protocol (MCP) server for the e-invoicing API. Point an MCP-capable agent — Claude Desktop, Claude Code, Cursor, or your own agent loop — at it, and it gets four tools it can call directly: validate an invoice, repair one, generate one from structured data, or convert between UBL and CII syntax. The agent reads the tool descriptions and decides when to use them; the actual invoice logic runs on the same deterministic API behind the rest of CrateAPI.
Tools available
Four tools, one process. Each one proxies to the exact same public API you can call over HTTP — same rules, same limits, same responses.
validate_invoicefreeChecks an invoice XML (UBL or CII) against the official EN 16931, Peppol BIS, XRechnung, RO_CIUS and BR-FR rules. Returns a structured report — valid or not, error/warning counts, findings. No API key needed.
repair_invoiceneeds API keyBest-effort auto-repair: fixes non-ISO date formats and totals that don't add up, recalculated from the line items. Never invents missing business data — reports what it could and couldn't fix.
generate_invoiceneeds API keyBuilds a compliant invoice XML (UBL or CII) from a structured JSON invoice model — seller, buyer, lines, totals.
convert_invoiceneeds API keyConverts an invoice between UBL and CII syntax, lossless-or-rejected: if something can't convert cleanly, it fails with a clear reason instead of silently dropping data.
How you run it
Self-hosted, works today with your own API key. Add this to your MCP client's config — Claude Desktop, Claude Code, Cursor, or any other MCP-capable agent:
{"mcpServers": {"crateapi-einvoicing": { "command": "python", "args": ["-m", "einvoicing.mcp_server"], "env": {"EINVOICE_API_KEY": "your-key-here"}}}}
validate_invoice needs no key at all. The other three read EINVOICE_API_KEY from the environment — get one on the pricing page. EINVOICE_API_BASE can override the target API, useful for pointing at a local or staging instance.
Self-hosted, today. There's no hosted mcp.crateapi.com endpoint yet — you run the server yourself, a single Python process (python -m einvoicing.mcp_server), and it calls the same production API with your own key. If enough people need a hosted version, we'll build one; for now, this is the honest state of things.
Why it matters
AI agents increasingly draft, review and file business documents. If yours can call these tools directly, it can validate an invoice before it's sent, or generate a compliant one on request, instead of getting the format wrong and finding out from a rejection days later. The engine behind the tools is the same one behind the rest of CrateAPI — deterministic, zero LLM at runtime (see Trust & Security) — the agent decides when to call a tool, the invoice rules themselves stay rule-based, never guessed.
Want to see it for yourself?
Every tool above calls the same API you can call today — read the full reference, or try the free validator with your own invoice.