内容
# tax-workflow-mcp
A Claude Code MCP server + skill for end-to-end US personal income tax filing. Calculates your taxes, fills official IRS PDF forms, generates step-by-step filing instructions — all locally, with no external API required. Your sensitive data (SSN, bank info) never enters Claude's context.
## How It Works
```
You fill in taxpayer.json + taxpayer-private.json (one time)
|
Claude Code + tax-workflow skill
|
MCP Server reads your data locally
|
Calculates federal + state + NRA taxes
|
Fills official IRS PDF forms with pdf-lib
|
Generates filing summary (MD + PDF) with step-by-step instructions
|
Output: ready-to-file PDFs at ~/.tax-workflow/returns/YYYY/
```
**No external API needed.** The skill downloads official IRS fillable PDFs, fills them with your calculated tax data using `pdf-lib`, and saves completed forms locally. You print, sign, and mail — or use IRS Free File to e-file.
**Privacy by design.** Your data is split into two files:
- `taxpayer.json` (public) — income, deductions, credits. Claude sees this via MCP tools (sanitized).
- `taxpayer-private.json` (private) — SSN, DOB, address, bank account. **Claude never sees this.** Only the MCP server reads it at runtime.
### MCP Tools (10)
| Tool | Description |
|------|-------------|
| `get_filing_status` | Filing status, dependents, state (no SSN) |
| `list_income_sources` | Income totals by type (no EINs) |
| `analyze_deductions` | Standard vs. itemized comparison + credit eligibility |
| `calculate_tax` | Federal + state tax liability, effective rate, refund/owed |
| `generate_forms` | Fill official IRS PDF forms locally (or via tax API if configured) |
| `review_return` | Validate return completeness (pass/warn/fail checklist) |
| `submit_efile` | Submit to IRS via e-file API (requires API + explicit confirmation) |
| `check_efile_status` | Poll e-file acceptance status |
| `get_state_summary` | State filing requirements, residency status, calculator availability |
| `calculate_spt` | Run Substantial Presence Test for residency determination |
## Quick Start
### 1. Clone and build
```bash
git clone git@github.com:PeterGuk540/tax-workflow.git
cd tax-workflow
npm install
npm run build
```
### 2. Create your data files
```bash
mkdir -p ~/.tax-workflow
# Public data (income, deductions — Claude can see via MCP)
cp templates/taxpayer-template.json ~/.tax-workflow/taxpayer.json
# Private data (SSN, address, bank — Claude NEVER sees this)
cp templates/taxpayer-private-template.json ~/.tax-workflow/taxpayer-private.json
# API credentials (optional — not needed for individual taxpayers)
cp templates/credentials-template.env ~/.tax-workflow/credentials.env
# Secure all files
chmod 600 ~/.tax-workflow/taxpayer.json ~/.tax-workflow/taxpayer-private.json ~/.tax-workflow/credentials.env
```
### 3. Fill in your data
**Public file** (`~/.tax-workflow/taxpayer.json`):
- Filing status, residency type
- Income: W-2 wages, 1099-INT, 1099-DIV, 1099-B, 1099-NEC, etc.
- Deductions: mortgage interest, SALT, charitable, HSA, student loans
- Credits: children, education, energy
- State residency
**Private file** (`~/.tax-workflow/taxpayer-private.json`):
- SSN
- Date of birth
- Full address
- Bank account (for direct deposit refund)
- Prior year AGI (for e-file identity verification)
### 4. Register in Claude Code
Add to `~/.claude/settings.json`:
```json
{
"mcpServers": {
"tax-workflow": {
"command": "node",
"args": ["/absolute/path/to/tax-workflow/dist/index.js"]
}
}
}
```
Replace `/absolute/path/to/tax-workflow` with the actual path where you cloned the repo.
### 5. Generate your tax forms
**Option A — Via Claude Code (interactive):**
Restart Claude Code and say: *"Help me file my taxes"*
Claude will walk you through the 6-phase workflow, calling MCP tools to calculate and generate forms.
**Option B — Direct script (non-interactive):**
```bash
cd /path/to/tax-workflow
npx tsx scripts/generate-my-return.ts
```
This generates all forms + filing summary in one shot.
### 6. Review and file
Your completed forms are at `~/.tax-workflow/returns/YYYY/`:
```
f1040.pdf # Filled Form 1040 (federal return)
f1040s1.pdf # Schedule 1 (if needed)
f1040sd.pdf # Schedule D (capital gains/losses)
f8949.pdf # Form 8949 (transaction details)
il-1040.pdf # State return (IL, CA, or NY)
FILING-SUMMARY.md # Step-by-step filing instructions (markdown)
FILING-SUMMARY.pdf # Same instructions as PDF
MAILING-PACKET.md # Mailing instructions (if forms require mail)
```
The **FILING-SUMMARY.pdf** contains everything you need: tax summary, where to mail, how to e-file, payment instructions, deadlines, and a filing checklist.
## Supported Forms (24)
### Federal
| Form | Purpose |
|------|---------|
| Form 1040 | Standard income tax return |
| Form 1040-NR | Non-resident alien return |
| Form 1040-V | Payment voucher |
| Form 1040-X | Amended return |
| Form 4868 | Extension request |
| Schedule 1 | Additional income / above-the-line deductions |
| Schedule 2 | AMT / additional taxes |
| Schedule 3 | Additional credits |
| Schedule A | Itemized deductions |
| Schedule B | Interest / dividends (>$1,500) |
| Schedule C | Self-employment income |
| Schedule D | Capital gains / losses |
| Schedule E | Rental income |
| Schedule EIC | Earned income credit |
| Schedule SE | Self-employment tax |
| Form 8949 | Securities transaction details |
| Form 8889 | HSA |
| Form 8863 | Education credits |
| Form 8812 | Child tax credit |
| Form 8843 | Exempt individuals (F/J/M/Q visa) |
| Form 8833 | Treaty disclosure |
### State
| Form | State |
|------|-------|
| IL-1040 | Illinois (flat 4.95%) |
| CA 540 | California (9 brackets, 1%–12.3%) |
| NY IT-201 | New York (8 brackets + NYC tax) |
## Supported Income Types
- W-2 (employment)
- 1099-NEC (freelance/contract)
- 1099-INT (interest)
- 1099-DIV (dividends)
- 1099-B (capital gains — stocks, options, crypto)
- 1099-R (retirement distributions)
- SSA-1099 (Social Security)
- Schedule E (rental income)
## State Tax Support
Built-in calculators for CA, NY, and IL. No-income-tax states (TX, FL, AK, NV, SD, WA, WY) are auto-detected. Other states are flagged for manual filing.
## Non-Resident Alien (NRA) Support
- **Substantial Presence Test** calculator with F/J/M/Q visa exemptions
- **Form 1040-NR** — US-sourced income only, no standard deduction
- **Dual-status returns** — 1040 + 1040-NR with proportional income allocation
- **Form 8843** — auto-generated for exempt individuals (must be mailed)
- **Tax treaties** — 10 pre-populated (China, India, South Korea, Japan, Canada, UK, Germany, France, Mexico, Brazil)
- **Form 8833** — auto-generated when treaty benefits claimed
## Security Model
| Data | Where it lives | Claude sees it? |
|------|---------------|----------------|
| SSN, DOB, address, bank account | `taxpayer-private.json` | **Never** |
| Income, deductions, credits | `taxpayer.json` | Yes, via MCP (sanitized) |
| Filled PDF forms | `~/.tax-workflow/returns/` | Never (only file paths) |
| API credentials | `credentials.env` | Never |
- All files `chmod 600` (owner-read only)
- Private data only read by MCP server at runtime
- Filled PDFs stay local, never pushed to any remote
- `~/.tax-workflow/` is excluded from git via `.gitignore`
## API (Optional)
**No API is needed for individual taxpayers.** The skill fills IRS PDFs locally.
If you have access to a tax preparation API (for automated e-filing), configure it in `~/.tax-workflow/credentials.env`:
```env
TAX_API_KEY=your-api-key
TAX_API_BASE_URL=https://api.example.com
```
The `generate_forms` tool automatically detects whether an API is configured and falls back to local PDF filling if not.
## Development
```bash
npm test # Run tests (163 tests, 27 files)
npm run test:watch # Watch mode
npm run dev # Dev mode (tsx, no build)
npm run build # Production build
```
### Project Structure
```
src/
index.ts # MCP server entry point (10 tools)
schema.ts # Zod schema for taxpayer data validation
config.ts # Loads public + private data, merges, validates
sanitize.ts # Strips sensitive fields from MCP responses
tax-calculator.ts # Federal tax brackets, AGI, deductions, credits
filing-summary.ts # Generates filing instructions (MD + PDF)
irs-addresses.ts # State -> IRS mailing address mapping
api-client.ts # HTTP client for optional tax API
tools/ # 10 MCP tool handlers
state-tax/ # State calculators (CA, NY, IL) + registry
nra/ # NRA support (SPT, treaties, 8843, dual-status)
form-filler/ # PDF form filling (24 form mappers + orchestrator)
utils/ # Retry wrapper, workflow status tracker
scripts/
generate-my-return.ts # Direct form generation script
inspect-pdf-fields.ts # PDF field name discovery utility
templates/
taxpayer-template.json # Public data template
taxpayer-private-template.json # Private data template (SSN, address)
credentials-template.env # Optional API credentials
irs-forms/2025/ # 24 bundled official IRS/state PDFs
tests/ # 163 tests across 27 files
```
## License
MIT