Skip to main content
Glama
irpp-mcp

irpp-mcp

by erwanpaccard

🧮 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 Code

Related 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 언어)

공식 세법은 DGFiP가 CeCILL 2.1 라이선스 하에 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 pydantic

irpp_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 항목

설명

situation

—

celibataire / marie / pacse / divorce / veuf

salaires_declarant1

1AJ

신고자 1의 과세 대상 순 급여

salaires_declarant2

1BJ

신고자 2의 과세 대상 순 급여

pensions_declarant1

1AS

신고자 1의 연금, 퇴직금, 연금 수령액

pensions_declarant2

1BS

신고자 2의 연금, 퇴직금, 연금 수령액

bnc_declarant1

5QC

BNC 전문직 일반 체계

micro_foncier

4BE

마이크로 부동산 총수입

dividendes

2DC

배당금 (40% 공제)

plus_values

3VG

유가증권 양도소득

nb_enfants_charge

0CF

부양 미성년 자녀 수

nb_enfants_alternee

0CH

공동 양육 자녀 수

per_declarant1

6NS

신고자 1의 공제 가능한 PER 기여금

per_declarant2

6NT

신고자 2의 공제 가능한 PER 기여금

pension_alimentaire

6GI

성인 자녀에게 지급된 부양비

revenus_fonciers_reels

4BA

실제 체계의 순 부동산 소득

annee_naissance_declarant1

—

신고자 1의 출생 연도

response_format

—

markdown (기본값) 또는 json

반환 변수: 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년 소득)

Adullact — calculette-ir

CeCILL 2.1

Mlang 컴파일러

Mlang (Adullact)

GPL-3.0

irpp_driver.c + irpp_mcp.py

이 저장소

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      F
      maintenance
      A local MCP server that enables Claude to answer Norwegian tax questions with actual calculations, covering income, wealth, stocks, funds, real estate, crypto, and more.
      6
      12
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Local-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.
      16
      461 npm
      10
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      MCP server for the Swiss federal tax calculator, providing income, wealth, inheritance, and corporate tax figures for all Swiss municipalities and tax years 2010-2026.
      13
      2
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      A 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 PyPI
      MIT