@nannykeeper/mcp-server 1.17.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +5 -2
- package/CLAUDE.md +10 -1
- package/README.md +46 -3
- package/dist/context.d.ts +8 -0
- package/dist/context.js +6 -0
- package/dist/params.d.ts +11 -0
- package/dist/params.js +15 -0
- package/dist/public-profile.js +4 -3
- package/dist/server.d.ts +6 -3
- package/dist/server.js +23 -15
- package/dist/tools/autopilot.js +3 -2
- package/dist/tools/calculate.js +2 -1
- package/dist/tools/household.js +3 -1
- package/dist/tools/list-payrolls.d.ts +26 -0
- package/dist/tools/list-payrolls.js +82 -0
- package/dist/tools/preview-payroll.d.ts +2 -0
- package/dist/tools/preview-payroll.js +6 -1
- package/dist/tools/reimbursements.d.ts +38 -0
- package/dist/tools/reimbursements.js +46 -0
- package/dist/tools/run-payroll.d.ts +2 -0
- package/dist/tools/run-payroll.js +6 -1
- package/dist/tools/state-filing-status.js +2 -1
- package/dist/tools/tax-payment.d.ts +34 -0
- package/dist/tools/tax-payment.js +130 -0
- package/dist/tools/threshold.js +2 -1
- package/dist/tools/void-payroll.d.ts +38 -0
- package/dist/tools/void-payroll.js +106 -0
- package/manifest.json +2 -2
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -7,16 +7,19 @@ Calculate US household employer (nanny) taxes for all 50 states + DC.
|
|
|
7
7
|
- `calculate_nanny_taxes(state, annual_wages, pay_frequency?)` — returns full tax breakdown
|
|
8
8
|
- `check_threshold(state, annual_wages, tax_year?)` — checks if employer obligations apply
|
|
9
9
|
- `list_employees(employer_id?)` — returns the household's employer_id and every employee_id. Call it first; never invent IDs
|
|
10
|
-
- `preview_payroll(employee_id, ..., employer_id?)` — previews payroll without creating a record
|
|
11
|
-
- `run_payroll(employee_id, ..., employer_id?)` — run payroll with full tax calc, YTD tracking, and DB persistence (Starter+ required)
|
|
10
|
+
- `preview_payroll(employee_id, ..., reimbursements?, employer_id?)` — previews payroll without creating a record. Mileage goes in `reimbursements` as `{type: "mileage", miles, amount: 0}`
|
|
11
|
+
- `run_payroll(employee_id, ..., reimbursements?, employer_id?)` — run payroll with full tax calc, YTD tracking, and DB persistence (Starter+ required)
|
|
12
12
|
- `get_payroll(payroll_id?, employer_id?)` — reads one payroll (every deduction, net pay, status) or lists them
|
|
13
|
+
- `list_payrolls(employee_id?, pay_date_from?, pay_date_to?, limit?, cursor?, employer_id?)` — the household's payrolls, newest first, with the employee_ids each paid; filter by employee and pay date. Use `limit: 3` for the last three
|
|
13
14
|
- `get_pay_stub(payroll_id, employer_id?)` — returns each employee's pay stub PDF
|
|
14
15
|
- `get_w2(employee_id, tax_year, copy?, employer_id?)`: returns `download_url`, a link that works for 15 minutes, for one copy of a W-2 the household has already generated in NannyKeeper. Give the user the link and tell them to open it in their browser. Never the PDF, and never open the link yourself. Never generates a W-2
|
|
15
16
|
- `get_schedule_h(tax_year, employer_id?)`: returns `download_url`, a link that works for 15 minutes, for the household's Schedule H, or `schedule_h_unavailable` with a reason. Give the user the link
|
|
16
17
|
- `get_quarter_taxes(year, quarter, employer_id?)`: the quarter as the household's Taxes page shows it, with the checklist of what to pay or file and by when. A null amount means NannyKeeper will not stand behind a figure yet; give the `waiting_on` reason and never report it as $0
|
|
18
|
+
- `record_tax_payment(year, quarter, destination, expected_amount | amount, closes_filing?, idempotency_key, employer_id?)`: record that the household PAID a quarter's tax (federal or a state destination id); reminders stop once it covers what is owed (a state `amount` below that is an installment unless `closes_filing`). It only adds a payment: corrections go to the Taxes page. Only after the user says they paid; NannyKeeper never sends the payment. `figures_changed` means the figure moved: show the new one and ask before retrying
|
|
17
19
|
- `get_state_filing_status(employer_id?)` — reads masked state-account status. Pass an owned household ID when selecting a household; test-mode keys must explicitly select a sandbox household. Omitting it uses the key's default household. Each account carries `registered` / `pending` / `required` / `not_required`; `not_required` means this household does not owe that registration at all, so never tell them to go register for it.
|
|
18
20
|
- `get_autopilot(employer_id?, employee_id?)` — reads existing Autopilot enrollments
|
|
19
21
|
- `manage_autopilot(employee_id, action, ..., employer_id?)` — pauses, resumes, skips, or disables an existing enrollment; never enrolls
|
|
22
|
+
- `void_payroll(payroll_id, confirmation_code?, reason?, employer_id?)`: voids a payroll that has not moved money (a draft, or a scheduled direct deposit whose debit has not started), in two steps. Call it with `payroll_id` only first: nothing is voided, and you get the payroll and a `confirmation_code`. Show the user the payroll and get their yes, then call again with the code and a reason. A payroll with money on the move, or a completed one, is refused with `app_url`: give the user that link and do not retry
|
|
20
23
|
|
|
21
24
|
## When to Use
|
|
22
25
|
- User asks about nanny taxes, household employer taxes, or paying a caregiver
|
package/CLAUDE.md
CHANGED
|
@@ -10,15 +10,18 @@ Calculate nanny taxes for all 50 US states.
|
|
|
10
10
|
- `get_w2`: a 15-minute DOWNLOAD LINK (`download_url`) for one copy of an employee's W-2 for an ended tax year. ⛔ Never the PDF: a W-2 prints the full SSN and a tool result is read by the assistant's model, so the tool always asks the API for `delivery: "link"` and the person opens the link. Do not "align" it with `get_pay_stub`'s attached file. Only a W-2 the household already generated in the dashboard; never generates one (`w2_not_generated`). Hosted and npm identical (added 1.16.0)
|
|
11
11
|
- `get_schedule_h`: a 15-minute download link for the household's Schedule H for an ended tax year, through the dashboard's own Download procedure; its refusals come back as `schedule_h_unavailable` with a `reason`. A link for the same reason as `get_w2` (added 1.16.0)
|
|
12
12
|
- `get_quarter_taxes`: a quarter's tax figures as the Taxes page shows them, from `GET /api/v1/taxes/quarterly`, passed through unchanged. ⛔ Never summarise it in the tool: a null amount is NannyKeeper refusing to state a figure (`waiting_on`), and a summary is where a null becomes a 0 (added 1.17.0)
|
|
13
|
+
- `record_tax_payment`: records a payment the household made, through `POST /api/v1/taxes/payments`, which drives the Taxes page's own `markFederalPaid` / `recordDestinationPayment`. ⛔ Never a parallel write path, and never a figure nobody saw: `expected_amount` must equal what `get_quarter_taxes` states, `amount` is the household's own. Registered from its own module (`registerRecordTaxPayment`). `idempotency_key` is required and sent as the Idempotency-Key header. `closes_filing` (state, with `amount`) is the page's "I paid a different amount". Annotated destructive: it turns off reminders (added 1.19.0)
|
|
14
|
+
- `list_payrolls`: the household's payrolls from `GET /api/v1/payrolls`, newest first, filtered by `employee_id` and an inclusive `pay_date_from`/`pay_date_to`, each naming the `employee_ids` it paid. Passed through unchanged. Registered from its own module, `tools/list-payrolls.ts` (added 1.18.0)
|
|
13
15
|
- `calculate_nanny_taxes` — Full federal + state tax breakdown
|
|
14
16
|
- `check_threshold` — Whether wages trigger employer tax obligations
|
|
15
17
|
- `preview_payroll` — Dry-run payroll calc, returns taxes/net pay without creating a record (Starter+ required)
|
|
16
18
|
- `run_payroll` — End-to-end payroll: create, approve, and process (or schedule) in a single call. Finalized response reflects real status (`processing` / `pending_funding` / `completed` / **`scheduled`** as of 1.5.0). No UI intervention needed. (Starter+ required)
|
|
17
19
|
- `get_autopilot` — Read Autopilot (recurring auto-run payroll) status for an employee, or list an employer's active enrollments (Plus/Professional, `ach` scope)
|
|
18
20
|
- `manage_autopilot` — Pause / resume / skip / disable an existing enrollment. **Enrolling is NOT exposed** — it captures a standing recurring ACH authorization that must be employer-driven in-app. (Plus/Professional, `ach` scope) — added 1.9.0
|
|
21
|
+
- `void_payroll`: the two-step safe void over `POST /api/v1/payroll/:id/void`. The first call writes nothing and returns the payroll and a 10-minute confirmation code bound to that payroll and key; only the second call, with the code and a reason, voids, through the app's own `voidPayroll`. ⛔ Only a draft or a scheduled direct deposit whose debit has not started; everything else is refused with an app link. The tool passes the API through and never retries or mints a code itself. Registered from its own module, `tools/void-payroll.ts`
|
|
19
22
|
- `get_state_filing_status` — The employer's state agency accounts (UC, withholding, SDI) per state, last-four only. Each account has a status: `registered`, `pending`, `required`, or `not_required`. ⛔ `not_required` means this household genuinely does not owe that registration — most often because they and their employee agreed not to withhold state income tax — so never tell them to go register for it. A registration URL is returned only where there is still something to open or finish. Takes an optional `employer_id` — omit it for a single-household account; a **test-mode key must pass one**, because a key's default household is always the real one and the endpoint enforces the test/live boundary.
|
|
20
23
|
|
|
21
|
-
**Declare tool parameters in `server.
|
|
24
|
+
**Declare tool parameters in the `server.tool()` call, never in the tool descriptor.** A tool is either registered in `server.ts` or, from 1.18.0, from its own module through a `register<Tool>(server, context)` function that `server.ts` calls (`tools/list-payrolls.ts`), so a new tool does not edit another's registration. `server.tool()` takes its own zod shape, so an `inputSchema` on the exported descriptor is read by nothing. The same applies to the tool description: the registering call must import the descriptor's `name` and `description` rather than restating them, or the copy an agent actually reads can drift from the one being edited. `index.ts` only starts the stdio transport. Hosted callers pass request-scoped credentials to the same server factory.
|
|
22
25
|
|
|
23
26
|
## Autopilot (get_autopilot, manage_autopilot)
|
|
24
27
|
Autopilot auto-runs each period's payroll onto the existing scheduled-fire path so a household never misses a paycheck. The MCP surface is **manage-only**: read status/enrollments and pause/resume/skip/disable. Turning it ON must happen in the app (standing ACH authorization = employer-driven consent), so there is no enroll tool — `POST /api/v1/autopilot/enroll` returns 403 pointing back to the app. `skip` with `through_date` skips every period up to that date (vacation). Confirm any management action with the user before calling.
|
|
@@ -35,6 +38,9 @@ API callers with direct-deposit payments must tick the same safety gates the UI
|
|
|
35
38
|
|
|
36
39
|
These flags exist even for server-to-server callers as a safety measure. Agents should only set them after verifying the amounts with the user.
|
|
37
40
|
|
|
41
|
+
## Reimbursements (run_payroll, preview_payroll)
|
|
42
|
+
`reimbursements` is the API's `employees[].reimbursements`, sent through unchanged: up to 10 lines of `{ type, amount, description?, miles?, rate_per_mile? }`. ⛔ Its schema lives in `tools/reimbursements.ts` and must keep the API's exact limits; a test in the application repository holds the two to the same boundaries. A mileage line with miles is priced by the API (amount 0), at `rate_per_mile` when sent, else at the IRS rate the API holds for the pay period and pay date; a year it holds none for answers `mileage_rate_unavailable`. The one array input in the server, which is why `MAX_TOOL_INPUT_ELEMENTS` names it.
|
|
43
|
+
|
|
38
44
|
## Voluntary set-aside (run_payroll, preview_payroll)
|
|
39
45
|
The optional `voluntary_set_aside: { skip?, amount? }` field overrides the employee's recurring set-aside rule for a single paycheck. The recurring rule (e.g., 2% of gross for OH municipal courtesy withholding) is configured via the dashboard — this field can only override or skip per-payroll. Omit the field to apply the rule normally.
|
|
40
46
|
|
|
@@ -65,3 +71,6 @@ Get employee_id (and the household's employer_id) from `list_employees`.
|
|
|
65
71
|
household the key belongs to. Pass it only when one account manages several.
|
|
66
72
|
|
|
67
73
|
Full API docs: https://www.nannykeeper.com/developers/reference
|
|
74
|
+
|
|
75
|
+
## Client label
|
|
76
|
+
Every API request carries `X-NannyKeeper-Client: mcp` (`CLIENT_HEADER` in `context.ts`), so the API can count MCP use of an endpoint apart from direct API use. It is a label only and grants nothing. A new tool's fetch spreads it like the others.
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ MCP server for calculating US household employer (nanny) taxes. Works with Claud
|
|
|
15
15
|
"mcpServers": {
|
|
16
16
|
"nannykeeper": {
|
|
17
17
|
"command": "npx",
|
|
18
|
-
"args": ["@nannykeeper/mcp-server"],
|
|
18
|
+
"args": ["-y", "@nannykeeper/mcp-server@latest"],
|
|
19
19
|
"env": {
|
|
20
20
|
"NANNYKEEPER_API_KEY": "nk_live_YOUR_KEY"
|
|
21
21
|
}
|
|
@@ -31,7 +31,7 @@ MCP server for calculating US household employer (nanny) taxes. Works with Claud
|
|
|
31
31
|
Run this once in your terminal, with your own key in place of `nk_live_YOUR_KEY`:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
claude mcp add nannykeeper --env NANNYKEEPER_API_KEY=nk_live_YOUR_KEY -- npx -y @nannykeeper/mcp-server
|
|
34
|
+
claude mcp add nannykeeper --env NANNYKEEPER_API_KEY=nk_live_YOUR_KEY -- npx -y @nannykeeper/mcp-server@latest
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Start `claude` and run `/mcp` to see the NannyKeeper tools. Add `--scope user` to use it in every project.
|
|
@@ -39,9 +39,10 @@ Start `claude` and run `/mcp` to see the NannyKeeper tools. Add `--scope user` t
|
|
|
39
39
|
## Running payroll from an agent
|
|
40
40
|
|
|
41
41
|
1. `list_employees` returns your household's `employer_id` and each employee's `employee_id`.
|
|
42
|
-
2. `preview_payroll` with the period and
|
|
42
|
+
2. `preview_payroll` with the period, hours and any mileage (`reimbursements`). Check the figures with the person you are working for.
|
|
43
43
|
3. `run_payroll` with the same inputs and an `idempotency_key`.
|
|
44
44
|
4. `get_payroll` confirms the status and every deduction; `get_pay_stub` returns the stub PDF.
|
|
45
|
+
5. `list_payrolls` answers "what did I pay her last time?" and "show my last three payrolls", filtered by employee and pay date.
|
|
45
46
|
|
|
46
47
|
`employer_id` is optional on every tool: leave it out and the API uses the household your key belongs to.
|
|
47
48
|
|
|
@@ -62,6 +63,17 @@ With `payroll_id`, read one payroll: status, dates, and each employee's gross pa
|
|
|
62
63
|
- `payroll_id` (optional) — A payroll ID from `run_payroll`
|
|
63
64
|
- `employer_id` (optional) — Only when listing for one of several households
|
|
64
65
|
|
|
66
|
+
### `list_payrolls`
|
|
67
|
+
|
|
68
|
+
The household's payrolls, newest first, each with status, pay period, pay date, totals and the `employee_ids` it paid. Totals are for the whole payroll; `get_payroll` has each employee's figures. Read-only (added 1.18.0).
|
|
69
|
+
|
|
70
|
+
**Parameters:**
|
|
71
|
+
- `employee_id` (optional) — Only payrolls that paid this employee. One not in the household answers `not_found`
|
|
72
|
+
- `pay_date_from`, `pay_date_to` (optional) — Inclusive pay-date range (YYYY-MM-DD)
|
|
73
|
+
- `limit` (optional) — 1–100, default 25. Use 3 for "the last three payrolls"
|
|
74
|
+
- `cursor` (optional) — The `next_cursor` from the previous call
|
|
75
|
+
- `employer_id` (optional) — Only when one account manages several households
|
|
76
|
+
|
|
65
77
|
### `get_pay_stub`
|
|
66
78
|
|
|
67
79
|
The pay stub PDF for each employee on a payroll, the same stub the household downloads in the dashboard, attached as a PDF file.
|
|
@@ -108,6 +120,35 @@ A null amount means NannyKeeper will not stand behind a figure yet, and `waiting
|
|
|
108
120
|
- `quarter` (required): 1 to 4
|
|
109
121
|
- `employer_id` (optional)
|
|
110
122
|
|
|
123
|
+
### `record_tax_payment`
|
|
124
|
+
|
|
125
|
+
Record that the household paid a quarter's tax to the IRS or a state agency, as the Taxes page's "I've paid this" does; once the payment covers what is owed, NannyKeeper stops reminding them about it. NannyKeeper never sends the payment: call it only after the household has paid (added 1.19.0). Read the quarter with `get_quarter_taxes` first.
|
|
126
|
+
|
|
127
|
+
Send exactly one figure. `expected_amount` means they paid what NannyKeeper showed (`federal.due_now`, or the destination's `amount_owed`), and it must still be the current figure: if a payroll changed it, the answer is `figures_changed` with `current_amount`, and nothing is recorded. `amount` is what they actually paid; for a state agency it is an installment unless it covers what is owed or you also send `closes_filing: true` (the agency billed that amount and it settles the filing). `already_recorded: true` means nothing new was written, and `already_recorded_different` means a different payment is already on file. The tool only adds a payment; corrections are made on the Taxes page.
|
|
128
|
+
|
|
129
|
+
**Parameters:**
|
|
130
|
+
- `year` (required): the tax year, for example 2026
|
|
131
|
+
- `quarter` (required): 1 to 4
|
|
132
|
+
- `destination` (required): `federal`, or a `state_destinations` id from `get_quarter_taxes`
|
|
133
|
+
- `expected_amount` or `amount` (exactly one)
|
|
134
|
+
- `idempotency_key` (required): a new unique key per payment; reuse it only to retry that payment
|
|
135
|
+
- `payment_date` (optional): YYYY-MM-DD, defaults to today in US Eastern time
|
|
136
|
+
- `closes_filing` (optional, with `amount`, state agencies only)
|
|
137
|
+
- `payment_method`, `confirmation_number`, `notes` (optional)
|
|
138
|
+
- `employer_id` (optional)
|
|
139
|
+
|
|
140
|
+
### `void_payroll`
|
|
141
|
+
|
|
142
|
+
Void a payroll that has not moved any money: a draft, or a scheduled direct deposit whose bank debit has not started. Two calls, never one. The first, with `payroll_id` only, voids nothing and returns the payroll (employees, pay period, gross, pay date) and a `confirmation_code` that works for 10 minutes for that payroll and key. Show the user the payroll and get their confirmation, then call again with the code and a `reason`.
|
|
143
|
+
|
|
144
|
+
A payroll with money already on the move, or a completed one, is refused with `payroll_not_voidable_via_api` and an `app_url`: the user voids it in the NannyKeeper app. A payroll whose debit started between the two calls is refused the same way at the second call. A refused code (`confirmation_expired`, `confirmation_invalid`, `payroll_changed`) voids nothing; start again from the first call.
|
|
145
|
+
|
|
146
|
+
**Parameters:**
|
|
147
|
+
- `payroll_id` (required)
|
|
148
|
+
- `confirmation_code` (optional): left out on the first call
|
|
149
|
+
- `reason` (required with the code)
|
|
150
|
+
- `employer_id` (optional)
|
|
151
|
+
|
|
111
152
|
### `calculate_nanny_taxes`
|
|
112
153
|
|
|
113
154
|
Calculate employer and employee tax obligations for a household employee.
|
|
@@ -142,6 +183,7 @@ Dry-run payroll calculation. Returns the full tax breakdown, net pay, and employ
|
|
|
142
183
|
- `bonus` (optional) — Bonus amount
|
|
143
184
|
- `other_earnings` (optional) — Other earnings
|
|
144
185
|
- `voluntary_set_aside` (optional, v1.6.0+) — Override or skip the employee's recurring voluntary set-aside rule for this paycheck only. Object with `skip` (boolean) or `amount` (number, $0–$9,999). The recurring rule is configured via the dashboard; omit this field to apply it normally.
|
|
186
|
+
- `reimbursements` (optional, v1.18.0+) — Up to 10 reimbursement lines paid with this paycheck, which NannyKeeper adds to net pay without calculating tax on them, the same lines the API takes: `{ type, amount, description?, miles?, rate_per_mile? }`. `type` is `transit`, `parking`, `mileage` or `other`; `amount` $0–$9,999; `miles` 0–9,999; `rate_per_mile` $0–$5. For mileage send the miles and `amount: 0`: NannyKeeper prices the miles at the IRS rate it holds for the pay period and pay date unless you pass `rate_per_mile`, and refuses a year it holds no rate for with `mileage_rate_unavailable`.
|
|
145
187
|
|
|
146
188
|
### `run_payroll`
|
|
147
189
|
|
|
@@ -165,6 +207,7 @@ Run payroll for a household employee **end-to-end in a single call** — creates
|
|
|
165
207
|
- `confirm_large_payroll` (optional) — Required for direct-deposit payrolls with total net pay >$5,000 or any single net pay >$3,000
|
|
166
208
|
- `confirm_ach_debit` (optional) — Required for first-ever DD payroll or when >30 days have elapsed since the last DD authorization
|
|
167
209
|
- `voluntary_set_aside` (optional, v1.6.0+) — Override or skip the employee's recurring voluntary set-aside rule for this paycheck only. Object with `skip` (boolean) or `amount` (number, $0–$9,999). The recurring rule is configured via the dashboard; omit this field to apply it normally.
|
|
210
|
+
- `reimbursements` (optional, v1.18.0+) — Up to 10 reimbursement lines paid with this paycheck, which NannyKeeper adds to net pay without calculating tax on them, the same lines the API takes: `{ type, amount, description?, miles?, rate_per_mile? }`. `type` is `transit`, `parking`, `mileage` or `other`; `amount` $0–$9,999; `miles` 0–9,999; `rate_per_mile` $0–$5. For mileage send the miles and `amount: 0`: NannyKeeper prices the miles at the IRS rate it holds for the pay period and pay date unless you pass `rate_per_mile`, and refuses a year it holds no rate for with `mileage_rate_unavailable`.
|
|
168
211
|
- `idempotency_key` (optional) — Prevent duplicate payroll creation
|
|
169
212
|
|
|
170
213
|
### `get_state_filing_status`
|
package/dist/context.d.ts
CHANGED
|
@@ -5,3 +5,11 @@ export interface ToolContext {
|
|
|
5
5
|
publicConnection?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare function getToolContext(context?: ToolContext): ToolContext;
|
|
8
|
+
/**
|
|
9
|
+
* Sent with every API request. A label that lets NannyKeeper count MCP use of
|
|
10
|
+
* an endpoint separately from direct API use of the same endpoint; the API
|
|
11
|
+
* never grants or refuses anything because of it.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CLIENT_HEADER: {
|
|
14
|
+
readonly "X-NannyKeeper-Client": "mcp";
|
|
15
|
+
};
|
package/dist/context.js
CHANGED
|
@@ -4,3 +4,9 @@ export function getToolContext(context) {
|
|
|
4
4
|
apiBase: process.env.NANNYKEEPER_API_URL || "https://www.nannykeeper.com",
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Sent with every API request. A label that lets NannyKeeper count MCP use of
|
|
9
|
+
* an endpoint separately from direct API use of the same endpoint; the API
|
|
10
|
+
* never grants or refuses anything because of it.
|
|
11
|
+
*/
|
|
12
|
+
export const CLIENT_HEADER = { "X-NannyKeeper-Client": "mcp" };
|
package/dist/params.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* `employer_id` on every household tool (1.15.0). The API defaults it to the
|
|
4
|
+
* household the key belongs to, so a single-household caller never needs it.
|
|
5
|
+
* Do not make it required again: list_employees is the only place an agent
|
|
6
|
+
* can learn it, and a required parameter it cannot fill stops the flow.
|
|
7
|
+
*
|
|
8
|
+
* Shared, never copied: a tool registered from its own module imports it
|
|
9
|
+
* here, so a change reaches every tool.
|
|
10
|
+
*/
|
|
11
|
+
export declare const EMPLOYER_ID_OPTIONAL: z.ZodOptional<z.ZodString>;
|
package/dist/params.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* `employer_id` on every household tool (1.15.0). The API defaults it to the
|
|
4
|
+
* household the key belongs to, so a single-household caller never needs it.
|
|
5
|
+
* Do not make it required again: list_employees is the only place an agent
|
|
6
|
+
* can learn it, and a required parameter it cannot fill stops the flow.
|
|
7
|
+
*
|
|
8
|
+
* Shared, never copied: a tool registered from its own module imports it
|
|
9
|
+
* here, so a change reaches every tool.
|
|
10
|
+
*/
|
|
11
|
+
export const EMPLOYER_ID_OPTIONAL = z
|
|
12
|
+
.string()
|
|
13
|
+
.uuid()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Optional. Leave it out to use the household your API key belongs to. Pass it only when one account manages several households; list_employees returns it.");
|
package/dist/public-profile.js
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
export const publicDescriptions = {
|
|
3
3
|
calculate_nanny_taxes: "Estimate household payroll taxes using the NannyKeeper calculator. Provide work state, annual wages, and pay frequency; include residence state when different. These estimates do not incorporate an existing employee's year-to-date payroll. Use preview_payroll for an existing employee. The calculator has no family-relationship input, so its taxes assume no family exemption applies. threshold.action_required is true or null, never false; present null as not determined. Preserve any limitations or unassessed items returned by the API.",
|
|
4
4
|
check_threshold: "Check the supported annual wage threshold assessment for one household employee. This tool has no household-wide quarterly wages or family-relationship input. federal.action_required is true or null, never false; present null as not determined. Preserve the API's limitations and unassessed items; do not present its result as a complete determination of obligations.",
|
|
5
|
-
preview_payroll: "Preview payroll for an existing household employee without creating a payroll record. Review the returned pay date, gross and net pay, employer costs, warnings, and any estimated status with the user before running payroll. The account must already have access to payroll. Get employee IDs from list_employees; never invent them.",
|
|
6
|
-
run_payroll: "Create, approve, and process payroll for an existing household employee. Check and cash record payments the employer handles themselves. Direct deposit initiates or schedules NannyKeeper processing through Stripe. First preview the same inputs and obtain explicit confirmation of the employee, period, pay date, amounts, and payment method. Set debit or large-payroll confirmation flags only after the user explicitly authorizes the corresponding action. Use one idempotency_key per approved payroll and reuse it on a retry with identical inputs. Do not retry a rejected payroll with changed dates, payment method, confirmation flags, or off_cycle to bypass a safeguard. Report the exact returned status; scheduled or processing does not mean paid.",
|
|
5
|
+
preview_payroll: "Preview payroll for an existing household employee without creating a payroll record. Pass mileage and other reimbursements in reimbursements, as run_payroll takes them. Review the returned pay date, gross and net pay, employer costs, warnings, and any estimated status with the user before running payroll. The account must already have access to payroll. Get employee IDs from list_employees; never invent them.",
|
|
6
|
+
run_payroll: "Create, approve, and process payroll for an existing household employee. Check and cash record payments the employer handles themselves. Direct deposit initiates or schedules NannyKeeper processing through Stripe. Mileage and other reimbursements go in reimbursements (up to 10 lines; for mileage send the miles and amount 0). First preview the same inputs and obtain explicit confirmation of the employee, period, pay date, amounts, and payment method. Set debit or large-payroll confirmation flags only after the user explicitly authorizes the corresponding action. Use one idempotency_key per approved payroll and reuse it on a retry with identical inputs. Do not retry a rejected payroll with changed dates, payment method, confirmation flags, or off_cycle to bypass a safeguard. Report the exact returned status; scheduled or processing does not mean paid.",
|
|
7
7
|
get_state_filing_status: "Read masked state agency account status for the connected household. Use employer_id to select an authorized household when needed. Present returned registered, pending, required, and not_required states faithfully. This tool does not register an account or submit a filing. Do not infer that missing or unassessed information means no obligation.",
|
|
8
8
|
list_employees: "List the connected household's employees with their pay setup and what is still missing for payroll. Returns the employee IDs the payroll tools need. Read-only.",
|
|
9
|
-
get_payroll: "Read one payroll by ID, or list the household's payrolls. Returns status, dates, gross pay, each deduction, net pay, and employer taxes. Report the exact status; scheduled or processing does not mean paid.",
|
|
9
|
+
get_payroll: "Read one payroll by ID, or list the household's payrolls (list_payrolls filters that list by employee and pay date). Returns status, dates, gross pay, each deduction, net pay, and employer taxes. Report the exact status; scheduled or processing does not mean paid.",
|
|
10
10
|
get_pay_stub: "Get the pay stub PDF for each employee on a paid payroll, the same stub the household downloads in NannyKeeper. A payroll that is not paid yet answers payroll_not_completed. Safe to repeat.",
|
|
11
11
|
get_w2: "Get a download link for one copy of an employee's W-2 for a tax year that has ended. Returns download_url, a link on nannykeeper.com that works for 15 minutes; give it to the user and tell them to open it in their browser. This tool never returns the PDF, and you must not open the link yourself. The household generates the W-2 in NannyKeeper first; until then this answers w2_not_generated, and this tool never generates one. Safe to repeat.",
|
|
12
12
|
get_schedule_h: "Get a download link for the household's Schedule H for a tax year that has ended. Returns download_url, a link on nannykeeper.com that works for 15 minutes; give it to the user and tell them to open it in their browser. This tool never returns the PDF, and you must not open the link yourself. When NannyKeeper would not produce the form this answers schedule_h_unavailable with a reason; report that reason faithfully. NannyKeeper does not file the form. Safe to repeat.",
|
|
13
13
|
get_quarter_taxes: "Get a quarter's tax figures as the household's NannyKeeper Taxes page shows them: a checklist of what to pay or file, to whom and by when (an item of kind rec has no hard deadline this quarter but may still be owed), the optional federal estimated payment for the IRS installment, each state agency's due date and amount, and per-state lines. A null amount means NannyKeeper will not stand behind a figure yet; give the returned reason and never report it as $0 or nothing owed. NannyKeeper does not file or pay for the household. Safe to repeat.",
|
|
14
|
+
record_tax_payment: "Record that the household paid a quarter's tax to the IRS or a state agency; once that covers what is owed, NannyKeeper stops reminding them. NannyKeeper does not send the payment; call this only after the user says they paid. Read the quarter with get_quarter_taxes first. Send expected_amount when they paid the figure it showed, or amount with what they actually paid (add closes_filing for a state agency when that amount settles the filing). If the figure changed or NannyKeeper will not confirm one, show the user the returned reason and ask before trying again. Use one idempotency_key per payment and reuse it only to retry that payment. It only adds a payment: it cannot change or remove one already recorded, so send corrections to the Taxes page in NannyKeeper.",
|
|
14
15
|
get_autopilot: "Read existing recurring payroll enrollment status for a household, optionally for one employee. Returns status and available schedule information; it does not enroll anyone or change payroll.",
|
|
15
16
|
manage_autopilot: "Pause, resume, skip, or disable an existing recurring payroll enrollment. Confirm the employee and exact action before calling. Resume can restart future payroll generation and Stripe processing. Pausing does not cancel a payroll that is already scheduled. To cancel an existing payroll, use NannyKeeper. Initial enrollment and its standing authorization happen in NannyKeeper.",
|
|
16
17
|
};
|
package/dist/server.d.ts
CHANGED
|
@@ -4,9 +4,12 @@ import type { ToolContext } from "./context.ts";
|
|
|
4
4
|
* Cap on array elements plus object members in one tools/call `arguments`
|
|
5
5
|
* (GHSA-46jr-4wx8-v453). The SDK counts them before validation and
|
|
6
6
|
* has no limit unless one is set, so an object with tens of thousands of keys
|
|
7
|
-
* inside the 64KB body cap could exhaust memory.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* inside the 64KB body cap could exhaust memory. The one array input is
|
|
8
|
+
* `reimbursements` on preview_payroll and run_payroll: at most 10 lines of 5
|
|
9
|
+
* members, so the widest call (run_payroll, about 22 members plus 10 + 50 for
|
|
10
|
+
* a full set of lines) stays near 85, and 256 refuses nothing real. A test
|
|
11
|
+
* sends the largest valid run_payroll call through the real server to hold
|
|
12
|
+
* that. Raise this if an input grows past it.
|
|
10
13
|
*/
|
|
11
14
|
export declare const MAX_TOOL_INPUT_ELEMENTS = 256;
|
|
12
15
|
/** A fresh server and credential closure for each hosted request. */
|
package/dist/server.js
CHANGED
|
@@ -6,26 +6,23 @@ import { executePreviewPayroll } from "./tools/preview-payroll.js";
|
|
|
6
6
|
import { executeRunPayroll } from "./tools/run-payroll.js";
|
|
7
7
|
import { executeStateFilingStatus, stateFilingStatusTool, } from "./tools/state-filing-status.js";
|
|
8
8
|
import { executeGetAutopilot, executeManageAutopilot } from "./tools/autopilot.js";
|
|
9
|
+
import { reimbursementsParam } from "./tools/reimbursements.js";
|
|
10
|
+
import { registerListPayrolls } from "./tools/list-payrolls.js";
|
|
11
|
+
import { registerVoidPayroll } from "./tools/void-payroll.js";
|
|
12
|
+
import { EMPLOYER_ID_OPTIONAL } from "./params.js";
|
|
9
13
|
import { executeGetPayStub, executeGetW2, executeGetScheduleH, executeGetQuarterTaxes, executeGetPayroll, executeListEmployees, } from "./tools/household.js";
|
|
10
14
|
import { publicDescriptions, toolResult } from "./public-profile.js";
|
|
11
|
-
|
|
12
|
-
* `employer_id` on every household tool (1.15.0). The API defaults it to the
|
|
13
|
-
* household the key belongs to, so a single-household caller never needs it.
|
|
14
|
-
* Do not make it required again: list_employees is the only place an agent
|
|
15
|
-
* can learn it, and a required parameter it cannot fill stops the flow.
|
|
16
|
-
*/
|
|
17
|
-
const EMPLOYER_ID_OPTIONAL = z
|
|
18
|
-
.string()
|
|
19
|
-
.uuid()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe("Optional. Leave it out to use the household your API key belongs to. Pass it only when one account manages several households; list_employees returns it.");
|
|
15
|
+
import { registerRecordTaxPayment } from "./tools/tax-payment.js";
|
|
22
16
|
/**
|
|
23
17
|
* Cap on array elements plus object members in one tools/call `arguments`
|
|
24
18
|
* (GHSA-46jr-4wx8-v453). The SDK counts them before validation and
|
|
25
19
|
* has no limit unless one is set, so an object with tens of thousands of keys
|
|
26
|
-
* inside the 64KB body cap could exhaust memory.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
20
|
+
* inside the 64KB body cap could exhaust memory. The one array input is
|
|
21
|
+
* `reimbursements` on preview_payroll and run_payroll: at most 10 lines of 5
|
|
22
|
+
* members, so the widest call (run_payroll, about 22 members plus 10 + 50 for
|
|
23
|
+
* a full set of lines) stays near 85, and 256 refuses nothing real. A test
|
|
24
|
+
* sends the largest valid run_payroll call through the real server to hold
|
|
25
|
+
* that. Raise this if an input grows past it.
|
|
29
26
|
*/
|
|
30
27
|
export const MAX_TOOL_INPUT_ELEMENTS = 256;
|
|
31
28
|
/** A fresh server and credential closure for each hosted request. */
|
|
@@ -109,6 +106,7 @@ export function createNannyKeeperServer(version, context) {
|
|
|
109
106
|
"work/residence states have a reciprocal agreement — applied=true means the work state's income " +
|
|
110
107
|
"tax was suppressed under the employer's certificate attestation (set up in the NannyKeeper app " +
|
|
111
108
|
"on the employee's profile); applied=false names the certificate still to collect. " +
|
|
109
|
+
"Mileage and other reimbursements go in reimbursements, the same lines run_payroll takes. " +
|
|
112
110
|
"Use this to validate your request before calling run_payroll. " +
|
|
113
111
|
"Same parameters as run_payroll. Requires a Starter+ subscription. " +
|
|
114
112
|
"pay_date is optional. When omitted, the server picks the earliest valid business day on or " +
|
|
@@ -136,6 +134,7 @@ export function createNannyKeeperServer(version, context) {
|
|
|
136
134
|
})
|
|
137
135
|
.optional()
|
|
138
136
|
.describe("Override or skip the employee's voluntary post-tax set-aside rule for this paycheck only. The recurring rule itself is configured via the dashboard. Omit this field to apply the rule normally."),
|
|
137
|
+
reimbursements: reimbursementsParam,
|
|
139
138
|
}, {
|
|
140
139
|
title: "Preview Payroll",
|
|
141
140
|
readOnlyHint: true,
|
|
@@ -165,6 +164,9 @@ export function createNannyKeeperServer(version, context) {
|
|
|
165
164
|
"if YTD or rate configs change between approve and fire. " +
|
|
166
165
|
"Direct deposit callers: set confirm_large_payroll=true for totals >$5,000 or any single " +
|
|
167
166
|
"net pay >$3,000; set confirm_ach_debit=true for first-time DD or if no DD in 30 days. " +
|
|
167
|
+
"Mileage, transit, parking and other reimbursements: pass up to 10 lines in reimbursements. For mileage send " +
|
|
168
|
+
"type mileage, the miles and amount 0, and NannyKeeper prices the miles at the IRS rate it holds for the pay " +
|
|
169
|
+
"period and pay date unless you pass rate_per_mile; a year it holds no rate for is refused with mileage_rate_unavailable. " +
|
|
168
170
|
"Tip: use preview_payroll first to validate your request and see results before committing. " +
|
|
169
171
|
"Get employee_id from list_employees. employer_id is optional: leave it out and the API uses " +
|
|
170
172
|
"the household your API key belongs to (pass it only when one account manages several households)."), {
|
|
@@ -204,6 +206,7 @@ export function createNannyKeeperServer(version, context) {
|
|
|
204
206
|
})
|
|
205
207
|
.optional()
|
|
206
208
|
.describe("Override or skip the employee's voluntary post-tax set-aside rule for this paycheck only. The recurring rule itself is configured via the dashboard. Omit this field to apply the rule normally."),
|
|
209
|
+
reimbursements: reimbursementsParam,
|
|
207
210
|
idempotency_key: context?.publicConnection ? z.string().trim().min(1).max(255).describe("Unique key for this approved payroll. Reuse the same key with identical inputs when retrying.") : z
|
|
208
211
|
.string()
|
|
209
212
|
.optional()
|
|
@@ -313,7 +316,8 @@ export function createNannyKeeperServer(version, context) {
|
|
|
313
316
|
// Register get_payroll tool (read, 1.15.0)
|
|
314
317
|
server.tool("get_payroll", context?.publicConnection ? publicDescriptions.get_payroll : ("Read payrolls. With payroll_id: that payroll's status, dates, and each employee's gross pay, every deduction " +
|
|
315
318
|
"(federal, Social Security, Medicare, state, local), net pay, and employer taxes. Without payroll_id: the " +
|
|
316
|
-
"household's payrolls, newest first, with totals
|
|
319
|
+
"household's payrolls, newest first, with totals (list_payrolls filters that list by employee and pay date). " +
|
|
320
|
+
"Use it to confirm what run_payroll created. Read-only."), {
|
|
317
321
|
payroll_id: z.string().uuid().optional().describe("A payroll id from run_payroll. Leave it out to list payrolls."),
|
|
318
322
|
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
319
323
|
}, {
|
|
@@ -394,6 +398,7 @@ export function createNannyKeeperServer(version, context) {
|
|
|
394
398
|
idempotentHint: true,
|
|
395
399
|
openWorldHint: true,
|
|
396
400
|
}, async (args) => toolResult(await executeGetScheduleH(args, context), context?.publicConnection));
|
|
401
|
+
registerListPayrolls(server, context);
|
|
397
402
|
// Register get_quarter_taxes tool (read, 1.17.0)
|
|
398
403
|
server.tool("get_quarter_taxes", context?.publicConnection ? publicDescriptions.get_quarter_taxes : ("Get a quarter's tax figures as the household's Taxes page shows them: `items` is the checklist of what to " +
|
|
399
404
|
"pay or file, to whom and by when (an item of kind `rec` has no hard deadline this quarter but may still be " +
|
|
@@ -416,5 +421,8 @@ export function createNannyKeeperServer(version, context) {
|
|
|
416
421
|
idempotentHint: true,
|
|
417
422
|
openWorldHint: true,
|
|
418
423
|
}, async (args) => toolResult(await executeGetQuarterTaxes(args, context), context?.publicConnection));
|
|
424
|
+
// record_tax_payment (write), registered from its own module.
|
|
425
|
+
registerRecordTaxPayment(server, context, EMPLOYER_ID_OPTIONAL);
|
|
426
|
+
registerVoidPayroll(server, context);
|
|
419
427
|
return server;
|
|
420
428
|
}
|
package/dist/tools/autopilot.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* on captures a standing recurring ACH authorization that must be employer-
|
|
8
8
|
* driven in the app. Requires a Plus/Professional key (the `ach` scope).
|
|
9
9
|
*/
|
|
10
|
-
import { getToolContext } from "../context.js";
|
|
10
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
11
11
|
function missingKey() {
|
|
12
12
|
return JSON.stringify({
|
|
13
13
|
error: "NANNYKEEPER_API_KEY environment variable is not set. Autopilot management requires a Plus/Professional key: nannykeeper.com/developers/keys",
|
|
@@ -25,7 +25,7 @@ export async function executeGetAutopilot(args, context) {
|
|
|
25
25
|
if (args.employee_id)
|
|
26
26
|
params.set("employee_id", args.employee_id);
|
|
27
27
|
const response = await fetch(`${API_BASE}/api/v1/autopilot?${params.toString()}`, {
|
|
28
|
-
headers: { Authorization: `Bearer ${apiKey}
|
|
28
|
+
headers: { Authorization: `Bearer ${apiKey}`, ...CLIENT_HEADER },
|
|
29
29
|
});
|
|
30
30
|
const data = await response.json();
|
|
31
31
|
if (!response.ok) {
|
|
@@ -56,6 +56,7 @@ export async function executeManageAutopilot(args, context) {
|
|
|
56
56
|
method: "POST",
|
|
57
57
|
headers: {
|
|
58
58
|
Authorization: `Bearer ${apiKey}`,
|
|
59
|
+
...CLIENT_HEADER,
|
|
59
60
|
"Content-Type": "application/json",
|
|
60
61
|
},
|
|
61
62
|
body: JSON.stringify(body),
|
package/dist/tools/calculate.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Calls the NannyKeeper API to calculate household employer taxes.
|
|
5
5
|
*/
|
|
6
|
-
import { getToolContext } from "../context.js";
|
|
6
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
7
7
|
/**
|
|
8
8
|
* ⛔ THE DESCRIPTOR CONST THAT USED TO LIVE HERE WAS DEAD AND HAS BEEN REMOVED.
|
|
9
9
|
*
|
|
@@ -29,6 +29,7 @@ export async function executeCalculate(args, context) {
|
|
|
29
29
|
method: "POST",
|
|
30
30
|
headers: {
|
|
31
31
|
Authorization: `Bearer ${apiKey}`,
|
|
32
|
+
...CLIENT_HEADER,
|
|
32
33
|
"Content-Type": "application/json",
|
|
33
34
|
},
|
|
34
35
|
body: JSON.stringify({
|
package/dist/tools/household.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* needs (and the household's employer_id). Without it, an agent with a
|
|
7
7
|
* single-household key has no tool that returns either ID.
|
|
8
8
|
*/
|
|
9
|
-
import { getToolContext } from "../context.js";
|
|
9
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
10
10
|
const MISSING_KEY = "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys";
|
|
11
11
|
async function getJson(path, init, context) {
|
|
12
12
|
const { apiKey, apiBase } = getToolContext(context);
|
|
@@ -19,6 +19,8 @@ async function getJson(path, init, context) {
|
|
|
19
19
|
Authorization: `Bearer ${apiKey}`,
|
|
20
20
|
"Content-Type": "application/json",
|
|
21
21
|
...(init.headers ?? {}),
|
|
22
|
+
// Last, so no caller's headers can drop the label.
|
|
23
|
+
...CLIENT_HEADER,
|
|
22
24
|
},
|
|
23
25
|
});
|
|
24
26
|
const data = await response.json();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list_payrolls: the household's payrolls, newest first, from
|
|
3
|
+
* `GET /api/v1/payrolls`, filtered by employee and by pay date.
|
|
4
|
+
*
|
|
5
|
+
* It answers "what did I pay her last time?" and "list my last three
|
|
6
|
+
* payrolls" without an id the agent would otherwise need from somewhere.
|
|
7
|
+
* get_payroll still reads one payroll in full; this tool is the index.
|
|
8
|
+
*
|
|
9
|
+
* Registered from its own module (one tool per file) so a new tool never has
|
|
10
|
+
* to edit another's registration.
|
|
11
|
+
*/
|
|
12
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
|
+
import { type ToolContext } from "../context.ts";
|
|
14
|
+
export declare const LIST_PAYROLLS_DESCRIPTION: string;
|
|
15
|
+
/** The hosted listing's copy: no account or plan prompts, same facts. */
|
|
16
|
+
export declare const LIST_PAYROLLS_PUBLIC_DESCRIPTION: string;
|
|
17
|
+
export interface ListPayrollsArgs {
|
|
18
|
+
employer_id?: string;
|
|
19
|
+
employee_id?: string;
|
|
20
|
+
pay_date_from?: string;
|
|
21
|
+
pay_date_to?: string;
|
|
22
|
+
limit?: number;
|
|
23
|
+
cursor?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function executeListPayrolls(args: ListPayrollsArgs, context?: ToolContext): Promise<string>;
|
|
26
|
+
export declare function registerListPayrolls(server: McpServer, context?: ToolContext): void;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
3
|
+
import { EMPLOYER_ID_OPTIONAL } from "../params.js";
|
|
4
|
+
import { toolResult } from "../public-profile.js";
|
|
5
|
+
export const LIST_PAYROLLS_DESCRIPTION = "List the household's payrolls, newest first, each with its status, pay period, pay date, total gross pay, " +
|
|
6
|
+
"total net pay, employer taxes and the employee_ids it paid. Filter with employee_id (only payrolls that paid " +
|
|
7
|
+
"that employee) and pay_date_from / pay_date_to (inclusive pay-date range, YYYY-MM-DD). Use limit for " +
|
|
8
|
+
'"the last three payrolls" (limit: 3). When has_more is true, pass next_cursor back as cursor for the next ' +
|
|
9
|
+
"page; a cursor it did not issue answers invalid_cursor, so start again without one. Totals are for the whole payroll; call get_payroll with a payroll id for each employee's gross pay, " +
|
|
10
|
+
"deductions and net pay. Report the exact status: scheduled or processing does not mean paid, and a voided " +
|
|
11
|
+
"payroll paid nothing. An employee_id that is not in this household answers not_found. Read-only.";
|
|
12
|
+
/** The hosted listing's copy: no account or plan prompts, same facts. */
|
|
13
|
+
export const LIST_PAYROLLS_PUBLIC_DESCRIPTION = "List the household's payrolls, newest first, with status, pay period, pay date, totals and the employee IDs " +
|
|
14
|
+
"each one paid. Filter by employee_id and by an inclusive pay-date range (pay_date_from, pay_date_to). Use " +
|
|
15
|
+
"limit for the most recent few, and pass next_cursor back as cursor for more. Use get_payroll for one " +
|
|
16
|
+
"payroll's per-employee figures. Report the exact status; scheduled or processing does not mean paid. Read-only.";
|
|
17
|
+
/** A real calendar date, as the API's own pay-date rule requires. */
|
|
18
|
+
const DATE = z
|
|
19
|
+
.string()
|
|
20
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, "Use YYYY-MM-DD")
|
|
21
|
+
.refine((value) => {
|
|
22
|
+
const [y, m, d] = value.split("-").map(Number);
|
|
23
|
+
const date = new Date(Date.UTC(y, m - 1, d));
|
|
24
|
+
return date.getUTCFullYear() === y && date.getUTCMonth() === m - 1 && date.getUTCDate() === d;
|
|
25
|
+
}, "Must be a real calendar date");
|
|
26
|
+
export async function executeListPayrolls(args, context) {
|
|
27
|
+
// The API refuses a range that runs backwards; say so without a round trip.
|
|
28
|
+
if (args.pay_date_from && args.pay_date_to && args.pay_date_from > args.pay_date_to) {
|
|
29
|
+
return JSON.stringify({ error: "pay_date_from must be on or before pay_date_to", code: "validation_error" });
|
|
30
|
+
}
|
|
31
|
+
const { apiKey, apiBase } = getToolContext(context);
|
|
32
|
+
if (!apiKey) {
|
|
33
|
+
return JSON.stringify({
|
|
34
|
+
error: "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const params = new URLSearchParams();
|
|
38
|
+
for (const key of ["employer_id", "employee_id", "pay_date_from", "pay_date_to", "cursor"]) {
|
|
39
|
+
const value = args[key];
|
|
40
|
+
if (value)
|
|
41
|
+
params.set(key, value);
|
|
42
|
+
}
|
|
43
|
+
if (args.limit !== undefined)
|
|
44
|
+
params.set("limit", String(args.limit));
|
|
45
|
+
const query = params.toString();
|
|
46
|
+
try {
|
|
47
|
+
const response = await fetch(`${apiBase}/api/v1/payrolls${query ? `?${query}` : ""}`, {
|
|
48
|
+
method: "GET",
|
|
49
|
+
headers: { Authorization: `Bearer ${apiKey}`, ...CLIENT_HEADER },
|
|
50
|
+
});
|
|
51
|
+
const data = await response.json();
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
return JSON.stringify({
|
|
54
|
+
error: data.error?.message || `API error: ${response.status}`,
|
|
55
|
+
code: data.error?.code,
|
|
56
|
+
details: data.error?.details,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return JSON.stringify(data);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return JSON.stringify({
|
|
63
|
+
error: `Network error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function registerListPayrolls(server, context) {
|
|
68
|
+
server.tool("list_payrolls", context?.publicConnection ? LIST_PAYROLLS_PUBLIC_DESCRIPTION : LIST_PAYROLLS_DESCRIPTION, {
|
|
69
|
+
employee_id: z.string().uuid().optional().describe("Optional. Only payrolls that paid this employee. Get it from list_employees."),
|
|
70
|
+
pay_date_from: DATE.optional().describe("Optional. Earliest pay date to include, YYYY-MM-DD."),
|
|
71
|
+
pay_date_to: DATE.optional().describe("Optional. Latest pay date to include, YYYY-MM-DD."),
|
|
72
|
+
limit: z.number().int().min(1).max(100).optional().describe("Optional. How many payrolls to return, 1 to 100 (default 25)."),
|
|
73
|
+
cursor: z.string().max(200).optional().describe("Optional. The next_cursor from a previous call, for the next page."),
|
|
74
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
75
|
+
}, {
|
|
76
|
+
title: "List Payrolls",
|
|
77
|
+
readOnlyHint: true,
|
|
78
|
+
destructiveHint: false,
|
|
79
|
+
idempotentHint: true,
|
|
80
|
+
openWorldHint: true,
|
|
81
|
+
}, async (args) => toolResult(await executeListPayrolls(args, context), context?.publicConnection));
|
|
82
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Returns full tax breakdown and net pay — use to validate before run_payroll.
|
|
6
6
|
*/
|
|
7
7
|
import { type ToolContext } from "../context.ts";
|
|
8
|
+
import type { ReimbursementLine } from "./reimbursements.ts";
|
|
8
9
|
export declare function executePreviewPayroll(args: {
|
|
9
10
|
employer_id?: string;
|
|
10
11
|
employee_id: string;
|
|
@@ -20,4 +21,5 @@ export declare function executePreviewPayroll(args: {
|
|
|
20
21
|
skip?: boolean;
|
|
21
22
|
amount?: number;
|
|
22
23
|
};
|
|
24
|
+
reimbursements?: ReimbursementLine[];
|
|
23
25
|
}, context?: ToolContext): Promise<string>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Calls the NannyKeeper API to preview payroll without creating a record.
|
|
5
5
|
* Returns full tax breakdown and net pay — use to validate before run_payroll.
|
|
6
6
|
*/
|
|
7
|
-
import { getToolContext } from "../context.js";
|
|
7
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
8
8
|
export async function executePreviewPayroll(args, context) {
|
|
9
9
|
const { apiKey, apiBase: API_BASE } = getToolContext(context);
|
|
10
10
|
if (!apiKey) {
|
|
@@ -17,6 +17,7 @@ export async function executePreviewPayroll(args, context) {
|
|
|
17
17
|
method: "POST",
|
|
18
18
|
headers: {
|
|
19
19
|
Authorization: `Bearer ${apiKey}`,
|
|
20
|
+
...CLIENT_HEADER,
|
|
20
21
|
"Content-Type": "application/json",
|
|
21
22
|
},
|
|
22
23
|
body: JSON.stringify({
|
|
@@ -36,6 +37,10 @@ export async function executePreviewPayroll(args, context) {
|
|
|
36
37
|
...(args.voluntary_set_aside
|
|
37
38
|
? { voluntary_set_aside: args.voluntary_set_aside }
|
|
38
39
|
: {}),
|
|
40
|
+
// Sent unchanged: same field names and limits as the API.
|
|
41
|
+
...(args.reimbursements?.length
|
|
42
|
+
? { reimbursements: args.reimbursements }
|
|
43
|
+
: {}),
|
|
39
44
|
},
|
|
40
45
|
],
|
|
41
46
|
}),
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `reimbursements` parameter of preview_payroll and run_payroll.
|
|
3
|
+
*
|
|
4
|
+
* ⛔ The SAME shape and limits as the REST API's `employees[].reimbursements`
|
|
5
|
+
* (`POST /api/v1/payroll/preview` and `/run`): at most 10 lines, each a type,
|
|
6
|
+
* an amount from 0 to 9,999, optional miles from 0 to 9,999 and an optional
|
|
7
|
+
* per-mile rate from 0 to 5. The tool sends the lines through unchanged, so
|
|
8
|
+
* any limit declared here that the API does not share either refuses a
|
|
9
|
+
* payroll the API would run or lets through one it will refuse. A test in the
|
|
10
|
+
* application repository holds the two schemas to the same boundaries.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
export declare const MAX_REIMBURSEMENT_LINES = 10;
|
|
14
|
+
export declare const reimbursementLineSchema: z.ZodObject<{
|
|
15
|
+
type: z.ZodEnum<{
|
|
16
|
+
transit: "transit";
|
|
17
|
+
parking: "parking";
|
|
18
|
+
mileage: "mileage";
|
|
19
|
+
other: "other";
|
|
20
|
+
}>;
|
|
21
|
+
description: z.ZodOptional<z.ZodString>;
|
|
22
|
+
amount: z.ZodNumber;
|
|
23
|
+
miles: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
rate_per_mile: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export declare const reimbursementsParam: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
27
|
+
type: z.ZodEnum<{
|
|
28
|
+
transit: "transit";
|
|
29
|
+
parking: "parking";
|
|
30
|
+
mileage: "mileage";
|
|
31
|
+
other: "other";
|
|
32
|
+
}>;
|
|
33
|
+
description: z.ZodOptional<z.ZodString>;
|
|
34
|
+
amount: z.ZodNumber;
|
|
35
|
+
miles: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
rate_per_mile: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>>>;
|
|
38
|
+
export type ReimbursementLine = z.infer<typeof reimbursementLineSchema>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `reimbursements` parameter of preview_payroll and run_payroll.
|
|
3
|
+
*
|
|
4
|
+
* ⛔ The SAME shape and limits as the REST API's `employees[].reimbursements`
|
|
5
|
+
* (`POST /api/v1/payroll/preview` and `/run`): at most 10 lines, each a type,
|
|
6
|
+
* an amount from 0 to 9,999, optional miles from 0 to 9,999 and an optional
|
|
7
|
+
* per-mile rate from 0 to 5. The tool sends the lines through unchanged, so
|
|
8
|
+
* any limit declared here that the API does not share either refuses a
|
|
9
|
+
* payroll the API would run or lets through one it will refuse. A test in the
|
|
10
|
+
* application repository holds the two schemas to the same boundaries.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
export const MAX_REIMBURSEMENT_LINES = 10;
|
|
14
|
+
export const reimbursementLineSchema = z.object({
|
|
15
|
+
type: z
|
|
16
|
+
.enum(["transit", "parking", "mileage", "other"])
|
|
17
|
+
.describe("transit, parking, mileage or other"),
|
|
18
|
+
description: z.string().max(200).optional().describe("Optional. What it was for, as the pay stub should show it."),
|
|
19
|
+
amount: z
|
|
20
|
+
.number()
|
|
21
|
+
.min(0)
|
|
22
|
+
.max(9999)
|
|
23
|
+
.describe("Dollars. For a mileage line with miles, send 0: NannyKeeper prices the miles and ignores this amount."),
|
|
24
|
+
miles: z
|
|
25
|
+
.number()
|
|
26
|
+
.min(0)
|
|
27
|
+
.max(9999)
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Mileage lines: the miles driven this pay period."),
|
|
30
|
+
rate_per_mile: z
|
|
31
|
+
.number()
|
|
32
|
+
.min(0)
|
|
33
|
+
.max(5)
|
|
34
|
+
.optional()
|
|
35
|
+
.describe("Optional, mileage lines only. Leave it out and NannyKeeper uses the IRS business mileage rate it holds for the " +
|
|
36
|
+
"pay period and pay date. If it holds none for that year, the payroll is refused with mileage_rate_unavailable; pass the rate " +
|
|
37
|
+
"your agreement sets to continue."),
|
|
38
|
+
});
|
|
39
|
+
export const reimbursementsParam = z
|
|
40
|
+
.array(reimbursementLineSchema)
|
|
41
|
+
.max(MAX_REIMBURSEMENT_LINES)
|
|
42
|
+
.optional()
|
|
43
|
+
.describe("Optional. Up to 10 reimbursements paid with this paycheck: mileage, transit, parking or other. " +
|
|
44
|
+
"NannyKeeper adds them to net pay, outside gross pay, without calculating tax on them; a transit or parking " +
|
|
45
|
+
"line over the monthly limit, or in a year whose limit NannyKeeper does not hold, comes back with a warning. " +
|
|
46
|
+
'Mileage example: [{"type":"mileage","miles":42,"amount":0}].');
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Creates a payroll record with full tax calculations and YTD tracking.
|
|
6
6
|
*/
|
|
7
7
|
import { type ToolContext } from "../context.ts";
|
|
8
|
+
import type { ReimbursementLine } from "./reimbursements.ts";
|
|
8
9
|
export declare function executeRunPayroll(args: {
|
|
9
10
|
employer_id?: string;
|
|
10
11
|
employee_id: string;
|
|
@@ -24,6 +25,7 @@ export declare function executeRunPayroll(args: {
|
|
|
24
25
|
skip?: boolean;
|
|
25
26
|
amount?: number;
|
|
26
27
|
};
|
|
28
|
+
reimbursements?: ReimbursementLine[];
|
|
27
29
|
off_cycle?: boolean;
|
|
28
30
|
idempotency_key?: string;
|
|
29
31
|
}, context?: ToolContext): Promise<string>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Calls the NannyKeeper API to run payroll for a household employee.
|
|
5
5
|
* Creates a payroll record with full tax calculations and YTD tracking.
|
|
6
6
|
*/
|
|
7
|
-
import { getToolContext } from "../context.js";
|
|
7
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
8
8
|
export async function executeRunPayroll(args, context) {
|
|
9
9
|
const { apiKey, apiBase: API_BASE } = getToolContext(context);
|
|
10
10
|
if (!apiKey) {
|
|
@@ -15,6 +15,7 @@ export async function executeRunPayroll(args, context) {
|
|
|
15
15
|
try {
|
|
16
16
|
const headers = {
|
|
17
17
|
Authorization: `Bearer ${apiKey}`,
|
|
18
|
+
...CLIENT_HEADER,
|
|
18
19
|
"Content-Type": "application/json",
|
|
19
20
|
};
|
|
20
21
|
if (args.idempotency_key) {
|
|
@@ -41,6 +42,10 @@ export async function executeRunPayroll(args, context) {
|
|
|
41
42
|
...(args.voluntary_set_aside
|
|
42
43
|
? { voluntary_set_aside: args.voluntary_set_aside }
|
|
43
44
|
: {}),
|
|
45
|
+
// Sent unchanged: same field names and limits as the API.
|
|
46
|
+
...(args.reimbursements?.length
|
|
47
|
+
? { reimbursements: args.reimbursements }
|
|
48
|
+
: {}),
|
|
44
49
|
},
|
|
45
50
|
],
|
|
46
51
|
notes: args.notes,
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* via /settings/states or call the REST API explicitly with
|
|
19
19
|
* confirmation context.
|
|
20
20
|
*/
|
|
21
|
-
import { getToolContext } from "../context.js";
|
|
21
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
22
22
|
/**
|
|
23
23
|
* The single definition of this tool's name and description. `server.ts` imports
|
|
24
24
|
* it rather than restating it: an inline copy there is the one agents actually
|
|
@@ -71,6 +71,7 @@ export async function executeStateFilingStatus(args, context) {
|
|
|
71
71
|
const response = await fetch(url, {
|
|
72
72
|
headers: {
|
|
73
73
|
Authorization: `Bearer ${apiKey}`,
|
|
74
|
+
...CLIENT_HEADER,
|
|
74
75
|
},
|
|
75
76
|
});
|
|
76
77
|
const data = await response.json();
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* record_tax_payment: record that the household paid a
|
|
3
|
+
* quarter's tax to the IRS or a state agency, through
|
|
4
|
+
* POST /api/v1/taxes/payments, which drives the Taxes page's own "I've paid
|
|
5
|
+
* this" and "Record payment".
|
|
6
|
+
*
|
|
7
|
+
* ⛔ Passed through unchanged, like get_quarter_taxes: a refusal carries the
|
|
8
|
+
* reason and the quarter as it stands, and a tool that summarised it could
|
|
9
|
+
* hide that nothing was recorded.
|
|
10
|
+
*/
|
|
11
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { type ToolContext } from "../context.ts";
|
|
14
|
+
export interface RecordTaxPaymentArgs {
|
|
15
|
+
year: number;
|
|
16
|
+
quarter: number;
|
|
17
|
+
destination: string;
|
|
18
|
+
expected_amount?: number;
|
|
19
|
+
amount?: number;
|
|
20
|
+
payment_date?: string;
|
|
21
|
+
payment_method?: string;
|
|
22
|
+
confirmation_number?: string;
|
|
23
|
+
notes?: string;
|
|
24
|
+
closes_filing?: boolean;
|
|
25
|
+
idempotency_key: string;
|
|
26
|
+
employer_id?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function executeRecordTaxPayment(args: RecordTaxPaymentArgs, context?: ToolContext): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Registered from here rather than inline in server.ts, so parallel tool
|
|
31
|
+
* additions do not collide there. `employerId` is server.ts's shared
|
|
32
|
+
* EMPLOYER_ID_OPTIONAL, passed in so its wording stays in one place.
|
|
33
|
+
*/
|
|
34
|
+
export declare function registerRecordTaxPayment(server: McpServer, context: ToolContext | undefined, employerId: z.ZodOptional<z.ZodString>): void;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* record_tax_payment: record that the household paid a
|
|
3
|
+
* quarter's tax to the IRS or a state agency, through
|
|
4
|
+
* POST /api/v1/taxes/payments, which drives the Taxes page's own "I've paid
|
|
5
|
+
* this" and "Record payment".
|
|
6
|
+
*
|
|
7
|
+
* ⛔ Passed through unchanged, like get_quarter_taxes: a refusal carries the
|
|
8
|
+
* reason and the quarter as it stands, and a tool that summarised it could
|
|
9
|
+
* hide that nothing was recorded.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
13
|
+
import { publicDescriptions, toolResult } from "../public-profile.js";
|
|
14
|
+
export async function executeRecordTaxPayment(args, context) {
|
|
15
|
+
const { apiKey, apiBase } = getToolContext(context);
|
|
16
|
+
if (!apiKey) {
|
|
17
|
+
return JSON.stringify({
|
|
18
|
+
error: "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys",
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const { idempotency_key: idempotencyKey, ...body } = args;
|
|
22
|
+
try {
|
|
23
|
+
const response = await fetch(`${apiBase}/api/v1/taxes/payments`, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${apiKey}`,
|
|
27
|
+
"Content-Type": "application/json",
|
|
28
|
+
"Idempotency-Key": idempotencyKey,
|
|
29
|
+
...CLIENT_HEADER,
|
|
30
|
+
},
|
|
31
|
+
// Undefined members drop out of the JSON, so the API sees exactly the
|
|
32
|
+
// one figure the agent chose.
|
|
33
|
+
body: JSON.stringify(body),
|
|
34
|
+
});
|
|
35
|
+
const data = await response.json();
|
|
36
|
+
if (!response.ok) {
|
|
37
|
+
return JSON.stringify({
|
|
38
|
+
error: data.error?.message || `API error: ${response.status}`,
|
|
39
|
+
// The stable name of the refusal (figures_changed, figure_unavailable,
|
|
40
|
+
// nothing_due, annual_filing_needs_amount, destination_not_found),
|
|
41
|
+
// which the tool description tells an agent to act on.
|
|
42
|
+
code: data.error?.code,
|
|
43
|
+
details: data.error?.details,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return JSON.stringify(data);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return JSON.stringify({
|
|
50
|
+
error: `Network error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Registered from here rather than inline in server.ts, so parallel tool
|
|
56
|
+
* additions do not collide there. `employerId` is server.ts's shared
|
|
57
|
+
* EMPLOYER_ID_OPTIONAL, passed in so its wording stays in one place.
|
|
58
|
+
*/
|
|
59
|
+
export function registerRecordTaxPayment(server, context, employerId) {
|
|
60
|
+
server.tool("record_tax_payment", context?.publicConnection ? publicDescriptions.record_tax_payment : ("Record that the household PAID a quarter's tax to the IRS or a state agency, as the Taxes page's \"I've paid " +
|
|
61
|
+
"this\" does; once the payment covers what is owed, NannyKeeper stops reminding them about it. NannyKeeper " +
|
|
62
|
+
"never sends the payment: only call this " +
|
|
63
|
+
"after the user tells you they paid. First call get_quarter_taxes for the same year and quarter. `destination` is " +
|
|
64
|
+
"\"federal\" or a state_destinations id from that answer. Send exactly one figure: `expected_amount` when they paid " +
|
|
65
|
+
"the amount get_quarter_taxes showed (federal.due_now, or that destination's amount_owed), or `amount` with what " +
|
|
66
|
+
"they actually paid. A state `amount` below what is owed counts as an installment and the reminders continue; " +
|
|
67
|
+
"if the agency billed exactly that amount and the user says it settles the filing, also send closes_filing true. " +
|
|
68
|
+
"If the answer is figures_changed, the figure moved since you read it: show the user the " +
|
|
69
|
+
"new figure and ask before trying again. figure_unavailable, nothing_due or annual_filing_needs_amount mean " +
|
|
70
|
+
"NannyKeeper will not confirm a figure here: ask the user what they paid and send it as `amount`. " +
|
|
71
|
+
"already_recorded_different means a different payment is already on file and nothing was recorded: tell the " +
|
|
72
|
+
"user and ask. already_settled means the user already marked that filing paid; changes are made on the Taxes " +
|
|
73
|
+
"page. Pass the " +
|
|
74
|
+
"user's own date as payment_date when you know it; it defaults to today in US Eastern time. Use one new " +
|
|
75
|
+
"idempotency_key per payment and reuse it only to retry that same payment. already_recorded true means " +
|
|
76
|
+
"nothing new was written. This tool only ADDS a payment: it cannot change or remove one already recorded " +
|
|
77
|
+
"(its method, confirmation number, date or amount), and calling it again with amount records a second " +
|
|
78
|
+
"payment. For a correction, send the user to the Taxes page in NannyKeeper. " +
|
|
79
|
+
"For a household other than the key's own, pass its employer_id."), {
|
|
80
|
+
year: z.number().int().min(2020).max(2100).describe("The tax year, for example 2026."),
|
|
81
|
+
quarter: z.number().int().min(1).max(4).describe("The calendar quarter, 1 to 4."),
|
|
82
|
+
destination: z
|
|
83
|
+
.string()
|
|
84
|
+
.max(64)
|
|
85
|
+
.describe("\"federal\", or a state_destinations id from get_quarter_taxes, for example MD-UI."),
|
|
86
|
+
expected_amount: z
|
|
87
|
+
.number()
|
|
88
|
+
.min(0.01)
|
|
89
|
+
.max(1_000_000)
|
|
90
|
+
.optional()
|
|
91
|
+
.describe("Paid as shown: the dollar figure get_quarter_taxes returned for this destination. Send this or amount, never both."),
|
|
92
|
+
amount: z
|
|
93
|
+
.number()
|
|
94
|
+
.min(0.01)
|
|
95
|
+
.max(1_000_000)
|
|
96
|
+
.optional()
|
|
97
|
+
.describe("What the household actually paid, in dollars to the cent. Send this or expected_amount, never both."),
|
|
98
|
+
payment_date: z
|
|
99
|
+
.string()
|
|
100
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
101
|
+
.optional()
|
|
102
|
+
.describe("Optional. The day they paid, YYYY-MM-DD. Defaults to today in US Eastern time."),
|
|
103
|
+
payment_method: z
|
|
104
|
+
.enum(["eftps", "check", "direct_pay", "state_portal", "carrier_portal", "other"])
|
|
105
|
+
.optional()
|
|
106
|
+
.describe("Optional. How they paid: eftps or direct_pay for the IRS, state_portal or carrier_portal for a state."),
|
|
107
|
+
confirmation_number: z.string().max(100).optional().describe("Optional. The confirmation number the IRS or agency gave them."),
|
|
108
|
+
notes: z.string().max(500).optional().describe("Optional. A note to keep with the payment."),
|
|
109
|
+
closes_filing: z
|
|
110
|
+
.boolean()
|
|
111
|
+
.optional()
|
|
112
|
+
.describe("Optional, with amount on a state agency only: the user's figure closes that filing, as \"I paid a different amount\" on the Taxes page does."),
|
|
113
|
+
idempotency_key: z
|
|
114
|
+
.string()
|
|
115
|
+
.min(8)
|
|
116
|
+
.max(255)
|
|
117
|
+
.describe("A new unique string (a UUID) for this payment. Reuse it only to retry the same payment after an error."),
|
|
118
|
+
employer_id: employerId,
|
|
119
|
+
}, {
|
|
120
|
+
title: "Record Tax Payment",
|
|
121
|
+
readOnlyHint: false,
|
|
122
|
+
// It moves no money, but it turns off a household's tax reminders, so
|
|
123
|
+
// clients should confirm it with the user like any other consequential
|
|
124
|
+
// write.
|
|
125
|
+
destructiveHint: true,
|
|
126
|
+
// Repeating it with the same idempotency_key returns the first answer.
|
|
127
|
+
idempotentHint: true,
|
|
128
|
+
openWorldHint: true,
|
|
129
|
+
}, async (args) => toolResult(await executeRecordTaxPayment(args, context), context?.publicConnection));
|
|
130
|
+
}
|
package/dist/tools/threshold.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Calls the NannyKeeper API to check one worker's annual FICA threshold.
|
|
5
5
|
*/
|
|
6
|
-
import { getToolContext } from "../context.js";
|
|
6
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
7
7
|
/**
|
|
8
8
|
* ⛔ THE DESCRIPTOR CONST THAT USED TO LIVE HERE WAS DEAD AND HAS BEEN REMOVED.
|
|
9
9
|
*
|
|
@@ -35,6 +35,7 @@ export async function executeThreshold(args, context) {
|
|
|
35
35
|
const response = await fetch(`${API_BASE}/api/v1/threshold?${params.toString()}`, {
|
|
36
36
|
headers: {
|
|
37
37
|
Authorization: `Bearer ${apiKey}`,
|
|
38
|
+
...CLIENT_HEADER,
|
|
38
39
|
},
|
|
39
40
|
});
|
|
40
41
|
const data = await response.json();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* void_payroll: the "safe void", over
|
|
3
|
+
* `POST /api/v1/payroll/:id/void`.
|
|
4
|
+
*
|
|
5
|
+
* Two calls, never one. Without `confirmation_code` the API writes nothing and
|
|
6
|
+
* answers with the payroll (employees, period, gross, pay date) and a code
|
|
7
|
+
* that works for 10 minutes, bound to that payroll and this key. The void
|
|
8
|
+
* happens only when the code comes back, so the assistant has to show the
|
|
9
|
+
* family what it is about to undo and get a yes.
|
|
10
|
+
*
|
|
11
|
+
* Only a draft, or a scheduled direct deposit whose debit has not started.
|
|
12
|
+
* Anything with money on the move, and every completed payroll, is refused
|
|
13
|
+
* with a link to void it in the app: money that is already on the move is
|
|
14
|
+
* never voided from an assistant.
|
|
15
|
+
*
|
|
16
|
+
* ⛔ The tool passes the API's answer through. It never retries a refusal and
|
|
17
|
+
* never mints or remembers a code itself; the API owns both.
|
|
18
|
+
*/
|
|
19
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
20
|
+
import { type ToolContext } from "../context.ts";
|
|
21
|
+
export declare const voidPayrollTool: {
|
|
22
|
+
readonly name: "void_payroll";
|
|
23
|
+
readonly description: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function executeVoidPayroll(args: {
|
|
26
|
+
payroll_id: string;
|
|
27
|
+
confirmation_code?: string;
|
|
28
|
+
reason?: string;
|
|
29
|
+
employer_id?: string;
|
|
30
|
+
}, context?: ToolContext): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Registered from this module, like `list_payrolls`, so the tool owns its
|
|
33
|
+
* whole surface. Two calls: the first returns the payroll and a confirmation
|
|
34
|
+
* code and writes nothing; the second, with the code, voids. Only a draft or a
|
|
35
|
+
* scheduled direct deposit whose debit has not started; the API refuses
|
|
36
|
+
* everything else with a link to the app.
|
|
37
|
+
*/
|
|
38
|
+
export declare function registerVoidPayroll(server: McpServer, context?: ToolContext): void;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* void_payroll: the "safe void", over
|
|
3
|
+
* `POST /api/v1/payroll/:id/void`.
|
|
4
|
+
*
|
|
5
|
+
* Two calls, never one. Without `confirmation_code` the API writes nothing and
|
|
6
|
+
* answers with the payroll (employees, period, gross, pay date) and a code
|
|
7
|
+
* that works for 10 minutes, bound to that payroll and this key. The void
|
|
8
|
+
* happens only when the code comes back, so the assistant has to show the
|
|
9
|
+
* family what it is about to undo and get a yes.
|
|
10
|
+
*
|
|
11
|
+
* Only a draft, or a scheduled direct deposit whose debit has not started.
|
|
12
|
+
* Anything with money on the move, and every completed payroll, is refused
|
|
13
|
+
* with a link to void it in the app: money that is already on the move is
|
|
14
|
+
* never voided from an assistant.
|
|
15
|
+
*
|
|
16
|
+
* ⛔ The tool passes the API's answer through. It never retries a refusal and
|
|
17
|
+
* never mints or remembers a code itself; the API owns both.
|
|
18
|
+
*/
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
import { CLIENT_HEADER, getToolContext } from "../context.js";
|
|
21
|
+
import { EMPLOYER_ID_OPTIONAL } from "../params.js";
|
|
22
|
+
import { toolResult } from "../public-profile.js";
|
|
23
|
+
export const voidPayrollTool = {
|
|
24
|
+
name: "void_payroll",
|
|
25
|
+
description: "Void a payroll that has not moved any money: a draft, or a scheduled direct deposit whose bank debit has " +
|
|
26
|
+
"not started. Two steps. First call it with payroll_id only: nothing is voided, and you get the payroll " +
|
|
27
|
+
"(employees, pay period, gross, pay date) and a confirmation_code that works for 10 minutes. Show the user " +
|
|
28
|
+
"that payroll and ask them to confirm. Only after they say yes, call it again with the same payroll_id, the " +
|
|
29
|
+
"confirmation_code and a short reason. A payroll with money already on the move (approved, processing, " +
|
|
30
|
+
"funded or paid) or a completed one is refused with code payroll_not_voidable_via_api and an app_url: give " +
|
|
31
|
+
"the user that link to void it in the NannyKeeper app, and do not retry. If the code is refused " +
|
|
32
|
+
"(confirmation_expired, confirmation_invalid, payroll_changed), start again from the first step and confirm " +
|
|
33
|
+
"with the user again. For a household other than the key's own, pass its employer_id.",
|
|
34
|
+
};
|
|
35
|
+
/** The hosted (public listing) copy: no sign-up or pricing prompts. */
|
|
36
|
+
const VOID_PAYROLL_PUBLIC_DESCRIPTION = "Void a payroll that has not moved any money: a draft, or a scheduled direct deposit whose debit has not started. Two steps: call with payroll_id only to get the payroll and a confirmation_code (nothing is voided), show the user that payroll and get their explicit confirmation, then call again with the code and a reason. A payroll with money already on the move, or a completed one, is refused with an app_url; give the user that link and do not retry.";
|
|
37
|
+
export async function executeVoidPayroll(args, context) {
|
|
38
|
+
const { apiKey, apiBase } = getToolContext(context);
|
|
39
|
+
if (!apiKey) {
|
|
40
|
+
return JSON.stringify({
|
|
41
|
+
error: "NANNYKEEPER_API_KEY environment variable is not set. Get a key at nannykeeper.com/developers/keys",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const response = await fetch(`${apiBase}/api/v1/payroll/${encodeURIComponent(args.payroll_id)}/void`, {
|
|
46
|
+
method: "POST",
|
|
47
|
+
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", ...CLIENT_HEADER },
|
|
48
|
+
body: JSON.stringify({
|
|
49
|
+
...(args.confirmation_code ? { confirmation_code: args.confirmation_code } : {}),
|
|
50
|
+
...(args.reason ? { reason: args.reason } : {}),
|
|
51
|
+
...(args.employer_id ? { employer_id: args.employer_id } : {}),
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
const data = await response.json();
|
|
55
|
+
if (!response.ok) {
|
|
56
|
+
if (response.status === 429) {
|
|
57
|
+
return JSON.stringify({ error: "Rate limit exceeded. Please wait before retrying." });
|
|
58
|
+
}
|
|
59
|
+
return JSON.stringify({
|
|
60
|
+
error: data.error?.message || `API error: ${response.status}`,
|
|
61
|
+
// The stable name of the refusal, which the description tells the
|
|
62
|
+
// agent to act on (payroll_not_voidable_via_api, confirmation_expired…).
|
|
63
|
+
code: data.error?.code,
|
|
64
|
+
details: data.error?.details,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return JSON.stringify(data);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
return JSON.stringify({
|
|
71
|
+
error: `Network error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Registered from this module, like `list_payrolls`, so the tool owns its
|
|
77
|
+
* whole surface. Two calls: the first returns the payroll and a confirmation
|
|
78
|
+
* code and writes nothing; the second, with the code, voids. Only a draft or a
|
|
79
|
+
* scheduled direct deposit whose debit has not started; the API refuses
|
|
80
|
+
* everything else with a link to the app.
|
|
81
|
+
*/
|
|
82
|
+
export function registerVoidPayroll(server, context) {
|
|
83
|
+
server.tool(voidPayrollTool.name, context?.publicConnection ? VOID_PAYROLL_PUBLIC_DESCRIPTION : voidPayrollTool.description, {
|
|
84
|
+
payroll_id: z.string().uuid().describe("The payroll id from get_payroll, list_payrolls or run_payroll."),
|
|
85
|
+
confirmation_code: z
|
|
86
|
+
.string()
|
|
87
|
+
.min(1)
|
|
88
|
+
.max(1024)
|
|
89
|
+
.optional()
|
|
90
|
+
.describe("Leave it out on the first call. Then pass the code the first call returned, only after the user confirmed."),
|
|
91
|
+
reason: z
|
|
92
|
+
.string()
|
|
93
|
+
.trim()
|
|
94
|
+
.min(1)
|
|
95
|
+
.max(500)
|
|
96
|
+
.optional()
|
|
97
|
+
.describe("Required with confirmation_code: why the payroll is being voided, in a few words (for example 'Wrong hours')."),
|
|
98
|
+
employer_id: EMPLOYER_ID_OPTIONAL,
|
|
99
|
+
}, {
|
|
100
|
+
title: "Void Payroll",
|
|
101
|
+
readOnlyHint: false,
|
|
102
|
+
destructiveHint: true,
|
|
103
|
+
idempotentHint: false,
|
|
104
|
+
openWorldHint: true,
|
|
105
|
+
}, async (args) => toolResult(await executeVoidPayroll(args, context), context?.publicConnection));
|
|
106
|
+
}
|
package/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "nannykeeper",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"description": "Calculate US household employer (nanny) taxes for all 50 states. List employees, preview and run payroll, read payrolls and pay stubs, get download links for W-2s and Schedule H, list state agency account numbers, and manage existing Autopilot enrollments.
|
|
4
|
+
"version": "1.19.0",
|
|
5
|
+
"description": "Calculate US household employer (nanny) taxes for all 50 states. List employees, preview and run payroll with mileage, read and list payrolls and pay stubs, read a quarter's taxes, get download links for W-2s and Schedule H, list state agency account numbers, and manage existing Autopilot enrollments. 14 tools: calculate_nanny_taxes, check_threshold, list_employees, preview_payroll, run_payroll, get_payroll, list_payrolls, get_pay_stub, get_w2, get_schedule_h, get_quarter_taxes, get_state_filing_status, get_autopilot, manage_autopilot.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "nannykeeper",
|
|
8
8
|
"url": "https://github.com/nannykeeper"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nannykeeper/mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"mcpName": "com.nannykeeper.www/mcp-server",
|
|
5
5
|
"description": "MCP server for calculating US household employer (nanny) taxes. All 50 states. Works with Claude, ChatGPT, and any MCP-compatible AI agent.",
|
|
6
6
|
"keywords": [
|