Contents

Documentation Town hall finances

town-hall-finances

1 credit per call Read-only mairies

Get the accounts of one French commune year by year since 2018 (OFGL): revenue, spending, staff, purchases, savings, investment, grants, borrowing, debt, reserves.

When to use it. Give the INSEE code (find it with town-hall-search or town-hall-profile). Without indicators, returns the main ones; otherwise pick among: achats_charges_externes, annuite_dette, autres_depenses_fonct, autres_depenses_invest, autres_dotations_fonct, autres_dotations_subventions, autres_impots_taxes, autres_recettes_fonct, autres_recettes_invest, capacite_besoin_financement, cessions_immobilisations, charges_financieres, concours_etat, credits_tresorerie, depenses_equipement, depenses_fonct, depenses_intervention, depenses_invest, depenses_invest_hors_remb, depenses_totales, depenses_totales_hors_remb, depots_tresor, dgf, emprunts, encours_dette, encours_dette_bancaire, encours_dette_depots_cautions, epargne_brute, epargne_gestion, epargne_nette, fctva, fiscalite_reversee, flux_net_dette, fonds_roulement, fonds_soutien_emprunts_risque, frais_d_hebergement, frais_personnel, impots_locaux, impots_taxes, perequations_compensations, recettes_fonct, recettes_invest, recettes_invest_hors_emprunts, recettes_totales, recettes_totales_hors_emprunts, remboursements_emprunts, subventions_droit_prive, subventions_equipement_versees, subventions_recues, teom, tva, variation_fonds_roulement, ventes_biens_services, versement_transport. Values are euros per inhabitant unless per_capita is false. A commune formed by a merger shows the sum of the former communes for the years before the merger.

Credits are taken when the call starts and given back in full if the tool fails, times out or is refused by the service behind it.

Ask your assistant

Once the server is connected, a request in plain words is enough. For example:

Example request
Use Mairies de France to get the accounts of one French commune year by year since 2018 (OFGL): revenue, spending, staff, purchases, savings, investment, grants, borrowing, debt, reserves, with insee = "38229".

Examples

Most clients only need the server address and a sign-in: see Connect. Clients configured by a file take the first block. Your assistant then writes the second one by itself.

Client configuration
{
  "mcpServers": {
    "mairies-de-france": {
      "url": "https://mairies.vosfichiers.com/mcp"
    }
  }
}
What the assistant sends
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "town-hall-finances",
    "arguments": {
      "insee": "38229",
      "per_capita": true
    }
  }
}

Put an API key in the API_KEY environment variable first. Create a key

bash
curl -X POST https://mairies.vosfichiers.com/api/v1/town-hall-finances \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "insee": "38229",
  "per_capita": true
}'

Put an API key in the API_KEY environment variable first. Create a key

python
import json
import os
import urllib.request

payload = {
    "insee": "38229",
    "per_capita": True,
}
request = urllib.request.Request(
    "https://mairies.vosfichiers.com/api/v1/town-hall-finances",
    data=json.dumps(payload).encode(),
    headers={
        "Authorization": "Bearer " + os.environ["API_KEY"],
        "Content-Type": "application/json",
    },
    method="POST",
)
with urllib.request.urlopen(request) as response:
    print(json.load(response))

Put an API key in the API_KEY environment variable first. Create a key

javascript
const response = await fetch("https://mairies.vosfichiers.com/api/v1/town-hall-finances", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "insee": "38229",
    "per_capita": true
  }),
});
console.log(await response.json());

Input

Fields this tool accepts
Field Type Required Default Description
insee string required none INSEE code of the commune, e.g. 38229. pattern ^(\d{5}|2[AB]\d{3})$
indicators array of string optional none Aggregate codes, e.g. epargne_brute or encours_dette. Default: main ones. at most 20 items
from_year integer optional none First year. ≥ 2000≤ 2100
to_year integer optional none Last year. ≥ 2000≤ 2100
per_capita boolean optional true True: euros per inhabitant; false: euros.

Output

A JSON object whose fields depend on the request; this tool declares no fixed shape.

Try it

Run this tool from your account, with a form built from the fields above. A run is a real call: it costs 1 credit.

Open in the playground