Tool

ONEM MCP

A qualifier-aware MCP server over Tunisia's national energy statistics (2010–2026), derived from public ONEM reports.

Active

What it is

ONEM MCP (onem-tunisia-mcp) is a Model Context Protocol (MCP) server that lets an LLM client query Tunisia’s national energy statistics in natural language. It covers production, consumption, trade, balances, and royalties for oil, gas, and electricity across three ONEM report families — Bilan National de l’Énergie, Memento (Chiffres clés), and Conjoncture énergétique — spanning 2010–2026. The figures are extracted from public PDF reports into a long-format DuckDB store that the server reads read-only.

The data source is the Observatoire National de l’Énergie et des Mines (ONEM), Ministère de l’Industrie, des Mines et de l’Énergie, Tunisia (energiemines.gov.tn). This is an independent, unofficial project — not affiliated with, authorized by, or endorsed by ONEM or the Ministry. It is built for researchers, journalists, and analysts who need Tunisian energy figures with their qualifiers intact.

How it works

A user asks a question in natural language; the model chains the server’s tools — search_series to find the right series, get_series / get_observation to fetch it, compare to relate series safely. Every returned value carries its qualifiers (calorific basis PCI/PCS, period type annual/YTD, scope, geography) and cell-level provenance (source edition, page, table reference, exact cell). The server refuses to compare incompatible series (e.g. PCI vs PCS, annual vs year-to-date) and distinguishes “out-of-scope / not ingested” from “no data exists” — so the model cannot launder a qualifier-stripped wrong answer.

Use cases

  • Academic research — an energy economist asks for Tunisia’s natural-gas production on a PCI basis, annual, 2018–2024, and receives the series with basis and period type explicit, with no PCI/PCS conflation.
  • Investigative journalism — a journalist asks why the Algerian-gas royalty fell in early 2026 while purchases rose, and the server surfaces the year-to-date figures and the documented STEG↔State regularization footnote that explains the apparent contradiction.
  • Public policy — an analyst asks for electricity sales in 2024, local versus including exports, and receives both distinctly rather than a single ambiguous total.

Demo — illustrative example

Illustrative example — real response captured 2026-06-26

Prompt: “What was the Algerian-gas fiscal royalty (redevance) Tunisia received to end-April 2026, on a PCI basis?”

{
"value": 182.0, "unit": "ktep-pci",
"calorific_basis": "PCI", "period_type": "ytd_cumulative", "ytd_cutoff_month": 4,
"data_status": "provisional",
"provenance": {
  "source_id": "conjoncture_2026_04", "source_page": "5",
  "source_ref": "C-T1", "source_cell": "row=Redevance|col=c"
},
"warnings": ["DATA_STATUS=provisional: not a final figure."]
}

Source: Conjoncture énergétique à fin avril 2026, table C-T1, p.5 — ONEM, energiemines.gov.tn. Every value carries its qualifiers and cell-level provenance. Asking the server to compare this PCI figure against its PCS twin returns refused_incompatible — the guardrail firing, not a silent wrong answer.

Status and roadmap

ONEM MCP is open source under the MIT License and self-hosted: there is no hosted endpoint; it runs as a local stdio process that the user’s MCP client spawns. The built database ships with the repository, so it works immediately after install — no portal connection at query time. The GitHub repository is the single source for installation, code, and development updates. Planned next steps include ground-truthing retained cross-edition conflicts against the source PDFs, ingesting deferred families (prices, trade values and volumes, refining, exploration), recovering deferred editions, and lowering the run barrier with a packaged launcher.

Technical report

A technical report documents the server’s design and implementation, under a CC BY 4.0 license.

Download the technical report (PDF)PDF · CC BY 4.0

Citable archival version of record: Gasmi, T. (2026). onem-tunisia-mcp: A Qualifier-Aware MCP Server over Tunisia’s National Energy Time-Series (1.0.0). Zenodo. https://doi.org/10.5281/zenodo.20942629

Source code: github.com/tanitdata/onem-tunisia-mcp

FAQ

What is the Model Context Protocol?
The Model Context Protocol is an open standard that lets AI assistants call external tools. ONEM MCP is one such tool server: connect it to your AI client (Claude Desktop, VS Code, Cursor, and others) and ask about Tunisian energy statistics in natural language.
Who is this server for?
Researchers, journalists, and analysts working with Tunisian energy data who need figures with their qualifiers intact — calorific basis (PCI/PCS), period type (annual vs year-to-date), scope, and source provenance.
Do I need an account or an API key?
No. The server runs locally over stdio against a bundled database; there is no key and no network connection at query time.
Is the data freely reusable?
The software is MIT-licensed. The figures are ONEM's, restructured here for machine access; the project gives attribution and is unofficial. The exact reuse terms are ONEM's own — the project makes no legal determination, so consult ONEM for reuse beyond attribution.
How fresh is the data?
It is a pre-built snapshot covering 2010–2026, not a live feed. Unlike a portal proxy, the figures update only when the maintainer re-runs the extraction pipeline against ONEM's published reports.
Does the server cover sources beyond ONEM?
No — ONEM only, and not all of it yet: some families (prices, trade volumes, refining, exploration) and editions are deferred and reported as out-of-scope by design. For Tunisian agricultural data see agridata MCP; for national statistics see INS MCP.
How can I contribute?
The code is published on GitHub under an MIT license. Open an issue or a pull request to report a problem or suggest an improvement.

Team

  • Tarek Gasmi

    Fondateur · Data & IA