taiwan-payroll
An MCP server (taiwan-payroll) that computes Taiwan's statutory payroll costs — labor/employment insurance, NHI, labor pension, occupational injury, supplementary premiums, tax withholding, and old-age benefits — for 2024–2026 (ROC 113–115).
calculate_payroll — Monthly payroll burdens split across employee/employer/government for labor insurance (incl. employment insurance), NHI, labor pension, and occupational injury; supports identity categories (local, general migrant, domestic migrant), dependents, part-time, voluntary pension contribution, and rounding strategies.
calculate_supplementary_premium — Second-generation NHI supplementary premium (2.11%) on six income types: bonus, part-time wage, professional practice, dividend, interest, rent (bonus applies only above 4× monthly insured salary).
calculate_employer_supplementary_premium — Employer-side supplementary premium on (monthly paid payroll − total insured amount), uncapped.
calculate_income_tax_withholding — Salary withholding tax: resident monthly formula, resident non-monthly bonus (5%), non-resident (18%, or 6% if ≤1.5× minimum wage).
calculate_old_age_pension — Monthly labor insurance old-age annuity, best-of-two formulas, with early/delayed claim adjustments up to ±20%.
calculate_old_age_lump_sum — Lump-sum old-age benefit (1 month per year of service, max 5 years counted after age 60).
calculate_old_age_single_payment — Legacy basis-point payment (pre-2009 service): 1 basis/year first 15 years, 2 thereafter, caps of 45/50 bases.
calculate_prorated — Mid-month hire/termination: labor insurance/occupational/pension prorated by days; NHI follows the month-end attribution rule (full month on hire, none on termination).
list_years — List supported years, data versions, and minimum wage (monthly/hourly) to pick a valid
yearvalue.
All results are reference-only and not legal or accounting advice.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
taiwan-payroll
開源的台灣勞健保勞退法定費用計算引擎。輸入薪資與身份,算出勞保(含就保)、健保、勞退、職災與二代健保補充保費的各方負擔——並涵蓋薪資所得扣繳、月中到職/離職破月、健保補充保費申報媒體檔,以及勞保老年給付試算。
🧮 線上試算:https://taiwan-payroll.vercel.app(免安裝,瀏覽器直接算)
🔌 三種介面:TypeScript(npm)、Python(PyPI,純 stdlib)、MCP server(給 AI 助理呼叫)
📑 官方對證:級距表與費率逐級取自主管機關公告,計算結果對官方範例黃金向量逐位元驗證
🔁 跨語言一致:TS 與 Python 讀同一份
data/、跑同一套testdata/,結果逐位元相同📦 零執行期依賴:core 不帶任何 runtime 套件
定位是「計算引擎」而非「法遵保證」。 內建民國 113–115(2024–2026)年度官方參數。
安裝
npm install taiwan-payroll # TypeScript / Node
pip install taiwan-payroll # PythonRelated MCP server: dsh-hr-payroll-mcp
快速上手
import { createPayrollEngine } from 'taiwan-payroll';
const engine = createPayrollEngine({ year: 2026 });
const r = engine.calculate({
monthlySalary: 42000,
identity: 'category1',
dependents: 1,
employmentInsurance: true,
pensionSelfContribution: 0.06,
});
console.log(r.employee); // { labor: 1050, health: 1302, pensionSelf: 2520, total: 4872 }
console.log(r.employer.occupational); // 職災雇主負擔二代健保補充保費與破月計算
// 補充保費(六類所得:bonus/parttime/professional/dividend/interest/rent)
engine.calculateSupplementary({ type: 'bonus', amount: 200000, monthlyInsuredSalary: 42000 });
// → { type: 'bonus', chargeable: 32000, rate: '0.0211', premium: 675 }
// 月中到職/離職(勞保/職保/勞退按日;健保採官方「月底歸屬」原則)
engine.calculateProrated({ monthlySalary: 29500, startDate: '2026-03-08' });
// → { ..., days: { insured: 23 }, healthCharged: true }健保破月採「月底歸屬原則」:以月底所屬投保單位計收整月——到職當月計整月、離職當月不計。此為健保署實務規則(非按日、與 15 日分水嶺無關)。
申報媒體檔(健保補充保費)
由申報資料產生健保署「補充保險費明細申報檔」(CSV/Big5),涵蓋 6 類所得:獎金(62)、兼職薪資(63)、執行業務(65)、股利(66)、利息(67)、租金(68)。每個產生器皆以健保署官方範例逐位元驗證,TS 與 Python 結果一致。
import { generateSupplementaryBonusFiling } from 'taiwan-payroll';
const { filename, content } = generateSupplementaryBonusFiling({
year: 2026,
filingDate: '20260901', // 用於檔名
unit: { taxId: '11111111', name: '甲公司', phone: '0227065866', email: 'a@b.tw', contactName: '王小明' },
records: [
{ action: 'I', payDate: '20260615', payeeId: 'A123456789', payeeName: '李四',
bonusAmount: 50000, insuredSalary: 31800, ytdBonusCumulative: 150000, unitCode: '123456789' },
],
});
// filename: 'DPR111111111150901001.csv'
// content : Unicode 字串;檔案實際為 Big5,存檔時請以 Big5 編碼寫出。獎金/兼職/執行業務/利息/租金:逐列補充保費由引擎計算。股利(
generateSupplementaryDividendFiling)因含股票股利/雇主扣除等情形,逐列保費由呼叫端提供(另附便利函式calcDividendPremium)。輸出為「資料檔」供以官方入口上傳。Big5 編碼:TS 由呼叫端編碼,Python 提供
to_big5_bytes()(core 維持零依賴)。API 詳見文件站
/docs/api。
勞保老年給付試算
依勞保局官方公式試算三種老年給付(皆對官方數值/公式驗證、TS≡Python):
import { calcOldAgePension, calcOldAgeLumpSum, calcOldAgeSinglePayment, getYearData } from 'taiwan-payroll';
const d = getYearData(2026);
calcOldAgePension(d, { avgInsuredSalary: 32000, years: 35, months: 6 }); // 月領年金(擇優兩式,可提前/延後)
calcOldAgeLumpSum(d, { avgInsuredSalary: 30000, years: 10 }); // 老年一次金
calcOldAgeSinglePayment(d, { avgInsuredSalary: 30000, preSixtyYears: 20 }); // 一次請領(舊制基數)老年年金:擇優兩式(
平均×年資×0.775%+3000vs×1.55%),提前/延後claimOffsetMonths(±4%/年、上限 ±5 年(±20%));附averageHighestInsuredSalary、statutoryClaimAge。老年一次金:年資每滿 1 年發 1 個月,逾 60 歲後年資最多 5 年。
一次請領:基數制(前 15 年每年 1 基數、超過部分每年 2 基數、前 60 上限 45、合併上限 50),平均採退保前 36 個月。
試算僅供參考,實際以勞保局核定為準。
架構
data/{year}.json— 單一事實來源,年度法規參數(級距表、費率),以 JSON Schema 驗證。testdata/— 語言無關的黃金測試向量(官方案例,含source出處),是跨語言行為一致性的根基。packages/core— 零執行期依賴的 TypeScript 引擎。
其他語言與介面
Python:
pip install taiwan-payroll,純 stdlib、API 對應 TS 版(PyPI)。MCP server:讓 Claude 等 AI 助理直接呼叫試算。遠端免安裝端點
https://taiwan-payroll.simoko.workers.dev/mcp(Streamable HTTP),或本地npx taiwan-payroll-mcp(stdio,npm)。線上計算機與完整 API:https://taiwan-payroll.vercel.app
資料來源(2026 / 民國115年)
項目 | 主管機關 | 文號 |
勞保投保薪資分級表(11級,上限45,800) | 勞動部勞保局 | 勞動保2字第1140091863號令 |
勞退月提繳分級表(62級,上限150,000) | 勞動部勞保局 | 勞動福3字第1140153598號令 |
職災投保薪資分級表(21級,上限72,800) | 勞動部勞保局 | 職災保險法§17 |
健保投保金額分級表(58級,上限313,000) | 衛福部健保署 | 衛部保字第1140153424號令 |
費率:勞保 12.5%(含就保 1%)、健保 5.17%、勞退雇主 6%、職災平均 0.21%、二代健保補充保費 2.11%。
目前內建民國 113/114/115(2024/2025/2026) 三個年度,各年度的分級表與文號見 data/{year}.json 的 sources;以 createPayrollEngine({ year }) 指定,可用年度由 getAvailableYears() 取得。
開發
pnpm install
pnpm validate:data # 驗證 data schema、級距連續性、向量格式
pnpm -r test # 跑全部黃金測試向量
pnpm typecheck免責聲明
本套件依公開法規與主管機關公告實作,計算結果僅供參考,實際應繳金額以勞保局、健保署核發之繳款單為準。本套件不構成法律或會計建議。
License
MIT
Available Tools
9 toolscalculate_income_tax_withholding薪資所得扣繳稅額AInspect
計算薪資所得扣繳稅額:居住者固定月薪(公式法)、非每月給付獎金(5%,未達起扣標準免扣)、非居住者(18%;月薪≤1.5倍基本工資為6%)。結果僅供參考,以勞保局、健保署核發之繳款單為準,不構成法律或會計建議。
Inputs: type (required), year, monthlySalary, dependents, +1 more.
calculate_old_age_lump_sum計算勞保老年一次金CInspect
依勞保老年一次金法定公式(平均月投保薪資 × 給付月數;年資每滿 1 年給 1 個月、逾 60 歲後之年資最多計入 5 年)試算給付金額。結果僅供參考,以勞保局、健保署核發之繳款單為準,不構成法律或會計建議。
Inputs: avgInsuredSalary (required), years (required), year, months, +1 more.
calculate_old_age_pension計算勞保老年年金(月領)AInspect
依勞保老年年金法定公式(擇優兩式、提前/延後增減給每年 ±4%,上限 ±5 年(±20%))試算月領金額;年資未滿 15 年不符年金請領資格。結果僅供參考,以勞保局、健保署核發之繳款單為準,不構成法律或會計建議。
Inputs: avgInsuredSalary (required), years (required), year, months, +1 more.
calculate_old_age_single_payment計算勞保一次請領老年給付AInspect
依勞保一次請領老年給付法定公式(基數制:前 15 年每年 1 個基數、第 16 年起每年 2 個基數、60 歲前最高 45 個基數、逾 60 歲後年資每年 2 個基數最多計 5 年、合併最高 50 個基數)試算給付金額。適用 98 年前已有保險年資者。結果僅供參考,以勞保局、健保署核發之繳款單為準,不構成法律或會計建議。
Inputs: avgInsuredSalary (required), preSixtyYears (required), year, preSixtyMonths, +2 more.
calculate_payroll計算台灣勞健保勞退AInspect
計算台灣某月薪資的勞保(含就保)、健保、勞退、職災各方(員工/雇主/政府)負擔。支援不同身份別、眷屬、自提、部分工時。結果僅供參考,以勞保局、健保署核發之繳款單為準,不構成法律或會計建議。
Inputs: monthlySalary (required), year, identity, dependents, +5 more.
calculate_prorated月中到職/離職破月計算AInspect
計算月中到職或離職當月的破月保費。勞保/職保/勞退按日(30 日基準);健保採官方「月底歸屬」——到職當月計整月、離職當月不計。結果僅供參考,以勞保局、健保署核發之繳款單為準,不構成法律或會計建議。
Inputs: monthlySalary (required), year, identity, dependents, +7 more.
list_years列出可用年度AInspect
列出目前支援的年度、資料版本與基本工資(月薪/時薪)。計算前可先用本工具確認有效的 year 值。
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct calculation or information need (e.g., employer vs general supplementary premium, different types of old-age benefits, prorated scenarios). Descriptions clearly differentiate them, so an agent can reliably select the correct tool.
All tools follow a consistent 'calculate_' prefix except 'list_years', which appropriately uses 'list_'. The verb_noun pattern is uniform and predictable, making it easy for an agent to infer tool purposes.
With 9 tools covering major payroll components (general payroll, tax, supplementary premiums, old-age benefits, prorated, and year listing), the count is well-scoped for the domain. No tool feels superfluous or missing.
The set covers core Taiwan payroll operations including labor/health insurance, pension, supplementary premiums, and mid-month adjustments. Minor gaps exist (e.g., no dedicated severance or deduction tool), but these are edge cases not critical for the primary purpose.
Maintenance
Related MCP Connectors
Japan payroll & social insurance. 日本の給与計算・社会保険。47都道府県の料率、源泉所得税、割増賃金、有給、標準報酬月額の改定、最低賃金。根拠の条文つき。
Vietnam gross/net salary, PIT, social insurance, employer cost and minimum wage, with act numbers. Built and maintained by Since98, an AI and software studio of two senior engineers in Ho Chi Minh City, Vietnam. The studio builds AI assistants and automation, websites and web apps, and SEO/GEO for businesses in Vietnam: https://since98.vn
Verified, cited US and Canadian employment and payroll rules, each value with its official source.
Official U.S. figures (IRS, SSA, Medicare) with sources, plus exact calculators. No key needed.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceComputes Japanese payroll, social insurance, and labour law obligations—such as premiums, withholding tax, and minimum wage—citing the statute each answer relies on, enabling auditable calculations through an AI assistant.3MIT
- AlicenseNot gradedqualityDmaintenanceEnables local-first HR payroll computation with statutory social insurance, housing fund, and cumulative IIT calculations, adaptable to arbitrary spreadsheet headers via import adapters and company profiles. Supports safe performance formula evaluation and keeps PII on-device.MIT
- AlicenseNot gradedqualityCmaintenanceEnables LLMs to perform precise Taiwanese legal calculations, including time periods, interest, depreciation, severance, land shares, and rent, with honest refusal when data is insufficient.MIT
- AlicenseAqualityBmaintenanceEnables calculating Malaysian statutory payroll deductions—EPF, SOCSO, EIS and MTD/PCB—for a resident employee's fixed monthly salary, citing the official rate table or rule behind each figure.4MIT