irpp-mcp
đ§ź irpp-mcp â Simulateur IRPP officiel DGFiP
Serveur MCP Python qui calcule l'impÎt sur le revenu français à partir du code source officiel DGFiP, compilé via Mlang (OCamlPro/DGFiP). Calcul 100% local, zéro appel réseau.
Revenus couverts : 2023 (déclaration 2024). Voir Limitations.
Architecture
Sources DGFiP (langage M) â Mlang (OCamlPro/DGFiP) â C (~55 Mo) â irpp_calc
â
irpp_mcp.py (MCP)
â
Claude CodeRelated MCP server: itr-mcp
Arborescence attendue
Avant de commencer, créer un répertoire de travail. à la fin de l'installation, la structure sera :
~/impots/
âââ calculette-ir-master/ â sources DGFiP tĂ©lĂ©chargĂ©es (Ă©tape 1)
â âââ sources2023m_8_0/
âââ mlang-src/ â compilateur Mlang clonĂ© (Ă©tape 2)
â âââ _build/default/src/main.exe
â âââ m_ext/2023/
â âââ examples/dgfip_c/ml_primitif/c_driver/
â âââ irdata.c
âââ output/ â C gĂ©nĂ©rĂ©s (Ă©tape 3) + binaire (Ă©tape 4)
â âââ irpp_driver.c â fourni dans ce repo
â âââ Makefile â fourni dans ce repo
â âââ irpp_calc â binaire compilĂ©
âââ irpp-mcp/ â ce repo (clonĂ© en premier)
âââ irpp_mcp.pyCommencer par cloner ce repo :
mkdir ~/impots && cd ~/impots
git clone https://github.com/erwanpaccard/irpp-mcp.gitInstallation rapide (binaire pré-compilé)
Si vous ĂȘtes sous Linux x86-64 ou WSL (Ubuntu 22.04+), vous pouvez sauter les Ă©tapes 1 Ă 4 et tĂ©lĂ©charger directement le binaire prĂ©-compilĂ© :
mkdir -p ~/impots/output
wget https://github.com/erwanpaccard/irpp-mcp/releases/download/v1.0.0/irpp_calc \
-O ~/impots/output/irpp_calc
chmod +x ~/impots/output/irpp_calc
# Tester
printf "V_0AC=1\nTSHALLOV=50000.00\n" | ~/impots/output/irpp_calc
# â {"IINET": 6786.00, "NBPT": 1.00, "RNI": 45000.00, ...}Puis passer directement Ă l'Ă©tape 5.
Installation complĂšte (compilation depuis les sources)
Prérequis
WSL (Ubuntu 22.04 recommandĂ©) â nĂ©cessaire pour compiler et exĂ©cuter le binaire Linux
Python 3.11+ avec
pipgcc,make,git,opam,unzip
Ătape 1 â Sources DGFiP (langage M)
Le code fiscal officiel est publié par la DGFiP sur Adullact sous licence CeCILL 2.1. Aucun compte requis.
cd ~/impots
curl -L "https://gitlab.adullact.net/dgfip/impots-nationaux-revenu-patrimoine-particuliers/calculette-ir/-/archive/master/calculette-ir-master.zip" \
-o calculette-ir-master.zip
unzip calculette-ir-master.zipDossier utile : calculette-ir-master/sources2023m_8_0/
Ătape 2 â Compiler Mlang (~15 min)
cd ~/impots
sudo apt install libgmp-dev libmpfr-dev git opam bubblewrap unzip bzip2 patch
git clone https://gitlab.adullact.net/dgfip/impots-nationaux-revenu-patrimoine-particuliers/Mlang.git mlang-src
cd mlang-src
# Correctif obligatoire (version non substituée dans les fichiers opam)
sed -i 's/%%VERSION%%/0.0.1/g' mlang.opam irj_checker.opam
OPAMYES=1 make init
make buildBinaire produit : mlang-src/_build/default/src/main.exe
Ătape 3 â GĂ©nĂ©rer les fichiers C depuis les sources M
cd ~/impots/mlang-src
eval $(opam env --switch=$(pwd) --set-switch)
./_build/default/src/main.exe \
-A iliad \
--display_time \
--precision double \
--mpp_function=enchainement_primitif \
--income-year=2023 \
--dgfip_options=-g,-O,-k4,-m2023,-X \
--backend dgfip_c \
--output ../output/irpp_2023.c \
$(find ../calculette-ir-master/sources2023m_8_0 -name 'tgvI.m') \
$(find ../calculette-ir-master/sources2023m_8_0 -name 'errI.m') \
$(find ../calculette-ir-master/sources2023m_8_0 -name '*.m' \
! -name 'err*.m' ! -name 'tgv*.m' ! -name 'cibles.m' | sort) \
m_ext/2023/cibles.m m_ext/2023/codes_1731.m m_ext/2023/commence_par_5.m \
m_ext/2023/commence_par_7.m m_ext/2023/commence_par_H.m \
m_ext/2023/correctif.m m_ext/2023/main.m
tgvI.mdoit ĂȘtre passĂ© en premier â il dĂ©clare l'applicationiliad.
Résultat : ~55 Mo de fichiers C dans ~/impots/output/.
Ătape 4 â Compiler le binaire
irpp_driver.c et Makefile sont déjà dans output/ (fournis par ce repo). Copier depuis le repo :
cp ~/impots/irpp-mcp/output/irpp_driver.c ~/impots/output/
cp ~/impots/irpp-mcp/output/Makefile ~/impots/output/
cd ~/impots/output
make CDRIVER=../mlang-src/examples/dgfip_c/ml_primitif/c_driverTester :
printf "V_0AC=1\nTSHALLOV=50000.00\n" | ./irpp_calc
# â {"IINET": 6786.00, "NBPT": 1.00, "RNI": 45000.00, ...}Ătape 5 â Installer le serveur MCP
pip install mcp pydanticVérifier que BINARY_PATH dans irpp_mcp.py pointe vers le binaire compilé. Par défaut :
BINARY_PATH = Path(__file__).parent.parent / "output" / "irpp_calc"
# â ~/impots/output/irpp_calc â si vous avez suivi l'arborescence ci-dessusĂtape 6 â Configurer Claude Code
Créer .mcp.json à la racine du projet Claude Code :
{
"mcpServers": {
"irpp-mcp": {
"command": "python3",
"args": ["/home/user/impots/irpp-mcp/irpp_mcp.py"]
}
}
}Sur Windows (invocation via WSL) :
{
"mcpServers": {
"irpp-mcp": {
"command": "wsl",
"args": ["-e", "python3", "/mnt/c/Users/vous/impots/irpp-mcp/irpp_mcp.py"]
}
}
}Adapter le chemin Ă votre arborescence. Trouver le chemin Python :
which python3dans WSL.
Utilisation
L'outil MCP irpp_calculer_ir accepte les paramĂštres du formulaire 2042 :
ParamĂštre | Case 2042 | Description |
| â |
|
| 1AJ | Salaires nets imposables déclarant 1 |
| 1BJ | Salaires nets imposables déclarant 2 |
| 1AS | Pensions, retraites, rentes déclarant 1 |
| 1BS | Pensions, retraites, rentes déclarant 2 |
| 5QC | BNC professionnels régime normal |
| 4BE | Micro-foncier recettes brutes |
| 2DC | Dividendes (abattement 40 %) |
| 3VG | Plus-values mobiliĂšres |
| 0CF | Enfants mineurs Ă charge |
| 0CH | Enfants en résidence alternée |
| 6NS | Cotisations PER déductibles déclarant 1 |
| 6NT | Cotisations PER déductibles déclarant 2 |
| 6GI | Pension alimentaire versée à enfant majeur |
| 4BA | Revenus fonciers nets régime réel |
| â | AnnĂ©e de naissance dĂ©clarant 1 |
| â |
|
Variables retournées : IINET (impÎt net), NBPT (parts), RNI (revenu net imposable), REVKIRE (revenu fiscal de référence), IRNET, IAVIM, IRTOTAL.
Utilisation avec le skill impĂŽts
Le skill erwanpaccard/impots dĂ©tecte automatiquement ce serveur MCP et l'utilise pour les simulations IR â les calculs s'appuient alors sur le moteur DGFiP officiel plutĂŽt que sur des estimations LLM.
Limitations
Revenus 2023 uniquement : les sources 2024 (
sources2024m_3_13) sont incompatibles avec la version actuelle de Mlang (variableGLOBAL.REPRCMnon résolue dans le contextecorrectif).micro_bnc_declarant1(case 5TE) : calculeREVKIREcorrectement mais donneIINET=0. Workaround : passer les recettes à 66 % dansbnc_declarant1(5QC).Binaire Linux uniquement : sur Windows, l'invocation passe automatiquement par WSL.
Sources et licences
Composant | Source | Licence |
Sources DGFiP (revenus 2023) | CeCILL 2.1 | |
Compilateur Mlang | GPL-3.0 | |
| Ce dépÎt | MIT |
This server cannot be deployed
Maintenance
Related MCP Connectors
The first fiscal MCP server for Spain: IAE/CNAE 2025, AEAT modelos, IRPF/IVA, RETA quota.
TaxSort â Tollbooth-monetized MCP server for personal tax transaction classification
MCP server for Quaderno â tax-rate calculation, invoices, contacts, products, receipts & expenses.
Calcul fiscal (IR, IFI, PER, plus-value) et retraite français â 32 rĂ©gimes, sourcĂ© et datĂ©.
Related MCP Servers
- AlicenseAqualityCmaintenanceA local MCP server that enables Claude to answer Norwegian tax questions with actual calculations, covering income, wealth, stocks, funds, real estate, crypto, and more.121MIT
- AlicenseAqualityBmaintenanceLocal-first MCP server for Indian income tax computation, enabling users to compute taxes, compare regimes, plan advance tax, and parse Form 26AS without sending data to the cloud.126 npm8MIT
- FlicenseAqualityCmaintenanceMCP server for the Swiss federal tax calculator, providing income, wealth, inheritance, and corporate tax figures for all Swiss municipalities and tax years 2010-2026.132-
- AlicenseNot gradedqualityCmaintenanceA standalone MCP server for Indian personal income-tax work (ITR-1/2/3/4 + post-filing notices) with 8 deterministic tools, running fully offline with no API keys.MIT