DEV Community

yannabadie
yannabadie

Posted on

Zero-Dependency Python for EU B2B Ops: Official Open-Data MCP (SIRENE, TED) + Factur-X 2027 Validation

Developers building European B2B workflows often hit two recurring friction points:

  1. Company & tender lookups: Scraping directory websites with headless browsers and proxy pools when government agencies already expose fast, unauthenticated JSON REST APIs.
  2. E-invoicing compliance (Factur-X / EN 16931): Uploading confidential customer or supplier PDFs to third-party web validators to check embedded factur-x.xml payloads after France's September 1, 2026 mandatory e-invoice reception rollout.

Both problems can be solved locally with Python 3.10+ standard library modules alone (urllib.request, xml.etree.ElementTree, json, zlib), keeping cold start under 50 ms and confidential documents on disk.

Here is how to combine two MIT command-line tools—eu-us-opendata-mcp (v1.1.1) and facturx-france-2027 (v1.1.1)—with ready-to-import n8n workflows (v1.2.0).


1. Querying 5 Official EU & U.S. APIs via Pure-Stdlib MCP (eu-us-opendata-mcp v1.1.1)

eu-us-opendata-mcp implements JSON-RPC 2.0 over stdin/stdout directly in Python's standard library and is listed on the Official MCP Registry (io.github.yannabadie/eu-us-opendata-mcp@1.1.1).

MCP Tool Official Upstream Endpoint Key Normalization Handled Typical Latency
search_french_companies recherche-entreprises.api.gouv.fr (DINUM / INSEE SIRENE) Deterministic EU VAT (FRxx + 9-digit SIREN), NAF/APE, city/ZIP & RGE/Qualiopi query filters ~170 ms
search_eu_public_tenders api.ted.europa.eu/v3/notices/search (EU TED v3) Translates ISO3 country + CPV prefix + days into TED Expert Query syntax; flattens multilingual dicts ~215–320 ms
search_clinical_trials clinicaltrials.gov/api/v2/studies (NIH v2) Extracts NCT ID, phase, status, lead sponsor & central contact from protocolSection ~180 ms
search_us_npi_providers npiregistry.cms.hhs.gov/api/?version=2.1 (CMS NPPES) Separates NPI-1 clinicians vs NPI-2 organizations + primary taxonomy ~330–430 ms
search_pubmed_papers ebi.ac.uk/europepmc/webservices/rest/search (EMBL-EBI) Uses resultType=core for untruncated abstracts + "F"/"OA" open-access PDFs ~260 ms

1-line MCP setup (Claude Code, Claude Desktop, Cursor)

{
  "mcpServers": {
    "eu-us-opendata": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/yannabadie/eu-us-opendata-mcp.git",
        "eu-us-opendata-mcp"
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Quick shell smoke test

printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"demo","version":"1.0"}}}\n{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}\n' \
  | uvx --from git+https://github.com/yannabadie/eu-us-opendata-mcp.git eu-us-opendata-mcp
Enter fullscreen mode Exit fullscreen mode

2. Validating French Factur-X 2026–2027 Hybrid Invoices Locally (facturx-france-2027 v1.1.1)

Under French Finance Law (LFI 2024 art. 91 and LFI 2026 art. 123, which raised non-compliance penalties to €50 per invoice capped at €15,000/year), every VAT-liable French business—including art. 293 B VAT-exempt sole proprietors—must already receive structured electronic invoices (Factur-X 1.09.2 / ZUGFeRD 2.5.2, UBL, or CII) via one of the 159 DGFiP-registered Plateformes Agréées (PA) since September 1, 2026, and SMEs/micro-businesses must issue them starting September 1, 2027.

Four mandatory fields cause most technical rejections in UN/CEFACT CII D16B XML (factur-x.xml):

  1. Buyer 9-digit SIREN validated by Luhn checksum (ram:BuyerTradeParty/ram:SpecifiedLegalOrganization/ram:ID[@schemeID="0002"] — easily cross-checked via search_french_companies above).
  2. Operation category (Livraison de biens, Prestation de services, or Opération mixte).
  3. Distinct goods delivery address (ram:ShipToTradeParty/ram:PostalTradeAddress) when different from billing.
  4. VAT due-date code or exemption code (5 = debits, 72 = cash receipts, or VATEX-FR-FRANCHISE for art. 293 B).

Local CLI or CI/CD GitHub Action check

facturx-france-2027 extracts factur-x.xml from PDF/A-3 /EmbeddedFiles streams and checks EN 16931 arithmetic (BR-CO-*), Luhn SIRENs, and the 4 French 2026–2027 mandates using Python's standard library:

# .github/workflows/facturx-check.yml
- name: Validate Factur-X 2027 PDF/A-3 & XML fixtures
  uses: yannabadie/facturx-france-2027@v1.1.1
  with:
    target: "tests/invoices/"
    strict-2027: "true"
Enter fullscreen mode Exit fullscreen mode

For non-developers or quick single-file checks, the same validation logic runs client-side in the browser (zero network upload) via the free FacturKit 2027 Inspector.


3. Scaling From Interactive Lookups (<= 25 rows) to Scheduled n8n Pipelines

Interactive MCP tools work best when capped at 25 rows per call. When an ops or finance team needs scheduled monitoring—such as screening incoming French SIRENs against BODACC insolvency notices and routing high_risk suppliers to Slack, or syncing daily EU TED tenders to Google Sheets—you can import the MIT workflow templates from official-opendata-mcp-n8n-templates (v1.2.0).

Each workflow uses environment variables ($env.APIFY_TOKEN, $env.SLACK_WEBHOOK_URL), explicit Filter/IF + Set normalization nodes, and idempotent Google Sheets appendOrUpdate keys.


Links & Disclosure

Disclosure: I am the independent author of these repositories, as well as the hosted Pay-Per-Event Apify Actors / RapidAPI endpoints for bulk exports and the one-time offline FacturKit 2027 desktop/workbook packs. All CLI validators, MCP tools, n8n JSON workflows, and browser diagnostics linked above are free and require no account.

Top comments (0)