CRATEAPI

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 — hosted by us, or run it yourself. 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_invoicefree

Checks 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 key

Best-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 key

Builds a compliant invoice XML (UBL or CII) from a structured JSON invoice model — seller, buyer, lines, totals.

convert_invoiceneeds API key

Converts 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

Two ways to connect — the same four tools either way.

Hosted endpoint

Add the URL straight to your MCP client's config. Nothing to install, nothing to keep running. validate_invoice works with no key at all; the other three read the X-API-Key header.

{"mcpServers": {"crateapi-einvoicing": {
    "type": "http", "url": "https://api.crateapi.com/mcp",
    "headers": {"X-API-Key": "your-key-here"}}}}

The exact field names for type/url/headers vary a little between MCP clients (Claude Desktop, Claude Code, Cursor…) — adjust to match yours. Validating over the hosted endpoint without a key is fair-use rate-limited per IP, same as the free validator on this site (10/min · 50/day · 200/month); a valid API key skips that limit and falls under your plan's quota instead.

Self-hosted

Prefer to run it yourself — for privacy, an air-gapped environment, or local development? It's still a single Python process, calling the same production API with your own key:

{"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.

Both are the real thing. The hosted endpoint runs the exact same tool code as the self-hosted process — same rules, same limits, same responses. Use the hosted URL for zero setup, or self-hosted for full local control.

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.

Validate your e-invoice freeNo signup. Paste or upload, get the report instantly.
Open the validator →