Tool

INS MCP

Ask Tunisia's national statistics in plain language — an MCP server over the INS data portal.

Active

What it is

INS MCP is a local server implementing the Model Context Protocol (MCP), the open standard by which AI assistants call external tools. It connects an MCP-compatible client (Claude Desktop, Cursor, VS Code, and others) to Tunisia’s national statistics portal — the Institut National de la Statistique (INS) data portal at dataportal.ins.tn, built on the proprietary Prognoz platform. The portal holds dimensional time-series cubes covering national accounts, the 2014 census, population projections, employment, household living conditions, and foreign trade.

The portal’s API speaks XML in and XML out, with dirty, trap-laden metadata. INS MCP’s defining job is to own all of that: its tools take structured parameters and return clean JSON, so the AI never handles a raw XML envelope. It is built for researchers, data scientists, economists, and journalists working with Tunisian official statistics. INS MCP is an independent project; it is not endorsed by or affiliated with INS.

How it works

A user asks a question in natural language. The AI client, guided by the server’s tool descriptions, chains the tools: it searches the catalogue for the right statistical cube, drills or searches that cube’s dimensions to resolve the numeric codes for the wanted indicator and region, then requests the observations for that selection. The server builds the XML request, calls the live INS portal, parses and cleans the response, and returns tidy JSON records — each with its period, value, unit, and a mandatory source-attribution block. Identity is always handled by code, not by the portal’s dirty labels, and three distinct availability signals (declared period, has-data flag, real coverage) keep the answer honest.

Use cases

  • Academic research — an economist asks for Tunisia’s population projections to 2044 by governorate and sex, and gets a tidy, source-cited series instead of writing Prognoz XML by hand.
  • Investigative journalism — a journalist asks for GDP at market prices over 2014–2017, or value-added by sector, and receives exact figures with the INS source reference ready to publish.
  • Public policy — an analyst queries the 2014 census (population by governorate, household equipment, employment), and the server flags which census cubes are populated versus published-but-empty, so no time is wasted on empty shells.

Demo — illustrative example

Illustrative example — real response captured 2026-06-17

Prompt: “Show Tunisia’s GDP at market prices from 2014 to 2017.”

{
"source_id": "OBJ5259889",
"observations": [
  { "period": "2014", "frequency": "annual", "value": 80865.5 },
  { "period": "2015", "frequency": "annual", "value": 84689.2 },
  { "period": "2016", "frequency": "annual", "value": 89792.2 },
  { "period": "2017", "frequency": "annual", "value": 96324.7 }
],
"coverage": { "start": "2014", "end": "2017", "count": 4 },
"attribution": {
  "producer": "Institut National de la Statistique (INS), Tunisie",
  "source_url": "http://dataportal.ins.tn/",
  "license_url": "https://www.ins.tn/conditions-utilisation",
  "last_updated": "2017-02-27",
  "disclaimer": "Provided as-is; not an official INS publication and not endorsed by INS."
}
}

Every real response carries an attribution block — producer, source URL, licence, and a disclaimer — so each figure traces back to the INS portal. GDP here is in million dinars; the unit field is empty because this cube carries the magnitude in its label, a documented INS-data quirk.

Status and roadmap

INS 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 same model as agridata MCP. The GitHub repository is the single source for installation, code, and development updates: clone it, create a virtual environment, run pip install -e ., then python -m ins_mcp. Planned next steps include a lower-friction packaged install for non-technical users, optional offline resilience, sharper discovery (transliteration and Arabic place-name aliases), and broader end-to-end testing against the live portal.

Technical report

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

Citable archival version of record: Gasmi, T. (2026). ins-tunisia-mcp: An MCP Server for Conversational Access to Tunisia’s National Statistics (0.1.0). Zenodo. https://doi.org/10.5281/zenodo.20738616

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

FAQ

What is the Model Context Protocol?
The Model Context Protocol is an open standard that lets AI assistants call external tools. INS MCP is one such tool server: connect it to your AI client (Claude Desktop, VS Code, Cursor, and others) and ask about Tunisian statistics in natural language.
Who is this server for?
Researchers, data scientists, economists, and journalists working with Tunisian official statistics — anyone who wants the data without writing XML or learning the portal's API.
Do I need an account or an API key?
No. The INS portal is public and key-less, and the server itself requires no authentication. You only need to run it locally and connect your MCP client.
Is the data freely reusable?
Yes. The data is governed by the INS conditions d'utilisation (attribution-style, compatible with CC-BY / ODC-BY, commercial use allowed). Attribution is mandatory — every server response carries an attribution block you must reproduce.
How often is the data refreshed?
Data values are fetched live from the portal on every query. The catalogue of available cubes is cached locally and refreshed on demand, so newly added cubes appear after a manual refresh.
Does the server cover sources beyond INS?
No. INS MCP exposes only the INS data portal (dataportal.ins.tn). For Tunisia's agricultural open data, see the sibling agridata MCP.
How can I contribute?
The code is published on GitHub under an MIT license. Open an issue or a pull request — one feature or fix per PR, with conventional commit messages.

Team

  • Tarek Gasmi

    Fondateur · Data & IA