3.8% on the lesser of net investment income or the MAGI excess

One command on the Federal income tax server, callable over MCP as calculate_niit, filed in the registry as Net investment income tax. Every result carries the method it used, the rule pack it was pinned to, what is still missing and whether coverage was complete, for a licensed professional to review.

What it needs, and why

Every input is checked before anything is calculated. Nothing is required to start, and a field left blank means do not apply this rather than zero.

InputWhat it asks forWhy it mattersIf you omit it
niiNet investment incomeThe surtax applies to the lesser of net investment income and the excess over the threshold, so neither figure implies the other.defaults to 45000
magiMAGIThe surtax reaches only income above a MAGI threshold, so the excess is measured here rather than against taxable income.defaults to 260000
statusFiling status one of MFJ, SINGLE, HOH, MFSEvery band, threshold and exemption in the calculation is set by filing status.defaults to MFJ

Requests it answers

  • “Do I have to pay the 3.8% investment income surtax?”
  • “How much of my investment income does the surtax reach?”

An agent with these skills loaded picks the command from phrasing like that, asks for whatever input is missing, and reports the figures with the method that produced them.

Run it

python3 -m taxagent federal niit --nii 45000 --magi 260000 --status MFJ

The same command is exposed by taxagent-federal, so Claude, Claude Code, Codex, Cursor and any other MCP client can call it directly. Analysis only. No tool in this server places orders, modifies custodian records or files returns. This server holds no client data: every figure arrives in the call and nothing is stored. Results are estimates over those figures, not a return and not tax advice.

Scripted cases that exercise it

1 of the 71 console cases call this command on a real server over JSON-RPC and assert the outcome. Every one runs on every build, and all of them are listed on the case inventory.

CaseWhat it asksWhat it showsOutcome
federal-niit-thresholdSurtax on the lesser of investment income or the MAGI excessAt $260,000 MAGI only $10,000 is over the threshold, so the 3.8% applies to that, not to the whole $45,000 of investment income.completed

Limits it inherits from taxagent-federal

  • A return. AMT and the section 199A deduction are computed separately and are not folded into one liability.
  • Credits, self-employment tax and the additional Medicare tax.
  • State and local tax.

The server, its other 6 commands and what it deliberately leaves alone are on the Federal income tax page.