gofact — Claude Code MCP server: Factur-X invoices
A local MCP server that turns a print-ready HTML invoice into Factur-X: PDF/A-3 with embedded EN 16931 XML. Built for French freelancers and small firms.
Open on GitHubWhat gofact does
gofact is a small Go binary. It takes an HTML invoice meant for printing and assembles Factur-X from it: a PDF/A-3 file carrying CII XML under EN 16931. Optionally the invoice goes to a French PDP platform.
There are two checks. First the EN 16931 business rules run against the model before anything is produced, so a non-compliant invoice is refused with the rule identifier (BR-50, BR-CO-15…) and the field to fix. Then the written PDF is read back: Factur-X structures (/AF, /OutputIntents, XMP, /EmbeddedFiles) are verified and the embedded XML is compared with the generated one byte by byte. The XML goes in untouched — re-serializing it through an assembler's own model would drop extended fields, including the PDP electronic routing addresses.
The only system dependency is a browser: Chrome, Edge, Brave or Chromium for HTML-to-PDF rendering. Sandboxed packages such as snap and flatpak are skipped because they cannot read the temporary files gofact hands them. PDF/A-3 assembly happens in Go via pdfcpu, and the sRGB ICC profile sits inside the binary. Seller details, IBAN and PDP credentials come from the environment; with no seller configured gofact fails explicitly instead of issuing an incomplete invoice.
What it helps with
- build a Factur-X file from an HTML template and order data
- check an invoice against EN 16931 rules before issuing it
- submit a finished invoice to a French PDP platform
- keep a continuous legal invoice numbering sequence
- verify the embedded XML against the generated one
Example prompts for the agent
- Show the next invoice number and build Factur-X from
facture.html - Send
2026011 - Client.pdfto the PDP and show its status
How to install gofact
Install
The MCP registry has no launch command for it: see the repository README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about gofact
How do I install gofact in Claude Code?
Build the binary with go build -o gofact ., then register the server: claude mcp add gofact -- /path/to/gofact mcp.
What does gofact do?
It assembles Factur-X: PDF/A-3 with embedded CII XML under EN 16931, checks the invoice against business rules and can submit it to a PDP platform.
What does gofact need to run?
A browser for HTML-to-PDF rendering — Chrome, Edge, Brave or Chromium. Seller details, IBAN and PDP credentials are set as environment variables in .env.