Skip to main content
Glama
README.md
# pph21-mcp

An [MCP](https://modelcontextprotocol.io) server that lets AI assistants calculate **Indonesian employee income tax (PPh 21) using the official TER scheme** (PP 58/2023, PMK 168/2023) accurately, instead of guessing the numbers.

Server MCP untuk menghitung **PPh 21 pegawai tetap dengan skema TER** secara akurat, sehingga asisten AI tidak perlu menebak angka pajak.

> **Disclaimer / Peringatan:** This is an estimate, not tax advice. Verify with DJP or a licensed tax consultant. Hasil ini hanya estimasi, bukan nasihat pajak. Pastikan ke DJP atau konsultan pajak resmi.

## What it does / Fungsinya

Ask your assistant things like:

- "Gaji saya Rp15.000.000 dan status K/0. Berapa PPh 21 bulanan saya?"
- "Hitung PPh 21 Desember untuk gaji Rp15 juta, iuran pensiun Rp150 ribu per bulan, status K/0."
- "Status K/2 masuk kategori TER apa?"

Everything is calculated **locally**. No salary data is sent anywhere, no API key, no network access.

## Tools

| Tool | What it does |
| --- | --- |
| `calculate_pph21_monthly` | PPh 21 for a regular month (January-November) using the TER table. |
| `calculate_pph21_december` | PPh 21 for December (final period): annual Article 17 tax minus TER already withheld. A negative result means over-withholding. |
| `get_ter_category` | TER category (A/B/C) and annual PTKP for a status such as `K/1`. |
| `get_ter_table` | The full official monthly TER table for category A, B or C. |

## Install / Pasang

Requires Python 3.10+.

```bash
pip install git+https://github.com/srositad/pph21-mcp
```

Claude Desktop (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "pph21": { "command": "pph21-mcp" }
  }
}
```

## Accuracy and sources / Akurasi dan sumber

- TER tables (A: 44 rows, B: 40, C: 41): Lampiran PP 58/2023, read from the official PDF and cross-checked against independent published copies.
- Category per PTKP status: PMK 168/2023. PTKP amounts: PMK 101/PMK.010/2016. Article 17 brackets: UU PPh as amended by UU HPP (5% / 15% / 25% / 30% / 35%).
- The test suite reproduces official worked examples, including the DJP leaflet example for Tuan R (December PPh 21 = Rp1.155.000) and the PMK 168/2023 monthly examples.
- As of the last check (December 2026) PTKP and the TER tables had not changed. **If the rules change, this tool will be out of date. Please open an issue.**

## Not supported yet / Belum didukung

Results are only correct for the cases below. For anything else, use the official DJP calculator.

- Permanent employees (pegawai tetap) only. No daily TER, non-employee income, severance (pesangon), pensioners or board members.
- December calculation requires a full 12 months. Employees who joined or left mid-year are not supported.
- No combined-spouse-income PTKP (K/I/x).
- No 20% surcharge for taxpayers without NPWP/NIK registration.
- No government-borne (DTP) incentives.
- Tax amounts are rounded down to whole rupiah, and taxable income (PKP) down to the nearest thousand. Your payroll system may round differently by a few rupiah.

## Development

```bash
git clone https://github.com/srositad/pph21-mcp
cd pph21-mcp
pip install -e ".[dev]"
pytest
```

Contributions are welcome, especially corrections against official examples.

## License

MIT