irpp-mcp
A Python MCP server that calculates French income tax using the official DGFiP source code compiled locally. It enables accurate tax simulations for 2023 income based on real French tax forms without network calls.
README
đ§ź 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 Code
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.py
Commencer par cloner ce repo :
mkdir ~/impots && cd ~/impots
git clone https://github.com/erwanpaccard/irpp-mcp.git
Installation 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
pip gcc,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.zip
Dossier 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 build
Binaire 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_driver
Tester :
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 pydantic
Vé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 |
|---|---|---|
situation |
â | celibataire / marie / pacse / divorce / veuf |
salaires_declarant1 |
1AJ | Salaires nets imposables déclarant 1 |
salaires_declarant2 |
1BJ | Salaires nets imposables déclarant 2 |
pensions_declarant1 |
1AS | Pensions, retraites, rentes déclarant 1 |
pensions_declarant2 |
1BS | Pensions, retraites, rentes déclarant 2 |
bnc_declarant1 |
5QC | BNC professionnels régime normal |
micro_foncier |
4BE | Micro-foncier recettes brutes |
dividendes |
2DC | Dividendes (abattement 40 %) |
plus_values |
3VG | Plus-values mobiliĂšres |
nb_enfants_charge |
0CF | Enfants mineurs Ă charge |
nb_enfants_alternee |
0CH | Enfants en résidence alternée |
per_declarant1 |
6NS | Cotisations PER déductibles déclarant 1 |
per_declarant2 |
6NT | Cotisations PER déductibles déclarant 2 |
pension_alimentaire |
6GI | Pension alimentaire versée à enfant majeur |
revenus_fonciers_reels |
4BA | Revenus fonciers nets régime réel |
annee_naissance_declarant1 |
â | AnnĂ©e de naissance dĂ©clarant 1 |
response_format |
â | markdown (dĂ©faut) ou json |
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) | Adullact â calculette-ir | CeCILL 2.1 |
| Compilateur Mlang | Mlang (Adullact) | GPL-3.0 |
irpp_driver.c + irpp_mcp.py |
Ce dépÎt | MIT |
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.