v0.4.0 - Installable, correct, and agent-ready
erp-report-engine v0.4.0 — "Installable, correct, and agent-ready"
A big step from polished demo to business-grade tool. Highlights:
The guarded ERP MCP server (new)
An AI agent can now query the ERP through the same three-layer read-only guard and audit trail as the report — talking to canonical entities (orders, never LG_001_01_ORFICHE), with every result framed as untrusted input. Five tools: describe_model, weekly_report, reconcile, check_query, query.
pipx install "erp-report-engine[mcp]"
erp-report-engine mcp -c config.yamlAs far as we can find, the first SQL-level-guarded ERP MCP server, and the first for Logo Tiger.
Now a proper package
pipx install erp-report-engine / uvx erp-report-engine — a real console command, profiles shipped inside the wheel, extras for [mssql] / [postgres] / [mcp].
Correctness & security fixes
- Calendar anchor: "this week" is the last completed ISO week by the calendar (from the DB server's date), so a Monday-morning run no longer reports a stale week; empty weeks and W53 handled.
- Stored XSS fixed: the report renders through Jinja2 autoescape.
- Read-only guard hardened with a
sqlglotAST layer (catches writes hidden in CTEs, lock hints) and read-only database sessions. - Data-leak & credential footguns closed: exports default to a gitignored folder; embedded credentials rejected in every URL shape.
- Duplicate handling unified across the HTML and Power BI surfaces; on-time survivorship, driver attribution, stock-out flagging and the decline-streak all fixed and disclosed.
Robustness & DX
Exit-code taxonomy (a scheduler can branch on why a run failed), --strict, structured logging, retries, atomic writes. A runner facade shared by the CLI and MCP server. Property-based calendar tests; CI installs the package, runs ruff, and fails on PBIR generator drift, on Python 3.10–3.13.
Full detail in CHANGELOG.md.