irpp-mcp
🧮 irpp-mcp — 公式DGFiP IRPPシミュレーター
Mlang (OCamlPro/DGFiP) を介してコンパイルされた公式DGFiPソースコードからフランスの所得税を計算するPython MCPサーバーです。100%ローカルで計算され、ネットワーク呼び出しはゼロです。
対象所得:2023年(2024年申告分)。制限事項を参照してください。
アーキテクチャ
Sources DGFiP (langage M) → Mlang (OCamlPro/DGFiP) → C (~55 Mo) → irpp_calc
↓
irpp_mcp.py (MCP)
↓
Claude CodeRelated MCP server: itr-mcp
想定されるディレクトリ構造
開始する前に、作業ディレクトリを作成してください。インストール終了時の構造は以下のようになります:
~/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まずこのリポジトリをクローンします:
mkdir ~/impots && cd ~/impots
git clone https://github.com/erwanpaccard/irpp-mcp.gitクイックインストール(プリコンパイル済みバイナリ)
Linux x86-64またはWSL (Ubuntu 22.04+) を使用している場合、ステップ1〜4をスキップして、プリコンパイル済みバイナリを直接ダウンロードできます:
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, ...}その後、直接ステップ5に進んでください。
完全インストール(ソースからのコンパイル)
前提条件
WSL (Ubuntu 22.04推奨) — Linuxバイナリのコンパイルと実行に必要
Python 3.11+ (pipを含む)
gcc,make,git,opam,unzip
ステップ1 — DGFiPソース (M言語)
公式の税務コードは、CeCILL 2.1ライセンスの下でDGFiPによってAdullact上で公開されています。アカウントは不要です。
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便利なフォルダ: calculette-ir-master/sources2023m_8_0/
ステップ2 — Mlangのコンパイル (~15分)
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生成されるバイナリ: mlang-src/_build/default/src/main.exe
ステップ3 — MソースからCファイルを生成
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.mを最初に渡す必要があります — これがiliadアプリケーションを宣言します。
結果: ~/impots/output/ 内に約55MBのCファイルが生成されます。
ステップ4 — バイナリのコンパイル
irpp_driver.c と Makefile はすでに output/ 内にあります(本リポジトリで提供)。リポジトリからコピーします:
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テスト:
printf "V_0AC=1\nTSHALLOV=50000.00\n" | ./irpp_calc
# → {"IINET": 6786.00, "NBPT": 1.00, "RNI": 45000.00, ...}ステップ5 — MCPサーバーのインストール
pip install mcp pydanticirpp_mcp.py 内の BINARY_PATH がコンパイルされたバイナリを指していることを確認してください。デフォルト:
BINARY_PATH = Path(__file__).parent.parent / "output" / "irpp_calc"
# → ~/impots/output/irpp_calc ✓ si vous avez suivi l'arborescence ci-dessusステップ6 — Claude Codeの設定
Claude Codeプロジェクトのルートに .mcp.json を作成します:
{
"mcpServers": {
"irpp-mcp": {
"command": "python3",
"args": ["/home/user/impots/irpp-mcp/irpp_mcp.py"]
}
}
}Windowsの場合 (WSL経由で呼び出し):
{
"mcpServers": {
"irpp-mcp": {
"command": "wsl",
"args": ["-e", "python3", "/mnt/c/Users/vous/impots/irpp-mcp/irpp_mcp.py"]
}
}
}パスを自身のディレクトリ構造に合わせて調整してください。Pythonのパスを確認するには、WSLで
which python3を実行します。
使用方法
MCPツール irpp_calculer_ir は、フォーム2042のパラメータを受け入れます:
パラメータ | 2042欄 | 説明 |
| — |
|
| 1AJ | 申告者1の課税対象純給与 |
| 1BJ | 申告者2の課税対象純給与 |
| 1AS | 申告者1の年金、退職金、年金給付 |
| 1BS | 申告者2の年金、退職金、年金給付 |
| 5QC | BNC専門職(通常制度) |
| 4BE | マイクロ不動産所得(総収入) |
| 2DC | 配当金(40%控除) |
| 3VG | 有価証券譲渡益 |
| 0CF | 被扶養未成年児童数 |
| 0CH | 共同養育の児童数 |
| 6NS | 申告者1の控除対象PER拠出金 |
| 6NT | 申告者2の控除対象PER拠出金 |
| 6GI | 成人した子供に支払った養育費 |
| 4BA | 実額制度による純不動産所得 |
| — | 申告者1の出生年 |
| — |
|
返される変数: IINET (純税額), NBPT (課税単位数), RNI (課税対象純所得), REVKIRE (基準所得), IRNET, IAVIM, IRTOTAL。
impotsスキルとの連携
erwanpaccard/impots スキルは、このMCPサーバーを自動的に検出し、IRシミュレーションに使用します。これにより、LLMの推定ではなく、公式のDGFiPエンジンに基づいた計算が行われます。
制限事項
2023年所得のみ:2024年ソース (
sources2024m_3_13) は現在のMlangバージョンと互換性がありません(correctifコンテキスト内で変数GLOBAL.REPRCMが解決されないため)。micro_bnc_declarant1(5TE欄):REVKIREは正しく計算されますが、IINET=0となります。回避策:収入の66%をbnc_declarant1(5QC) に渡してください。Linuxバイナリのみ:Windowsでは、呼び出しは自動的にWSLを経由します。
ソースとライセンス
コンポーネント | ソース | ライセンス |
DGFiPソース (2023年所得) | CeCILL 2.1 | |
Mlangコンパイラ | GPL-3.0 | |
| 本リポジトリ | MIT |
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Exact French tax & payroll calculations for AI agents: income tax (impôt sur le revenu: parts, quotient familial, décote, TMI), micro-entrepreneur URSSAF contributions (ACRE, versement libératoire) with an optional VAT franchise check (franchise en base de TVA: must I charge VAT?), and gross-to-net salary with employer cost — CDI or CDD (prime de précarité, congés payés), full-time or part-time. Missing information? Your agent gets, for free, the exact questions to ask the user (in French, with types and allowed values) in a single round trip. Deterministic, no LLM: matches all 7,095 values of the official DGFiP tax tables, 60 cases from the official simulators and the official worked examples of the tax doctrine (BOFiP). Unsupported cases are refused for free; you pay $0.005 in USDC via x402 only when the calculation succeeds. Free catalogue tool: list_france_calculators.
The first fiscal MCP server for Spain: IAE/CNAE 2025, AEAT modelos, IRPF/IVA, RETA quota.
Brazil tax reform simulator for AI (CBS/IBS/IS) on Receita Federal's official open-source code.
TaxSort — Tollbooth-monetized MCP server for personal tax transaction classification
Related MCP Servers
- AlicenseAqualityFmaintenanceA local MCP server that enables Claude to answer Norwegian tax questions with actual calculations, covering income, wealth, stocks, funds, real estate, crypto, and more.6121MIT
- 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.16461 npm10MIT
- FlicenseAqualityDmaintenanceMCP 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 gradedqualityDmaintenanceA 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.66 PyPIMIT