
beliq-mcp
io.github.beliq-eu/beliq-mcp
Validate, parse, generate and convert EU e-invoices (XRechnung, ZUGFeRD, Factur-X, Peppol BIS).
Documentation
beliq-mcp
An MCP server for the beliq e-invoice API. It lets MCP clients (Claude Desktop, Claude Code, Cursor, and others) validate, parse, generate, and convert electronic invoices (XRechnung, ZUGFeRD, Factur-X, Peppol BIS, and the other formats the API carries), and explain exactly what fails. Every verdict carries the check depth the API states for it, or says that none was stated.
beliq covers three steps of an e-invoice: generate, validate, and deliver (in development). This server runs the first two and also parses and converts documents; no tool sends or files an invoice. Until delivery through beliq is available, transmission (Peppol, plateforme agréée, SDI) and tax-authority reporting stay with your access point. Archiving stays with you, and beliq does not operate KSeF submission.
Tools
beliq_validate_einvoice- validate an invoice XML (inline or by file path) or a Factur-X/ZUGFeRD PDF (by file path). Returns the verdict, how deep the check went, the detected format and profile, the ruleset versions it was checked against, and every error and warning with its rule id, severity, location, and message. For a PDF the verdict is about the embedded XML; the PDF itself is not checked.beliq_parse_einvoice- parse a UBL/CII XML invoice or a Factur-X/ZUGFeRD PDF into a structured EN 16931 invoice (fields such as number, dates, currency, seller, buyer, lines and totals). Returns the detected format and profile, the extracted invoice, and warnings that say what the document holds and the parsed invoice does not.beliq_generate_einvoice- generate a document from an EN 16931 invoice object. XML comes back inline; a PDF is written to theoutputPathyou give. By default (verify) the API validates the document before returning it, and a document that fails comes back as a tool error with the failed rules. The tool description tells the model to ask for missing invoice data instead of making it up.beliq_convert_einvoice- convert a document from one EN 16931 format to another. An XML source comes back as XML, inline, for every target,facturxandzugferdincluded. A hybrid PDF source sent tofacturxorzugferdcomes back as a PDF, written tooutputPath: the PDF as sent, its container not checked, when its embedded XML already is the target; otherwise that PDF re-wrapped around the converted XML and passed by veraPDF against PDF/A-3b. With a test key the PDF is watermarked after any veraPDF check. The convert reference has the detail. Reports how many source elements the engine recorded as having no target equivalent.beliq_check_account- verify the configured API key and report the plan, the remaining quota, and whether the key is live or ablq_test_sandbox key, whose quota is the sandbox allowance. CallsGET /v1/me, which draws no quota; useful as a connection and credential smoke test.
Installation
Requires Node.js >= 20.15. Published to npm, so clients can run it with npx:
npx -y beliq-mcp
It is listed in the official MCP Registry as io.github.beliq-eu/beliq-mcp, which points clients at this npm package.
The server is configured entirely through environment variables (see below).
Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
BELIQ_API_KEY | yes | - | API key from the beliq dashboard (API Keys). |
BELIQ_AUTH | no | header | How the key is sent: header (X-API-Key) or bearer (Authorization: Bearer). |
BELIQ_BASE_URL | no | https://api.beliq.eu | The base URL the server sends its API requests to. |
Client setup
Claude Code
claude mcp add beliq -e BELIQ_API_KEY=your-key -- npx -y beliq-mcp
Claude Desktop
Add to claude_desktop_config.json (Settings > Developer > Edit Config):
{
"mcpServers": {
"beliq": {
"command": "npx",
"args": ["-y", "beliq-mcp"],
"env": {
"BELIQ_API_KEY": "your-key"
}
}
}
}
Cursor
Add to ~/.cursor/mcp.json (or a project .cursor/mcp.json) using the same mcpServers block shown for Claude Desktop.
Reading a result
beliq_validate_einvoice returns a short text verdict plus a structured result:
validis the API's verdict: the document passed the rule packs and schemas beliq runs for its format, in the versions this result names. It does not mean every recipient, validation tool or tax authority accepts it. Warnings do not make a document invalid, with one case to read beside it:franceCtcBlockingRuleIds.verificationBadgeLabelis the check depth as English display text, and the text verdict prints it besideVALIDorINVALID. How verification works explains each depth. Where the API sends no label, the text sayscheck depth not statedand names no depth.verificationBadgeandverificationTierare the ids behind the label.franceCtcBlockingRuleIdslists the French CTC rule ids the API reports as ending a transmission through a French platform. It can be present wherevalidis true, and the text verdict then leads with it. The result stays a normal result, not a tool error.franceCtcApplied,franceCtcVersionandfranceExtendedCtcAppliedsay which French packs ran.pdfInputis present when the document was a PDF:attachmentName,attachmentFoundByandattachmentCandidatessay which embedded file the verdict is about, andcontainerCheckedis always false because the PDF itself is not checked.formatandprofileDetectedreport the detected syntax and business profile.schematronVersionis the ruleset revision the check ran against. The versions of the other packs and schema bundles that ran come inciusVersion,peppolVersion,facturxProfile,facturxVersion,italyFatturapaXsdBundle,italyFatturapaRuntimeVersion,italySdiMessaggiXsdBundle,italySdiMessaggiXsdVersion,spainFacturaeXsdBundle,spainFacturaeRuntimeVersion,sloveniaEslogXsdBundle,sloveniaEslogRuntimeVersion,polandKsefFa3XsdBundle,polandKsefFa3RuntimeVersion,romaniaRoCiusVersionandnetherlandsNlciusVersion, each present only when it applies.rulesetChannelis present when a ruleset channel was selected, which an organisation whose default channel ispreviousdoes with no input of this tool.rulesetFellBack,rulesetSunsetsOnandrulesetSupersededOncome with it when they apply.rulesetSupersededOnis the date the authority made the successor of a selected ruleset mandatory, and aRULESET_SUPERSEDEDwarning names each such ruleset.sha256is the hash of the document that was checked,rulesetSha256andrulesetArtifactsfingerprint the rule files that ran, anddriftCheckedAtis when the nightly drift check last confirmed those files against their sources: each file's pinned download or, when the file cannot be fetched from there, a mirror the pin names.verifiedis false only when no ruleset ran, which validate never returns; see generate below.errorsandwarningseach carryruleId,severity,location(an XPath when available), andmessage.errorCountandwarningCountare their lengths.livemodeis false for ablq_test_sandbox key and true for any other key. A test key runs the same rules and gives the same verdict as a live key.
The structured result carries every field of the API's validation result. Its shape is checked against the SDK's type, so a field the API adds cannot go missing here without failing the build.
beliq_parse_einvoice returns a text summary plus a structured result:
format,profileDetectedandprofileUrnreport the detected syntax and profile;businessProcessIdandfranceCtcDetectedare present when the document states them.invoiceis the extracted invoice object, with EN 16931 fields such as number, dates, currency, seller, buyer, lines and totals. The parse reference lists every field. A field the API holds no value for is left out.warningssays what the document holds and the parsed invoice does not: each entry has acode, amessage, and, by code, afield, theterms(EN 16931 business groups) or theelements(paths with counts) concerned. The text summary lists them.
beliq_generate_einvoice returns a short text summary (with the XML document appended for XML output) plus a structured result:
outputisxmlorpdf, as requested, andcontentTypeis the matching media type (application/xmlorapplication/pdf).xmlis the generated document inline, present only for XML output.outputPathandbytesWrittenare set when the document was written to disk: always for a PDF, and for XML when you setoutputPath. The call never overwrites an existing file, so pick a path that does not exist. A path that is taken, or whose directory is missing or not writable, is refused before the API is called, so it costs no document.pdfKindis present only for PDF output:hybrid(a PDF/A-3 with the XML embedded, for facturx and zugferd) orvisualization(rendered pages with no XML inside, for xrechnung and peppol-bis, whose legal document stays the XML).schematronVersionis the ruleset (Schematron) revision the document was checked against.outputEnvelopeis the envelope the document is wrapped in, when the API names one.sha256is the lowercase-hex SHA-256 of the returned document bytes, sosha256sumon the file atoutputPathreproduces it.rulesetSha256is one combined fingerprint of the rule artifacts the document was checked against, present when a ruleset ran.livemodeis true for ablq_live_key and false for ablq_test_sandbox key, whose output is marked as a specimen and is not a production invoice. The text summary says so for a test key.validationResultis the API's verdict on the generated document, with every field validate returns, the check depth inverificationBadgeLabelincluded; the text summary names that depth. The verdict is about the invoice XML, so for a PDF the text says so and names the kind of PDF. With the defaultverify: true, a document that fails validation comes back as a tool error that lists the failed rules. Withverify: falseno ruleset runs:verifiedis false,errorsandwarningsare empty because nothing checked the document, and the text saysnot validated.
beliq_convert_einvoice returns a short text summary (with the XML document appended for an XML target) plus a structured result:
outputis what came back, read from the response:xmlfor every target when the source is XML,facturxandzugferdincluded, andpdfwhen a hybrid PDF source went to afacturxorzugferdtarget.contentTypeis the matching media type.xmlis the converted document inline, present only when XML came back.outputPathandbytesWrittenare set when the document was written to disk: always for a PDF, and for XML when you setoutputPath. Like generate, it never overwrites an existing file, and it refuses a path it cannot write before the API is called.sourceFormatis the format the engine read, andtargetFormatthe format it produced (thetargetFormatyou asked for when the API does not name one).profileDetectedis the profile the engine recognised on the source document, when it recognised one.conversionToolsnames the toolchain that did the conversion, when the API names one.livemodeis true for ablq_live_key and false for ablq_test_sandbox key, whose output is marked as a specimen like generate's. The text summary says so for a test key.lostElementsCountandlostElementscount and list the source elements the engine recorded as having no target equivalent. A loss the engine does not detect is not counted, so0does not say that every field of the source arrived.- Each
lostElementsentry has thepath,value,reason,severityandacceptableLossthat the LostElement schema describes. When the list would pass the API's 6 KB header cap, it holds one{ "truncated": true }entry instead of the losses, andlostElementsCountstays the exact count.
A successful convert means the API validated the converted XML before returning it. For a facturx or zugferd target at profile en16931 that validation is the one for plain EN 16931 CII: no Factur-X profile schema is checked. It carries no verdict and no check depth. A converted document that fails comes back as a tool error that lists the failed rules.
A PDF (Factur-X / ZUGFeRD) must be passed by documentPath for validate, parse, and convert, not inlined as text.
Outages and repeated calls
A tool call retries a short failure of the beliq API for up to 10 seconds, and gives each attempt up to 45 seconds, so a call ends within 55 seconds: under the 60-second request limit that the MCP TypeScript SDK's client sets by default. When beliq asks for a longer wait, as it does with Retry-After: 30 during a database outage, the call does not wait. It returns a tool error that says beliq is unavailable for now and, when beliq sent a Retry-After, in how many seconds to try the same call again. Any other API error that carries a Retry-After, such as a 429 rate limit, names that wait too. When the MCP client cancels a call, the call stops at once, also in the middle of a wait between two attempts.
beliq does not charge a repeat of a charged validate, parse, generate or convert request within 15 minutes of the charge, up to 10 repeats; when it cannot read or write its record of charged requests, it charges every attempt. The 15 minutes and the 10 repeats are beliq's own choice; no standard sets them. Repeated requests are not charged again says what makes two requests the same. The generate and convert tools stay marked as not idempotent, since a repeat after that window is charged again.
Agent skill
skill/SKILL.md is a portable agent skill that teaches a model when to validate, how to read errors/warnings, and how to report a verdict with its check depth, using the tools above. Drop it into a skills directory for an agent that should validate invoices on request.
Development
This server depends on the published @beliq/sdk, which carries the request, transport, and result-shaping logic. package-lock.json is committed, and CI and the release build install from it with npm ci.
npm installnpm run build- compile todist/npm run typecheck- src and testsnpm run lint- ESLint with type information, whole repositorynpm test- unit tests (result summary) and an in-memory MCP round-trip with a fake SDK clientBELIQ_API_KEY=your-key npm run test:integration- live smoke tests against the real API
Run the built server directly for a quick check:
BELIQ_API_KEY=your-key node dist/index.js
License
beliq-mcpnpm install beliq-mcp